mbox series

[0/3] sntp for NET_LWIP

Message ID 20250521151516.16729-1-jerome.forissier@linaro.org
Headers show
Series sntp for NET_LWIP | expand

Message

Jerome Forissier May 21, 2025, 3:14 p.m. UTC
Implement the sntp command with lwIP (CONFIG_NET_LWIP=y). SNTP is
supported as an app in lib/lwip/lwip/src/apps/sntp/sntp.c so this is
mainly about adding that file to the build and writing do_sntp() to use
the sntp_*() API and run the receive & timer loop. There is a patch to
extract a small bit of common code from net/sntp.c to avoid duplication.
The QEMU arm64 lwIP defconfig is updated to provide the sntp command by
default for convenience.
I could not test the case when the NTP server IP is provided by DHCP. If
someone has access right away to such a configuration and in case it
does not work, please let me know.


Jerome Forissier (3):
  net: extract function net_sntp_set_rtc() from sntp_handler()
  net: lwip: add sntp command
  configs: qemu_arm64_lwip_defconfig: enable CMD_SNTP

 cmd/Kconfig                       |  13 +--
 cmd/net-lwip.c                    |   5 ++
 configs/qemu_arm64_lwip_defconfig |   1 +
 include/net-common.h              |  13 +++
 lib/lwip/Makefile                 |   1 +
 lib/lwip/u-boot/arch/cc.h         |   4 +
 lib/lwip/u-boot/lwipopts.h        |   4 +
 net/lwip/Makefile                 |   1 +
 net/lwip/sntp.c                   | 128 ++++++++++++++++++++++++++++++
 net/net-common.c                  |  28 +++++++
 net/sntp.c                        |  23 +-----
 11 files changed, 195 insertions(+), 26 deletions(-)
 create mode 100644 net/lwip/sntp.c