You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/09/25 14:21:30 UTC

[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a change in pull request #402: Network Monitor: Runtime selection of DHCP/Static IP with fall back set by the board, and a polled mode for HW lacking a PHY interrupt

xiaoxiang781216 commented on a change in pull request #402:
URL: https://github.com/apache/incubator-nuttx-apps/pull/402#discussion_r495019024



##########
File path: netutils/netinit/netinit.c
##########
@@ -627,6 +655,18 @@ static int netinit_monitor(void)
     }
 
 #endif
+
+#ifdef CONFIG_NETINIT_DHCPC
+  /* We assume that the netinit_thread was able to get a lease
+   * If it did we set up the renew point at lease_time / 2
+   * if it did not the renew point is now.
+   */
+
+  DEBUGVERIFY(clock_gettime(CLOCK_REALTIME, &dhcprenew));

Review comment:
       should we use time API to simplify the timing calculator?

##########
File path: netutils/netinit/netinit.c
##########
@@ -357,6 +365,85 @@ static void netinit_set_macaddr(void)
 #  define netinit_set_macaddr()
 #endif
 
+#ifdef CONFIG_BOARDCTL_NETCONF
+/****************************************************************************
+ * 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 = boardctl(BOARDIOC_NETCONF, (uintptr_t) &g_netconf);

Review comment:
       why not support ipv6

##########
File path: netutils/netinit/netinit.c
##########
@@ -533,6 +554,10 @@ static void netinit_configure(void)
 #ifndef CONFIG_NETINIT_NETLOCAL
   /* Bring the network up. */
 
+#ifdef CONFIG_NETINIT_DHCPC
+    memset(&g_ds, 0, sizeof(g_ds));

Review comment:
       don't need, global variable is already zerod




----------------------------------------------------------------
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:
users@infra.apache.org