Bug 5120 - The ntpd server not work with windows.
Summary: The ntpd server not work with windows.
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.19.x
Hardware: Other Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
: 5738 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-19 07:18 UTC by alex
Modified: 2013-01-14 02:31 UTC (History)
3 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 alex 2012-04-19 07:18:09 UTC
https://dev.openwrt.org/ticket/10448

> I mean that if I start ntpd with -n -l -p "server", it syncs time with "server",
> but if from a windows I try to set time from router ip using standard "internet time",
> I gett errors. Timeout or something else. If I start another instance of ntpd with just -l, everything works OK.
> Linux comps can use same instance of ntpd with no problems.
Comment 1 Paul Marks 2012-11-23 23:24:04 UTC
*** Bug 5738 has been marked as a duplicate of this bug. ***
Comment 2 Paul Marks 2012-11-23 23:29:20 UTC
I just tested the "Internet Time" feature in Windows 7, and determined:
1) It uses NTPv3
2) The busybox ntpd is responding as NTPv7
3) Modifying this line in ntpd.c fixes the problem:

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

Could someone apply this fix, please?
Comment 3 Denys Vlasenko 2013-01-14 02:31:48 UTC
Fixed in git:

commit b7841cf7b919b16d1bd4619154bf7cb4c22b4ccd
Author: Paul Marks <paul@pmarks.net>
Date:   Mon Jan 14 02:39:10 2013 +0100

    ntpd: fix incorrect m_status field in outgoing packets. Closes 5120

    When using busybox ntpd with an NTPv3 client and NTPv4 server (or vice
    versa), the version numbers can be incorrectly ORed together, yielding
    the bogus value of "NTPv7".  This makes ntpd unusable with clients
    such as Chrony and Windows "Internet Time".

    This patch avoids the version mangling, by copying only the Leap
    Indicator bits from the server's status field.

    Signed-off-by: Paul Marks <paul@pmarks.net>