Bug 5738 - ntpd incorrectly responds as "NTP version 7"
Summary: ntpd incorrectly responds as "NTP version 7"
Status: RESOLVED DUPLICATE of bug 5120
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.19.x
Hardware: PC Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-23 03:46 UTC by Paul Marks
Modified: 2012-11-23 23:24 UTC (History)
2 users (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 Paul Marks 2012-11-23 03:46:35 UTC
When I run the busybox ntpd server, it fails to work with chrony as a client.  Chrony uses NTPv3, and it's failing because ntpd's response packets have the following status byte:

00,111,100

Notice that the second part (the NTP version) is set to 7 instead of 3.  This is actually the bitwise-OR of versions 4 and 3.

The following 1-line patch to ntpd.c fixes the problem for me:

- msg.m_status = G.stratum < MAXSTRAT ? G.ntp_status : LI_ALARM;
+ msg.m_status = G.stratum < MAXSTRAT ? (G.ntp_status & LI_MASK) : LI_ALARM;

This ensures that *only* the Leap Indicator bits are copied from G.ntp_status.
Comment 1 Paul Marks 2012-11-23 23:24:04 UTC

*** This bug has been marked as a duplicate of bug 5120 ***