Skip to content

Conversation

@zs39
Copy link
Contributor

@zs39 zs39 commented Jan 7, 2026

Summary

Before attempting to sample via NTP, network connectivity should be checked to avoid frequent sampling that could cause network error logs to overflow.

Impact

It will affect NTP functionality.

Testing

With both CONFIG_DEBUG_NET_ERROR and CONFIG_NETUTILS_NTPCLIENT configuration options enabled and the network disconnected, error logs will flood the screen.

nsh> arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
psock_udp_sendto: ERROR: Not reachable
dns_send_query: ERROR: sendto failed: -101
dns_query_error: ERROR: IPv6 dns_send_query failed: -101, server address: [119.29.29.29](http://119.29.29.29/)
psock_udp_sendto: ERROR: Not reachable
dns_send_query: ERROR: sendto failed: -101
dns_query_error: ERROR: IPv4 dns_send_query failed: -101, server address: [119.29.29.29](http://119.29.29.29/)
ntp_gethostip_multi: ERROR: getaddrinfo([0.pool.ntp.org](http://0.pool.ntp.org/)): 1: EAI_AGAIN
ntpc_get_ntp_sample: ERROR: ntp_get_next_hostip() failed: 101
psock_udp_sendto: ERROR: Not reachable
dns_send_query: ERROR: sendto failed: -101
dns_query_error: ERROR: IPv6 dns_send_query failed: -101, server address: [119.29.29.29](http://119.29.29.29/)
psock_udp_sendto: ERROR: Not reachable
dns_send_query: ERROR: sendto failed: -101
dns_query_error: ERROR: IPv4 dns_send_query failed: -101, server address: [119.29.29.29](http://119.29.29.29/)
ntp_gethostip_multi: ERROR: getaddrinfo([1.pool.ntp.org](http://1.pool.ntp.org/)): 1: EAI_AGAIN
ntpc_get_ntp_sample: ERROR: ntp_get_next_hostip() failed: 101
psock_udp_sendto: ERROR: Not reachable
dns_send_query: ERROR: sendto failed: -101
dns_query_error: ERROR: IPv6 dns_send_query failed: -101, server address: [119.29.29.29](http://119.29.29.29/)
psock_udp_sendto: ERROR: Not reachable
dns_send_query: ERROR: sendto failed: -101
dns_query_error: ERROR: IPv4 dns_send_query failed: -101, server address: [119.29.29.29](http://119.29.29.29/)
ntp_gethostip_multi: ERROR: getaddrinfo([2.pool.ntp.org](http://2.pool.ntp.org/)): 1: EAI_AGAIN
ntpc_get_ntp_sample: ERROR: ntp_get_next_hostip() failed: 101

Only a small amount of error log is printed after adding the patch.

nsh> arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
arp_send: ERROR: arp_wait failed: -110, ipaddr: [10.0.1.1](http://10.0.1.1/)
icmp_sendmsg: ERROR: Not reachable
icmp_sendmsg: ERROR: Not reachable
icmp_sendmsg: ERROR: Not reachable
icmp_sendmsg: ERROR: Not reachable

Before attempting to sample via NTP, network connectivity should be checked to avoid frequent sampling that could cause network error logs to overflow.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
@cederom
Copy link
Contributor

cederom commented Jan 7, 2026

Thank you @zs39, there are build errors :-(

Strange, the header is included, maybe a rebase is needed or some configs disable required functions? I saw that @xiaoxiang781216 already restarted CI so this needs some investigation..

====================================================================================
Configuration/Tool: spresense/wifi,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-01-07 15:31:17
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
ntpclient.c: In function 'ntpc_daemon':
Error: ntpclient.c:1310:11: error: implicit declaration of function 'netlib_check_ipconnectivity' [-Werror=implicit-function-declaration]
 1310 |       if (netlib_check_ipconnectivity(NULL, 1, 1) > 0)
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [/github/workspace/sources/apps/Application.mk:239: ntpclient.c.github.workspace.sources.apps.netutils.ntpclient.o] Error 1
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:54: /github/workspace/sources/apps/netutils/ntpclient_all] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [tools/LibTargets.mk:248: /github/workspace/sources/apps/libapps.a] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize spresense/wifi
====================================================================================

@zs39
Copy link
Contributor Author

zs39 commented Jan 8, 2026

netlib_check_ipconnectivity

The problem likely stems from the CONFIG_NETUTILS_PING configuration option not being enabled, indicating that this API has not been compiled. Let me fix this problem first.@cederom

@zs39
Copy link
Contributor Author

zs39 commented Jan 9, 2026

The fix patch is here.
#3303

@xiaoxiang781216
Copy link
Contributor

The fix patch is here. #3303

let's merge this pr to avoid wasting ci resource.

@xiaoxiang781216 xiaoxiang781216 merged commit 63f61d0 into apache:master Jan 11, 2026
29 of 77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants