xiaoxiang781216 commented on a change in pull request #415: URL: https://github.com/apache/incubator-nuttx-apps/pull/415#discussion_r498607844
########## File path: netutils/netinit/Kconfig ########## @@ -87,10 +87,38 @@ config NETINIT_MONITOR required for network initialization are never released. if NETINIT_MONITOR +config NETINIT_ESTABLISH_POLL_RATE + int "The poll rate in seconds, to check for link establishment." + default 2 + depends on !ARCH_PHY_INTERRUPT && ARCH_PHY_POLLED + ---help--- + The network monitor will check the PHY link state every + NETINIT_ESTABLISH_POLL_RATE seconds for link establishment. + +config NETINIT_LOSS_POLL_RATE + int "The poll rate in seconds, to check for link loss." + default 3 + depends on !ARCH_PHY_INTERRUPT && ARCH_PHY_POLLED + ---help--- + The network monitor will check the PHY link state every + NETINIT_LOSS_POLL_RATE seconds for link loss. + +config NETINIT_FALLBACK + int "The number of failed DHCP attempts to fall back to using static settings" + default 5 + depends on !ARCH_PHY_INTERRUPT && ARCH_PHY_POLLED && FSUTILS_IPCFG Review comment: Since DHCP isn't relate to the PHY operation, I don't think there are any reason to disable FALLBACK in this case. Let's desgin the thing right at the first place. BTW, the option should depend on DHCPC instead, add rename to NETINIT_DHCPC_FALLBACK. ########## File path: netutils/netinit/netinit.c ########## @@ -357,6 +367,86 @@ static void netinit_set_macaddr(void) # define netinit_set_macaddr() #endif +#ifdef CONFIG_FSUTILS_IPCFG +/**************************************************************************** + * Name: netinit_get_ipaddrs + * + * Description: + * Setup IP addresses. + * + * For 6LoWPAN, the IP address derives from the MAC address. Setting it + * to any user provided value is asking for trouble. + * + ****************************************************************************/ + +static int netinit_get_ipaddrs(void) +{ +#ifdef CONFIG_NETINIT_DHCPC + bool use_dhcp = false; +#endif + bool use_static = false; +#ifdef CONFIG_NET_IPv4 + struct in_addr addr; + int ret; + + ret = ipcfg_read(NET_DEVNAME, &g_netconf); + if (ret < 0) + { + return ret; Review comment: can we initialize g_netconf here with the default value? so we don't need duplicate netlib_set_xxx. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org