From: Harlan Stenn Date: Mon, 25 Jul 2011 04:09:06 +0000 (-0400) Subject: [Bug 1608] Parse Refclock driver should honor trusttime X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c824ad969343e2d709bb5c87abe29dc2a8c1d8ad;p=thirdparty%2Fntp.git [Bug 1608] Parse Refclock driver should honor trusttime bk: 4e2cec62uguFDfAUzxwV5bsBOsVpDQ --- diff --git a/ChangeLog b/ChangeLog index 360a5e809a..1d115950b5 100644 --- 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 diff --git a/html/drivers/driver8.html b/html/drivers/driver8.html index b4c34f3756..8e81e5f57f 100644 --- a/html/drivers/driver8.html +++ b/html/drivers/driver8.html @@ -170,7 +170,16 @@

See comment from mode 20 clock.

+
  • server 127.127.8.0-3 mode 22 +

    MEINBERG, mode 2 but with POWERUP trust
    +

    + +
  • server 127.127.8.0-3 mode 23 +

    MEINBERG, mode 7 but with POWERUP trust
    +

    + +

    Actual data formats and setup requirements of the various clocks can be found in NTP PARSE clock data formats.

    Operation

    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.

    diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c index 52e4f73092..75d5fe2a8a 100644 --- a/ntpd/refclock_parse.c +++ b/ntpd/refclock_parse.c @@ -189,7 +189,7 @@ #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 */