Bug 12001

Summary: [ntpd] - not able to query
Product: Busybox Reporter: lkjdf <vtolkm>
Component: OtherAssignee: unassigned
Status: RESOLVED INVALID    
Severity: major CC: busybox-cvs
Priority: P2    
Version: 1.30.x   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Host: Target:
Build:

Description lkjdf 2019-07-01 21:52:59 UTC
* OpenWRT 19.07 with kernel 4.14.131 armv7l
* busybox 1.30.1
-----

# /sbin/ntpd -nNlSddddp 1.openwrt.pool.ntp.org

# ss -tulpn | grep 123
udp   UNCONN 0  0  *:123 *:*  users:(("ntpd",pid=15989,fd=3))

-----

# ntpq -p
localhost: timed out, nothing received
***Request timed out

ntpd: malformed packet received from ::1: size 12
ntpd: malformed packet received from ::1: size 12

-----

# ntpdate localhost
no server suitable for synchronization found

no output from ntpd

-----

# ntpdc -lnps
localhost: timed out, nothing received
***Request timed out
localhost: timed out, nothing received
***Request timed out
localhost: timed out, nothing received
***Request timed out

no output from ntpd

-----

# ntptime -r
ntp_gettime() returns code 5 (ERROR)
ntp_adjtime() returns code 5 (ERROR)


no output from ntpd
Comment 1 lkjdf 2019-07-03 09:49:30 UTC
http://lists.busybox.net/pipermail/busybox/2019-July/087369.html

ntpq sends a packet with m_status of 0x16,
which is NTPv2, "reserved1" mode (6).

Probably described here:
https://docs.ntpsec.org/latest/mode6.html

and in this case, it is probably used to get peer list.

busybox does not understand these extensions.
-----

whilst his explains the failing queries with ntpq -p it does not however for:

# ntpdate localhost
no server suitable for synchronization found

# ntpdc -lnps
localhost: timed out, nothing received
***Request timed out
localhost: timed out, nothing received
***Request timed out
localhost: timed out, nothing received
***Request timed out

# ntptime -r
ntp_gettime() returns code 5 (ERROR)
ntp_adjtime() returns code 5 (ERROR)
Comment 2 lkjdf 2019-07-03 10:29:21 UTC
ntpq | ntpdc queries relying on NTPv2 mode (6) which is not supported by busybox.

ntptime is not a tool for querying ntpd, instead it reads and sets kernel time variables

whilst ntpdate localhost strangely fails it works with ntpdate -d localhost