[Nagiosplug-devel] Multiple fixes to check_ntp_time (and check_ntp) best offset server selection
Thomas Guyot-Sionnest
dermoth at aei.ca
Tue Jan 29 10:49:46 CET 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Just a note about the fixes for check_ntp_time (and check_ntp) I just
committed. While trying to check something about the alarm flag in
check_ntp_time I accidentally came across a bug: any server that didn't
respond was taken as the best offset server. After adding a bunch of
debugging to that function (and also reading some NTP documentation) a
few other bugs became evident:
1. As stated above, non-responding peers were always selected (making
the final offset unknown).
2. The break statement in the LI_NOWARNING check was breaking the main
for loop, preventing all remaining peers to be checked.
3. As soon as the first loop started discarding peers the 2md level loop
wasn't functioning properly and was ignoring the last peers of the array.
4. The candidate array was shifting the wrong way, overwriting all
elements with the last one before setting the first element with the
current best offset server!
5. Only the first element of the candidate array was used anyways so all
this was useless.
6. Discarding peers with LI_NOWARNING would also discard peers that have
the leap indicator set. NTP servers start advertising leap bits one
month before leap seconds needs to be inserted, so this means on those
months any good NTP server would fail!
With the exception of #6, all these bugs were only an issue if you
checked a pool of servers (multiple A returned for a single hostname)
and one of them was not responding or had the LI_ALARM flag set, or if
there was more than 6 server to be checked.
I rewritten parts of the best_offset_server function to address these
issues. All this is old stuff (always worked this way) except for the
LI_NOWARNING break statement bug which appeared in 1.4.10. A possible
segfault in 1.4.11 and earlier releases was also fixed a few seeks ago.
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHnva56dZ+Kt5BchYRAloxAJ9KKdtS7Uqy0wJSMuXD4g0AHn69xACgqqcM
TWgVtvttG4vh9XW/PqJldXQ=
=zPWt
-----END PGP SIGNATURE-----
More information about the Devel
mailing list