]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1608] Parse Refclock driver should honor trusttime
authorHarlan Stenn <stenn@ntp.org>
Mon, 25 Jul 2011 04:09:06 +0000 (00:09 -0400)
committerHarlan Stenn <stenn@ntp.org>
Mon, 25 Jul 2011 04:09:06 +0000 (00:09 -0400)
bk: 4e2cec62uguFDfAUzxwV5bsBOsVpDQ

ChangeLog
html/drivers/driver8.html
ntpd/refclock_parse.c

index 360a5e809afa841a9eb39f9ee67ea88fed8831f8..1d115950b50350b0b305ce98d3322362bc8a06c1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 ---
 
-* [Bug 1970] UNLINK_EXPR_SLIST() causes crash if list is empty.
+* [Bug 1608] Parse Refclock driver should honor trusttime.
 * [Bug 1961] html2man update: distribute ntp-wait.html.
+* [Bug 1970] UNLINK_EXPR_SLIST() causes crash if list is empty.
 
 ---
 (4.2.6p4-RC1) 2011/07/10 Released by Harlan Stenn <stenn@ntp.org>
index b4c34f3756eed6b0f1ce3768dd89dd761d1a6cb3..8e81e5f57f163e24eae2412641ebe6ccb2ed078d 100644 (file)
                                <p>See comment from mode 20 clock.
                                <br></p>
 
+                       <li><b><tt>server 127.127.8.0-3 mode 22</tt></b>
+                               <p><b><tt>MEINBERG, mode 2 but with POWERUP trust </tt></b><br>
+                               </p>
+
+                       <li><b><tt>server 127.127.8.0-3 mode 23</tt></b>
+                               <p><b><tt>MEINBERG, mode 7 but with POWERUP trust </tt></b><br>
+                               </p>
+
                </ul>
+
                <p>Actual data formats and setup requirements of the various clocks can be found in <a href="../parsedata.html">NTP PARSE clock data formats</a>.</p>
                <h4>Operation</h4>
                <p>The reference clock support software carefully monitors the state transitions of the receiver. All state changes and exceptional events (such as loss of time code transmission) are logged via the syslog facility. Every hour a summary of the accumulated times for the clock states is listed via syslog.</p>
index 52e4f73092e28b169243c72a8dabd7bfdeaf0caf..75d5fe2a8a3cbc6e65ab0dc7f723715252065aa4 100644 (file)
 #include "ieee754io.h"
 #include "recvbuff.h"
 
-static char rcsid[] = "refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A";
+static char rcsid[] = "refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A+POWERUPTRUST";
 
 /**===========================================================================
  ** external interface to ntp mechanism
@@ -253,12 +253,11 @@ typedef struct bind
 #define PARSE_GETTIMECODE(_X_, _DCT_)  (*(_X_)->binding->bd_timecode)(_X_, _DCT_)
 
 /*
- * io modes
+ * special handling flags
  */
-#define PARSE_F_PPSPPS         0x0001 /* use loopfilter PPS code (CIOGETEV) */
-#define PARSE_F_PPSONSECOND    0x0002 /* PPS pulses are on second */
-
-
+#define PARSE_F_PPSONSECOND    0x00000001 /* PPS pulses are on second */
+#define PARSE_F_POWERUPTRUST   0x00000100 /* POWERUP state ist trusted for */
+                                           /* trusttime after SYNC was seen */
 /**===========================================================================
  ** error message regression handling
  **
@@ -859,7 +858,7 @@ static poll_info_t rcc8000_pollinfo = { RCC_POLLRATE, RCC_POLLCMD, RCC_CMDSIZE }
 
 static struct parse_clockinfo
 {
-       u_long  cl_flags;               /* operation flags (io modes) */
+       u_long  cl_flags;               /* operation flags (PPS interpretation, trust handling) */
   void  (*cl_poll)    (struct parseunit *);                    /* active poll routine */
   int   (*cl_init)    (struct parseunit *);                    /* active poll init routine */
   void  (*cl_event)   (struct parseunit *, int);               /* special event handling (e.g. reset clock) */
@@ -1400,6 +1399,52 @@ static struct parse_clockinfo
                RAWDCF_SAMPLES,
                RAWDCF_KEEP
        },
