Merged in slorquet/apps/ifupfixes (pull request #85)

Ensure netlib will not be broken when setip will not bring the network up anymore

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Sebastien Lorquet 2017-05-19 16:05:10 +00:00 committed by Gregory Nutt
commit 395c191b43
18 changed files with 110 additions and 0 deletions

View File

@ -129,6 +129,12 @@ printf("NET1: Configuring %s\n", CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME);
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET1_NETMASK);
netlib_set_ipv4netmask(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &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_BRIDGE_NET1_DHCPC
/* Get the MAC address of the NIC */

View File

@ -127,6 +127,12 @@ 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();

View File

@ -134,6 +134,12 @@ 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 */

View File

@ -114,6 +114,13 @@ static void fptd_netinit(void)
addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_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");
#endif /* CONFIG_EXAMPLES_FTPD_NONETINIT */
}

View File

@ -123,6 +123,12 @@ int igmp_main(int argc, char *argv[])
addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_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");
/* Not much of a test for now */
/* Join the group */

View File

@ -159,6 +159,12 @@ static void netest_initialize(void)
netlib_set_ipv6netmask("eth0",
(FAR const struct in6_addr *)g_ipv6_netmask);
/* 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");
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#else /* CONFIG_EXAMPLES_NETTEST_IPv6 */

View File

@ -325,6 +325,12 @@ static void net_configure(void)
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_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");
}
/****************************************************************************

View File

@ -118,6 +118,12 @@ static void net_configure(void)
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_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");
}
/****************************************************************************

View File

@ -150,6 +150,12 @@ 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);

View File

@ -143,6 +143,12 @@ 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 */

View File

@ -218,6 +218,12 @@ static void telnetd_netinit(void)
addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_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");
}
/****************************************************************************

View File

@ -254,6 +254,12 @@ int thttp_main(int argc, char *argv[])
addr.s_addr = HTONL(CONFIG_EXAMPLES_THTTPD_NETMASK);
netlib_set_ipv4netmask(NET_DEVNAME, &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_THTTPD_NXFLAT
/* Initialize the NXFLAT binary loader */

View File

@ -160,6 +160,12 @@ 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

View File

@ -173,6 +173,13 @@ static void netest_initialize(void)
netlib_set_ipv4netmask("eth0", &addr);
#endif /* CONFIG_EXAMPLES_UDPBLASTER_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");
}
#endif /*CONFIG_EXAMPLES_UDPBLASTER_INIT */

View File

@ -140,6 +140,12 @@ int webserver_main(int argc, char *argv[])
addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_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_WEBSERVER_DHCPC
/* Get the MAC address of the NIC */

View File

@ -144,6 +144,12 @@ int wget_main(int argc, char *argv[])
addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_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 */
wget(CONFIG_EXAMPLES_WGET_URL, g_iobuffer, 512, callback, NULL);

View File

@ -308,6 +308,12 @@ static int xmlrpc_netinit(void)
addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_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_XMLRPC_DHCPC
/* Get the MAC address of the NIC */

View File

@ -358,6 +358,12 @@ 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. */