From 80810971c80876bf4f830281c1c8005400fc055d Mon Sep 17 00:00:00 2001 From: Emil Muratov Date: Thu, 22 Jul 2021 23:26:05 +0300 Subject: [PATCH] lwip menuconfig option for max number of SNTP servers LWIP has two definess for setting max number of sntp servers: - Total number of handled servers - max number of sntp's picked via DHCP by default both values are equal to 1, but could be set separately Signed-off-by: Emil Muratov --- components/lwip/Kconfig | 10 +++++++++- components/lwip/port/esp32/include/lwipopts.h | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 3393df5bc5..503ed470ac 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -837,7 +837,7 @@ menu "LWIP" menu "SNTP" - config LWIP_DHCP_MAX_NTP_SERVERS + config LWIP_SNTP_MAX_SERVERS int "Maximum number of NTP servers" default 1 range 1 16 @@ -846,6 +846,14 @@ menu "LWIP" First argument of sntp_setserver/sntp_setservername functions is limited to this value. + config LWIP_DHCP_MAX_NTP_SERVERS + int "Maximum number of NTP servers aquired via DHCP" + default 1 + range 1 16 + help + Set maximum number of NTP servers aquired via DHCP-offer. + Must be less or equal to total "Maximum number of NTP servers". + config LWIP_SNTP_UPDATE_DELAY int "Request interval to update time (ms)" range 15000 4294967295 diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index 72e2bc4a97..faea22fb4a 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -1074,6 +1074,11 @@ LWIP_FORWARD_DECLARE_C_CXX void sntp_sync_time(struct timeval *tv); LWIP_FORWARD_DECLARE_C_CXX uint32_t sntp_get_sync_interval(void); +// Max number of SNTP servers handled (default equal to LWIP_DHCP_MAX_NTP_SERVERS) +#if CONFIG_LWIP_SNTP_MAX_SERVERS_DEFINED && !defined SNTP_MAX_SERVERS +#define SNTP_MAX_SERVERS CONFIG_LWIP_SNTP_MAX_SERVERS +#endif // CONFIG_LWIP_SNTP_MAX_SERVERS_DEFINED + /** Set this to 1 to support DNS names (or IP address strings) to set sntp servers * One server address/name can be defined as default if SNTP_SERVER_DNS == 1: * \#define SNTP_SERVER_ADDRESS "pool.ntp.org"