+       {                               /* mode 22 - like 2 with POWERUP trust */
+               MBG_FLAGS | PARSE_F_POWERUPTRUST,
+               NO_POLL,
+               NO_INIT,
+               NO_EVENT,
+               NO_END,
+               NO_MESSAGE,
+               NO_LCLDATA,
+               DCFUA31_ROOTDELAY,
+               DCFUA31_BASEDELAY,
+               DCF_A_ID,
+               DCFUA31_DESCRIPTION,
+               DCFUA31_FORMAT,
+               DCF_TYPE,
+               DCFUA31_MAXUNSYNC,
+               DCFUA31_SPEED,
+               DCFUA31_CFLAG,
+               DCFUA31_IFLAG,
+               DCFUA31_OFLAG,
+               DCFUA31_LFLAG,
+               DCFUA31_SAMPLES,
+               DCFUA31_KEEP
+       },
+       {                               /* mode 23 - like 7 with POWERUP trust */
+               MBG_FLAGS | PARSE_F_POWERUPTRUST,
+               GPS16X_POLL,
+               GPS16X_INIT,
+               NO_EVENT,
+               GPS16X_END,
+               GPS16X_MESSAGE,
+               GPS16X_DATA,
+               GPS16X_ROOTDELAY,
+               GPS16X_BASEDELAY,
+               GPS16X_ID,
+               GPS16X_DESCRIPTION,
+               GPS16X_FORMAT,
+               GPS_TYPE,
+               GPS16X_MAXUNSYNC,
+               GPS16X_SPEED,
+               GPS16X_CFLAG,
+               GPS16X_IFLAG,
+               GPS16X_OFLAG,
+               GPS16X_LFLAG,
+               GPS16X_SAMPLES,
+               GPS16X_KEEP
+       },
 };
 
 static int ncltypes = sizeof(parse_clockinfo) / sizeof(struct parse_clockinfo);
@@ -3761,7 +3806,7 @@ parse_process(
                 * for PARSE Meinberg DCF77 receivers the lost synchronisation
                 * is true as it is the powerup state and the time is taken
                 * from a crude real time clock chip
-                * for the PZF series this is only partly true, as
+                * for the PZF/GPS series this is only partly true, as
                 * PARSE_POWERUP only means that the pseudo random
                 * phase shift sequence cannot be found. this is only
                 * bad, if we have never seen the clock in the SYNC
@@ -3779,11 +3824,14 @@ parse_process(
                 * interval. fortunately powerdowns last usually longer than 64
                 * seconds and the receiver is at least 2 minutes in the
                 * POWERUP or NOSYNC state before switching to SYNC
+                * for GPS receivers this can mean antenna problems and other causes.
+                * the additional grace period can be enables by a clock
+                * mode having the PARSE_F_POWERUPTRUST flag in cl_flag set.
                 */
                parse_event(parse, CEVNT_FAULT);
                NLOG(NLOG_CLOCKSTATUS)
                        ERR(ERR_BADSTATUS)
-                       msyslog(LOG_ERR,"PARSE receiver #%d: NOT SYNCHRONIZED",
+                       msyslog(LOG_ERR,"PARSE receiver #%d: NOT SYNCHRONIZED/RECEIVER PROBLEMS",
                                CLK_UNIT(parse->peer));
        }
        else
@@ -3989,13 +4037,14 @@ parse_process(
         * we have seen the clock in sync at least once
         * after the last time we didn't see an expected data telegram
         * at startup being not in sync is also bad just like
-        * POWERUP state
+        * POWERUP state unless PARSE_F_POWERUPTRUST is set 
         * see the clock states section above for more reasoning
         */
-       if (((current_time - parse->lastsync) > parse->maxunsync) ||
-           (parse->lastsync < parse->lastmissed) ||
+       if (((current_time - parse->lastsync) > parse->maxunsync)           ||
+           (parse->lastsync < parse->lastmissed)                           ||
            ((parse->lastsync == 0) && !PARSE_SYNC(parsetime->parse_state)) ||
-           PARSE_POWERUP(parsetime->parse_state))
+           (((parse->parse_type->cl_flags & PARSE_F_POWERUPTRUST) == 0) &&
+            PARSE_POWERUP(parsetime->parse_state)))
        {
                parse->generic->leap = LEAP_NOTINSYNC;
                parse->lastsync = 0;    /* wait for full sync again */