diff --git a/examples/dhcpd/target.c b/examples/dhcpd/target.c index 601371e26..95997c6b8 100644 --- a/examples/dhcpd/target.c +++ b/examples/dhcpd/target.c @@ -127,6 +127,11 @@ int dhcpd_main(int argc, char *argv[]) addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_NETMASK); netlib_set_ipv4netmask("eth0", &addr); + /* New versions of netlib_set_ipvXaddr will not bring the network up, + * So ensure the network is really up at this point. */ + + netlib_ifup("eth0"); + /* Then start the server */ dhcpd_run(); diff --git a/examples/discover/discover_main.c b/examples/discover/discover_main.c index 4be25419e..cf0b72c90 100644 --- a/examples/discover/discover_main.c +++ b/examples/discover/discover_main.c @@ -134,6 +134,11 @@ int discover_main(int argc, char *argv[]) addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_NETMASK); netlib_set_ipv4netmask("eth0", &addr); + /* New versions of netlib_set_ipvXaddr will not bring the network up, + * So ensure the network is really up at this point. */ + + netlib_ifup("eth0"); + #ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC /* Get the MAC address of the NIC */ diff --git a/examples/sendmail/sendmail_main.c b/examples/sendmail/sendmail_main.c index 37ddbf387..018bc827b 100644 --- a/examples/sendmail/sendmail_main.c +++ b/examples/sendmail/sendmail_main.c @@ -150,6 +150,11 @@ int sendmail_main(int argc, char *argv[]) addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_NETMASK); netlib_set_ipv4netmask("eth0", &addr); + /* New versions of netlib_set_ipvXaddr will not bring the network up, + * So ensure the network is really up at this point. */ + + netlib_ifup("eth0"); + /* Then send the mail */ net_ipaddr(addr.s_addr, 127, 0, 0, 1); diff --git a/examples/tcpecho/tcpecho_main.c b/examples/tcpecho/tcpecho_main.c index 1172f87e1..87644abe5 100644 --- a/examples/tcpecho/tcpecho_main.c +++ b/examples/tcpecho/tcpecho_main.c @@ -143,6 +143,11 @@ static int tcpecho_netsetup() addr.s_addr = HTONL(CONFIG_EXAMPLES_TCPECHO_NETMASK); netlib_set_ipv4netmask("eth0", &addr); + /* New versions of netlib_set_ipvXaddr will not bring the network up, + * So ensure the network is really up at this point. */ + + netlib_ifup("eth0"); + #ifdef CONFIG_EXAMPLES_TCPECHO_DHCPC /* Get the MAC address of the NIC */ diff --git a/examples/udp/target.c b/examples/udp/target.c index 911f94f46..749d74e02 100644 --- a/examples/udp/target.c +++ b/examples/udp/target.c @@ -160,6 +160,11 @@ int udp_main(int argc, char *argv[]) #endif /* CONFIG_EXAMPLES_UDP_IPv6 */ + /* New versions of netlib_set_ipvXaddr will not bring the network up, + * So ensure the network is really up at this point. */ + + netlib_ifup("eth0"); + #ifdef CONFIG_EXAMPLES_UDP_SERVER recv_server(); #else diff --git a/nshlib/nsh_netinit.c b/nshlib/nsh_netinit.c index 3f537cf89..8b344f850 100644 --- a/nshlib/nsh_netinit.c +++ b/nshlib/nsh_netinit.c @@ -358,6 +358,11 @@ static void nsh_netinit_configure(void) netlib_set_ipv4dnsaddr(&addr); #endif + /* New versions of netlib_set_ipvXaddr will not bring the network up, + * So ensure the network is really up at this point. */ + + netlib_ifup("eth0"); + #ifdef CONFIG_WIRELESS_WAPI /* Associate the wlan with an access point. */