summaryrefslogtreecommitdiff
path: root/net/lwip/dhcp.c
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2025-09-22 11:35:42 +0200
committerJerome Forissier <jerome.forissier@linaro.org>2025-09-30 12:01:36 +0200
commit57a623230eaadc836c548a1e7effae34ec11eb0f (patch)
treeba8c3cf51263dd55e49dc554b90e81e13294fbd0 /net/lwip/dhcp.c
parent4462ab9a0b559a45c2b3e2dfb3912303e3449c9b (diff)
net: lwip: dhcp: make NTP servers usable by the sntp command
When both CMD_DHCP and CMD_SNTP are enabled, one would expect the NTP servers received by DHCP to be used by the sntp command by default. Fix dhcp_loop() so that it is indeed the case. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reported-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'net/lwip/dhcp.c')
-rw-r--r--net/lwip/dhcp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c
index 4c9cb0ecaa0..cbdfea3ba82 100644
--- a/net/lwip/dhcp.c
+++ b/net/lwip/dhcp.c
@@ -8,6 +8,7 @@
#include <dm/device.h>
#include <linux/delay.h>
#include <linux/errno.h>
+#include <lwip/apps/sntp.h>
#include <lwip/dhcp.h>
#include <lwip/dns.h>
#include <lwip/timeouts.h>
@@ -48,6 +49,13 @@ static int dhcp_loop(struct udevice *udev)
if (!netif)
return CMD_RET_FAILURE;
+ /*
+ * Request the DHCP stack to parse and store the NTP servers for
+ * eventual use by the SNTP command
+ */
+ if (CONFIG_IS_ENABLED(CMD_SNTP))
+ sntp_servermode_dhcp(1);
+
start = get_timer(0);
if (dhcp_start(netif))