Skip to content

Commit 57a6232

Browse files
committed
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 <[email protected]> Reported-by: Michal Simek <[email protected]>
1 parent 4462ab9 commit 57a6232

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

net/lwip/dhcp.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <dm/device.h>
99
#include <linux/delay.h>
1010
#include <linux/errno.h>
11+
#include <lwip/apps/sntp.h>
1112
#include <lwip/dhcp.h>
1213
#include <lwip/dns.h>
1314
#include <lwip/timeouts.h>
@@ -48,6 +49,13 @@ static int dhcp_loop(struct udevice *udev)
4849
if (!netif)
4950
return CMD_RET_FAILURE;
5051

52+
/*
53+
* Request the DHCP stack to parse and store the NTP servers for
54+
* eventual use by the SNTP command
55+
*/
56+
if (CONFIG_IS_ENABLED(CMD_SNTP))
57+
sntp_servermode_dhcp(1);
58+
5159
start = get_timer(0);
5260

5361
if (dhcp_start(netif))

0 commit comments

Comments
 (0)