Skip to content

Net services should start after the stack is fully ready #15141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions subsys/net/ip/dhcpv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ enum dhcpv4_msg_type {
*/
#define DHCPV4_INITIAL_DELAY_MIN 1

#if defined(CONFIG_NET_DHCPV4)

int net_dhcpv4_init(void);

#else

#define net_dhcpv4_init() 0

#endif /* CONFIG_NET_DHCPV4 */

#endif /* __INTERNAL_DHCPV4_H */
31 changes: 16 additions & 15 deletions subsys/net/ip/net_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ LOG_MODULE_REGISTER(net_core, CONFIG_NET_CORE_LOG_LEVEL);

#include "icmpv4.h"

#if defined(CONFIG_NET_DHCPV4)
#include "dhcpv4.h"
#endif

#include "route.h"

Expand Down Expand Up @@ -426,15 +424,27 @@ static inline void l3_init(void)

net_route_init();

NET_DBG("Network L3 init done");
}

static inline int services_init(void)
{
int status;

status = net_dhcpv4_init();
if (status) {
return status;
}

dns_init_resolver();

NET_DBG("Network L3 init done");
net_shell_init();

return status;
}

static int net_init(struct device *unused)
{
int status = 0;

net_hostname_init();

NET_DBG("Priority %d", CONFIG_NET_INIT_PRIO);
Expand All @@ -449,16 +459,7 @@ static int net_init(struct device *unused)

init_rx_queues();

#if CONFIG_NET_DHCPV4
status = net_dhcpv4_init();
if (status) {
return status;
}
#endif

net_shell_init();

return status;
return services_init();
}

SYS_INIT(net_init, POST_KERNEL, CONFIG_NET_INIT_PRIO);