[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] Fix the "NTPv7" bug
From:       Paul Marks <paul () pmarks ! net>
Date:       2012-11-26 3:22:35
Message-ID: CAHq9+SiY1t7Ka7dFO8F6KWLV0Nu==tKg1WonLyW=aJy9mBgk8g () mail ! gmail ! com
[Download RAW message or body]

When using busybox ntpd with an NTPv3 client and NTPv4 server (or vice
versa), the version numbers can be ORed together, yielding the bogus
value 7.

This 1-line patch ensures that only the Leap Indicator bits are copied
from the server status.

I've done before/after tests with Chrony and Windows 7's "Internet
Time" feature, and this patch fixed both cases.

Related bug:
https://bugs.busybox.net/show_bug.cgi?id=5120

["busybox_ntpv7_bug.patch" (application/octet-stream)]

diff --git a/networking/ntpd.c b/networking/ntpd.c
index 5b92db6..3d6caad 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -1851,7 +1851,7 @@ recv_and_process_client_pkt(void /*int fd*/)
 
 	/* Build a reply packet */
 	memset(&msg, 0, sizeof(msg));
-	msg.m_status = G.stratum < MAXSTRAT ? G.ntp_status : LI_ALARM;
+	msg.m_status = G.stratum < MAXSTRAT ? (G.ntp_status & LI_MASK) : LI_ALARM;
 	msg.m_status |= (query_status & VERSION_MASK);
 	msg.m_status |= ((query_status & MODE_MASK) == MODE_CLIENT) ?
 			 MODE_SERVER : MODE_SYM_PAS;


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic