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 <marco.argiolas@ftpsolutions.com.au>
This commit is contained in:
Marco Argiolas 2023-01-02 10:10:05 +08:00 committed by Carles Cufí
parent d51182d57d
commit 2527320848

View file

@ -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 */