[ntp:questions] Unreachable Clock Source kept on as sys.peer

joerg.neulist at gmail.com joerg.neulist at gmail.com
Wed May 2 11:28:10 UTC 2012

Hello everyone,

during my experimentations I have stumbled upon an unexpected behaviour of ntpd (4.2.6p3):

If ntpd has two sources, one of which is unreachable, while the other BECOMES unreachable after being selected as peer, it sometimes keeps the second source on as sys.peer (apparently forever, have observed it for around twelve hours).

The reason, this is a problem:
I am on an embedded device with a disastrous system clock accuracy; the RTC is much more stable. Therefore I have written a clock driver for it and lifted a line from the local clock driver code:

if (!(sys_peer == NULL || sys_peer == peer))

This means that the source is only reachable if ntpd does not currently have a peer, OR this source is already the peer. This line makes the local clock and my RTC driver perfect fallback sources, chipping in when everything else is gone, but not confusing actually working sources.

Of course, with the aforementioned behaviour of "peer for lifetime", this can not work. I have verified this with the local clock driver as well.

Is there any way to rectify this behaviour? Or another way to achieve my desired setup of a fallback source?

Thank you very much in advance,
Jörg Neulist

More information about the questions mailing list