Bug 5738

Summary: ntpd incorrectly responds as "NTP version 7"
Product: Busybox Reporter: Paul Marks <paul>
Component: NetworkingAssignee: unassigned
Status: RESOLVED DUPLICATE    
Severity: major CC: busybox-cvs, paul
Priority: P5    
Version: 1.19.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

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 ***