From 2527320848e51b15577398cfb2010131521d6e50 Mon Sep 17 00:00:00 2001 From: Marco Argiolas Date: Mon, 2 Jan 2023 10:10:05 +0800 Subject: [PATCH] net: lib: sntp: add support for unspecified IP-family type `sntp_simple()` was forcing to resolve SNTP-server's URL into IPv4 address addresses. This was not allowing sntp_init() to succeed in case the system did not support IPv4 addresses (returning EPFNOSUPPORT, ie. Protocol Family error). Now by default SNTP has unspecified family type and it relies on `net_getaddrinfo_addr_str()` to be able to resolve literal server URLs into the supported IP family type. Signed-off-by: Marco Argiolas --- subsys/net/lib/sntp/sntp_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/sntp/sntp_simple.c b/subsys/net/lib/sntp/sntp_simple.c index 1c68af871ef..9399f578f88 100644 --- a/subsys/net/lib/sntp/sntp_simple.c +++ b/subsys/net/lib/sntp/sntp_simple.c @@ -17,7 +17,7 @@ int sntp_simple(const char *server, uint32_t timeout, struct sntp_time *time) uint64_t deadline; uint32_t iter_timeout; - hints.ai_family = AF_INET; + hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; /* 123 is the standard SNTP port per RFC4330 */