masc2008 commented on code in PR #3451:
URL: https://github.com/apache/nuttx-apps/pull/3451#discussion_r3072146699
##########
netutils/netlib/netlib_obtainipv4addr.c:
##########
@@ -105,6 +112,57 @@ static int dhcp_setup_result(FAR const char *ifname,
return OK;
}
+#ifdef CONFIG_NETUTILS_NTPCLIENT
+static int dhcp_set_ntp_servers(FAR const struct dhcpc_state *ds)
+{
+ char ntp_server_list[CONFIG_NETUTILS_DHCPC_NTP_SERVER_NUM *
+ (INET_ADDRSTRLEN + 1)];
+ size_t offset = 0;
+ uint8_t i;
+
+ if (ds->num_ntpaddr == 0)
+ {
+ return ntpc_set_dhcp_servers(NULL);
+ }
+
+ ntp_server_list[0] = '\0';
+
+ for (i = 0; i < ds->num_ntpaddr; i++)
+ {
+ char addrbuf[INET_ADDRSTRLEN];
+ int ret;
+
+ if (ds->ntpaddr[i].s_addr == 0)
+ {
+ continue;
+ }
+
+ if (inet_ntop(AF_INET, &ds->ntpaddr[i], addrbuf, sizeof(addrbuf)) ==
Review Comment:
here is the reason:
- We reused ntpc’s existing server-list representation to minimize parser
and storage changes.
- That kept DHCP-learned servers compatible with the same path used for
configured server lists,
including mixed hostname/address handling.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]