Skip to content

Commit 051d257

Browse files
maass-hamburgkartben
authored andcommitted
net: config: sntp: don't use fallback, when Kconfig is not set
don't use fallback address, when Kconfig server address is not set. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 5819e17 commit 051d257

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

subsys/net/lib/config/init_clock_sntp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ static int sntp_init_helper(struct sntp_time *tm)
3636
return sntp_simple_addr((struct sockaddr *)&sntp_addr, sizeof(sntp_addr),
3737
CONFIG_NET_CONFIG_SNTP_INIT_TIMEOUT, tm);
3838
}
39+
if (sizeof(CONFIG_NET_CONFIG_SNTP_INIT_SERVER) == 1) {
40+
/* Empty address, skip using SNTP via Kconfig defaults */
41+
return -EINVAL;
42+
}
3943
LOG_INF("SNTP address not set by DHCPv4, using Kconfig defaults");
4044
#endif /* NET_CONFIG_SNTP_INIT_SERVER_USE_DHCPV4_OPTION */
4145
return sntp_simple(CONFIG_NET_CONFIG_SNTP_INIT_SERVER,

0 commit comments

Comments
 (0)