Bug 13056 - ntpd: client msg refid incorrect
Summary: ntpd: client msg refid incorrect
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.30.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-02 16:40 UTC by rfrankla
Modified: 2020-07-19 22:06 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rfrankla 2020-07-02 16:40:02 UTC
Currently the busybox ntpd, in server mode, returns the refid of the currently selected upstream host in reply messages.

This is incorrect. It should return the currently selected reference server's own id as a reference.
i.e. the reference servers own IP address converted into a 32bit unsigned int 
(or for IPv6; first four bytes of the (binary) md5 digest of the IPv6 address)

Example:

my home router 192.168.1.254
ntp peer -> 212.159.13.49 (cdns01.plus.net) refid: C342F10A (-> 195.66.241.10 -> ntp2.linx.net)

my home laptop
ntp peer -> 192.168.1.254 SHOULD BE refid: D49F0D31 ( -> 212.159.13.49 -> cdns01.plus.net )

The busybox ntpd is sending a refid C342F10A to my laptop, this is incorrect.
Other ntp server software (chrony.tuxfamily.org and ntp.org) do send the correct D49F0D31.

-------------------------------------------------
The purpose of refid is to prevent timing loops:

https://tools.ietf.org/rfc/rfc5905.txt
Above stratum 1 (secondary servers and clients): this is the
reference identifier of the server and can be used to detect timing
loops.
https://tools.ietf.org/id/draft-stenn-ntp-not-you-refid-00.html 
The purpose of the REFID is to prevent a one-degree "timing loop": where if A has several timing sources that include B, if B decides to get its time from A, then A should not then decide to get its time from B. The REFID is therefore a vital core-component of the base NTP packet.

(This is a better, complete, explanation of how the refid is used).

I discovered this in Openwrt 19.07.3 
on... mvebu cortexa9 linksys_wrt1200ac
Comment 1 Denys Vlasenko 2020-07-19 22:06:02 UTC
Fixed in git, please test.