[ntp:hackers] [patch] local clock synchronization

free man free.man.uu at gmail.com
Thu Apr 21 16:26:03 UTC 2011


Hello,

I think local clock synchronization doesn't work as it should.
 What is the expected behavior for local clock synchronisation ?

freeman# cat /etc/ntp.conf
server 127.127.1.0 prefer

We want to use the local clock to synchronise, but it won't with ntp
4.2.6 or current version
while it does with ntp 4.2.4.
The code in ntp_proto.c has changed and now clock_select function doesn't
accept anymore local clock even if it's the preferred one.
Here is the patch which seems to fix this issue (works as older version of =
ntp.)

--- ../../ntp/ntp-4.2.6p2+dfsg/ntpd/ntp_proto.c	2010-03-31
10:34:38.000000000 +0200
+++ ntp_proto.c	2011-04-21 11:34:20.186188657 +0200
@@ -2300,10 +2300,11 @@
 			 */
 			switch (peer->refclktype) {
 			case REFCLK_LOCALCLOCK:
-				if (typelocal =3D=3D NULL &&
-				    !(peer->flags & FLAG_PREFER))
-					typelocal =3D peer;
-				continue;
+				typelocal =3D peer;
+				if (!(peer->flags & FLAG_PREFER)) {
+					continue; /* no local clock */
+				}
+				break;

 			case REFCLK_ACTS:
 				if (typeacts =3D=3D NULL &&

Note 1:
I have posted a bug-fix on bugzilla (http://bugs.ntp.org/show_bug.cgi?id=3D=
1893)
I was suggested to use orphan mode, but does it mean the undisciplined
mode is not worth to be fixed ? The local clock selection was probably
removed on purpose but I don=92t understand why since the =AB
undisicplined mode =BB is still supported (even if depreciated).

Note 2 :
I prefer to use the =AB undisciplined mode =BB because I only have 1 ntp
server without GPS and which is not connected to internet, and I
couldn=92t get it working with =AB orphan mode =BB even after reading the
ntp html documentation. (I won=92t talk about that since this hacker
mailing list is not about usage help)

Note3 :
Sorry for my bad english :-)

Thanks in advance


More information about the hackers mailing list