-
Notifications
You must be signed in to change notification settings - Fork 7.3k
net: config: sntp: add option for failure try interval #88950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
net: config: sntp: add option for failure try interval #88950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an option to use a distinct resynchronization interval when SNTP requests fail and includes a build assert to verify that an SNTP server is properly configured. Key changes include:
- Insertion of a BUILD_ASSERT to validate SNTP server configuration.
- Addition of an if-block in sntp_init_helper to bypass SNTP initialization when the address is empty.
- Modification of net_init_clock_via_sntp to conditionally set the resync interval based on the success or failure of the SNTP request.
Files not reviewed (1)
- subsys/net/lib/config/Kconfig: Language not supported
add option for a different resync interval, that is applied when the sntp request fails. Signed-off-by: Fin Maaß <[email protected]>
1426cbc
to
b0ecfc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an option for a different SNTP resync interval used when SNTP requests fail, along with a build assert to ensure the SNTP server is properly configured and compile‐time optimizations.
- Adds a BUILD_ASSERT statement to validate SNTP server configuration.
- Introduces a conditional check to return an error if the SNTP server address is empty.
- Updates the reschedule work logic to use a failure-specific resync interval when needed.
Files not reviewed (1)
- subsys/net/lib/config/Kconfig: Language not supported
Comments suppressed due to low confidence (2)
subsys/net/lib/config/init_clock_sntp.c:21
- [nitpick] The use of 'sizeof(CONFIG_NET_CONFIG_SNTP_INIT_SERVER) != 1' to detect an empty address may be non-intuitive; consider adding an inline comment or refactoring the logic to improve clarity.
BUILD_ASSERT( IS_ENABLED(CONFIG_NET_CONFIG_SNTP_INIT_SERVER_USE_DHCPV4_OPTION) ||
subsys/net/lib/config/init_clock_sntp.c:24
- [nitpick] Consider enhancing the error message to specify that a valid SNTP server must be configured unless the DHCPv4 option is enabled.
"SNTP server not configured");
when the sntp address is not set and geting it via dhcp is not activated do a build assert. Signed-off-by: Fin Maaß <[email protected]>
don't use fallback address, when Kconfig server address is not set. Signed-off-by: Fin Maaß <[email protected]>
b0ecfc6
to
6f6745b
Compare
add option for a different resync interval, that is
applied when the sntp request fails.
also adds a build assert and optimisation at build time