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
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.
ntpstat reports synchronized, after it loses all time server to be synchronized.
ntpstat can report unsynchronized, when it loses all time server to be synchronized.
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.
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.