]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Dave Mills shifted some orphan processing
authorHarlan Stenn <stenn@ntp.org>
Fri, 23 Nov 2007 09:34:06 +0000 (04:34 -0500)
committerHarlan Stenn <stenn@ntp.org>
Fri, 23 Nov 2007 09:34:06 +0000 (04:34 -0500)
bk: 47469e8eTpx95_giTEsBZH75Ap6osQ

ChangeLog
include/ntpd.h
ntpd/ntp_proto.c
ntpd/ntp_timer.c

index 251101d8f62e64f7a246b4ccbc75f343c2ff9cb6..7b1dd04a71a2eba76ab2fd786a8c39ba61420d73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* Dave Mills shifted some orphan processing.
 * Fix typos in the [Bug 963] patch.
 * bootstrap: squawk if genver fails.  Use -f with cp in case Dave does a chown.
 * Remove obsolete simulator command-line options.
index bf63cb93ac867b10efb20949d1e38bfcbcc092ee..c082d05ee7eca3353286bf5862d76a37f0524608 100644 (file)
@@ -188,6 +188,9 @@ extern      void    kod_proto       (void);
 extern int     leap_tai;
 extern u_long  leap_expire;
 extern u_long  leap_sec;
+extern int     sys_orphan;
+extern double  sys_mindisp;
+extern double  sys_maxdist;
 
 /*
  * there seems to be a bug in the IRIX 4 compiler which prevents
index 6b58804833ea950feeaf09712d303e10cd7204de..d88c2931baddaaca85b76f0690220594235d3362 100644 (file)
@@ -85,8 +85,8 @@ int   sys_authenticate;       /* requre authentication for config */
 l_fp   sys_authdelay;          /* authentication delay */
 static double sys_offset;      /* current local clock offset */
 static u_long sys_authdly[2];  /* authentication delay shift reg */
-static double sys_mindisp = MINDISPERSE; /* min disp increment (s) */
-static double sys_maxdist = MAXDISTANCE; /* selection threshold */
+double sys_mindisp = MINDISPERSE; /* min disp increment (s) */
+double sys_maxdist = MAXDISTANCE; /* selection threshold */
 double sys_jitter;             /* system jitter */
 u_long         sys_epoch;              /* last clock update time */
 static int sys_hopper;         /* anticlockhop counter */
@@ -155,22 +155,7 @@ transmit(
         * server modes) and those that do (all other modes). The dance
         * is intricate...
         */
-       /*
-        * Orphan mode is active when enabled and when no servers less
-        * than the orphan statum are available. A server with no other
-        * synchronization source is an orphan It shows offset zero and
-        * reference ID the loopback address.
-        */
        hpoll = peer->hpoll;
-       if (sys_orphan < STRATUM_UNSPEC && sys_peer == NULL) {
-               sys_leap = LEAP_NOWARNING;
-               sys_stratum = sys_orphan;
-               sys_refid = htonl(LOOPBACKADR);
-               sys_rootdelay = 0;
-               sys_rootdisp = sys_mindisp;
-               sys_offset = 0;
-       }
-
        /*
         * In broadcast mode the poll interval is never changed from
         * minpoll.
index 63b63e1daf5b575f42ece14091403ecebc95c80e..5cbeb3c945b3ac542e3daf11c6d3d2bdfeafff11 100644 (file)
@@ -323,6 +323,24 @@ timer(void)
                }
        }
 
+       /*
+        * Orphan mode is active when enabled and when no servers less
+        * than the orphan statum are available. A server with no other
+        * synchronization source is an orphan It shows offset zero and
+        * reference ID the loopback address.
+        */
+       if (sys_orphan < STRATUM_UNSPEC && sys_peer == NULL) {
+               if (sys_leap == LEAP_NOTINSYNC)
+                       sys_leap = LEAP_NOWARNING;
+               sys_stratum = sys_orphan;
+               if (sys_stratum > 1)
+                       sys_refid = htonl(LOOPBACKADR);
+               else
+                       memcpy(&sys_refid, "LOOP", 4);
+               sys_rootdelay = 0;
+               sys_rootdisp = sys_mindisp;
+       }
+
        /*
         * Leapseconds. When the time remaining decrements to zero,
         * increment the TAI offset. If the kernel code is not available