Bug 1286969 - ntpstat reports synchronized even when the local ntpd doesn't synchronize with any time server.
Summary: ntpstat reports synchronized even when the local ntpd doesn't synchronize wit...
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ntp
Version: 6.6
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Miroslav Lichvar
QA Contact: Jakub Prokes
Depends On:
Blocks: 1309594
TreeView+ depends on / blocked
Reported: 2015-12-01 09:14 UTC by Masahiro Matsuya
Modified: 2019-09-12 09:26 UTC (History)
3 users (show)

Fixed In Version: ntp-4.2.6p5-9.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1309594 (view as bug list)
Last Closed: 2016-05-10 20:17:47 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:0780 normal SHIPPED_LIVE Moderate: ntp security and bug fix update 2016-05-10 22:35:43 UTC

Description Masahiro Matsuya 2015-12-01 09:14:38 UTC
Description of problem:

When ntpd starts, ntpstat reports 'unsynchronized' for a while. That's ok.
After a while, ntpd starts to sync with a time server, and ntpstat report 'synchronized'. That's ok as well.
A customer stopped the upper time servers, and ntpd lost all time servers to be synchronized. But, ntpstat keeps to report 'synchronized'.

They are going to check the status of ntpd with ntpstat command. So, their expectation is that ntpstat returns 1 (unsyncronized) when it lose all ones to be synchronized.

ntpstat checks the value of sys_leap in the local ntpd. If it's 0x11 (LEAP_NOTINSYNC), it reports unsynchronized. As far as I checked the ntp's souce code, the code to set LEAP_NOTINSYNC into sys_leap is the following only.

0 ntpd/ntp_proto.c 1717 sys_leap = LEAP_NOTINSYNC;  ## when step adjustment happen
2 ntpd/ntp_proto.c 2251 sys_leap = LEAP_NOTINSYNC;  ## N/A because LOCKCLOCK macro is not defined.
3 ntpd/ntp_proto.c 3586 sys_leap = LEAP_NOTINSYNC;  ## when ntpd starts.

So, it can be changed into LEAP_NOTINSYNC, only when a step adjustment happens.

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux 7

How reproducible:

Steps to Reproduce:
1. configure two ntp hosts (server and client) with RHEL6
2. configure the ntp client to refer to the ntp server
3. start ntpd on both and wait the sync status.
4. stop ntpd on the ntp server, and wait until the ntp client got the status of unsynchronized.
5. run ntpstat and check that it still reports synchronized.

Actual results:
ntpstat reports synchronized, after it loses all time server to be synchronized.

Expected results:
ntpstat can report unsynchronized, when it loses all time server to be synchronized.

Comment 9 Miroslav Lichvar 2015-12-07 15:48:05 UTC
The ntpstat man page has been modified to include:

When the synchronised state is reported, it means the system clock was updated at some point.  There is no timeout for this state.  It will stay there even when the source becomes unreachable and there are no other sources available. However, the reported accuracy will be slowly increasing, in the default ntpd configuration by 15 microseconds per second.

Comment 16 errata-xmlrpc 2016-05-10 20:17:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.