xiaoxiang781216 commented on a change in pull request #415: URL: https://github.com/apache/incubator-nuttx-apps/pull/415#discussion_r498854277
########## 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: Do you think the follow code is reasonable and more simple? ``` ret = ipcfg_read(NET_DEVNAME, &g_netconf); if (ret < 0) { /* Set the default value from Kconfig here */ g_netconf.proto = BOOTPROTO_STATIC; g_netconf.s_addr = CONFIG_NETINIT_IPADDR; ... } /* Share the same code regardless where we get the config from EEPROM or Kconfig */ ... ``` ---------------------------------------------------------------- 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