Skip to content

Commit 5819e17

Browse files
maass-hamburgkartben
authored andcommitted
net: config: sntp: add assert, when address is not set.
when the sntp address is not set and geting it via dhcp is not activated do a build assert. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 71aa1b1 commit 5819e17

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

subsys/net/lib/config/init_clock_sntp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ static void sntp_resync_handler(struct k_work *work);
1818
static K_WORK_DELAYABLE_DEFINE(sntp_resync_work_handle, sntp_resync_handler);
1919
#endif
2020

21+
BUILD_ASSERT(
22+
IS_ENABLED(CONFIG_NET_CONFIG_SNTP_INIT_SERVER_USE_DHCPV4_OPTION) ||
23+
(sizeof(CONFIG_NET_CONFIG_SNTP_INIT_SERVER) != 1),
24+
"SNTP server has to be configured, unless DHCPv4 is used to set it");
25+
2126
static int sntp_init_helper(struct sntp_time *tm)
2227
{
2328
#ifdef CONFIG_NET_CONFIG_SNTP_INIT_SERVER_USE_DHCPV4_OPTION

0 commit comments

Comments
 (0)