From: Harlan Stenn Date: Sun, 7 Jun 2015 03:16:04 +0000 (+0000) Subject: [Bug 2836] DFC77 patches from Frank Kardel to make decoding more robust, and require... X-Git-Tag: NTP_4_3_36~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71da0a9d3537b2aa11aa196480bd6868658785f4;p=thirdparty%2Fntp.git [Bug 2836] DFC77 patches from Frank Kardel to make decoding more robust, and require 2 consecutive timestamps to be consistent bk: 5573b774ggbLbu4ogRzKwzWcdirYdQ --- diff --git a/ChangeLog b/ChangeLog index c4689a73f..032fb2da6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ This might still needed improvement. * [Bug 2832] refclock_jjy.c supports the TDC-300. * [Bug 2834] Correct a broken html tag in html/refclock.html +* [Bug 2836] DFC77 patches from Frank Kardel to make decoding more + robust, and require 2 consecutive timestamps to be consistent. * [Bug 2837] Allow a configurable DSCP value. * [Bug 2837] add test for DSCP to ntpd/complete.conf.in * [Bug 2842] Glitch in ntp.conf.def documentation stanza. diff --git a/libparse/clk_rawdcf.c b/libparse/clk_rawdcf.c index 132fbc331..2f2afdf94 100644 --- a/libparse/clk_rawdcf.c +++ b/libparse/clk_rawdcf.c @@ -237,7 +237,7 @@ convert_rawdcf( #ifndef PARSEKERNEL msyslog(LOG_ERR, "parse: convert_rawdcf: INCOMPLETE DATA - time code only has %d bits", size); #endif - return CVT_NONE; + return CVT_FAIL|CVT_BADFMT; } for (i = 0; i < size; i++) @@ -250,7 +250,7 @@ convert_rawdcf( #ifndef PARSEKERNEL msyslog(LOG_ERR, "parse: convert_rawdcf: BAD DATA - no conversion"); #endif - return CVT_NONE; + return CVT_FAIL|CVT_BADFMT; } if (*b) b++; if (*c) c++; @@ -321,7 +321,7 @@ convert_rawdcf( * bad format - not for us */ #ifndef PARSEKERNEL - msyslog(LOG_ERR, "parse: convert_rawdcf: parity check FAILED for \"%s\"", buffer); + msyslog(LOG_ERR, "parse: convert_rawdcf: start bit / parity check FAILED for \"%s\"", buffer); #endif return CVT_FAIL|CVT_BADFMT; } @@ -496,11 +496,13 @@ cvt_rawdcf( { if ((newtime - t->tcode) == 60) /* guard against multi bit errors */ { + parseprintf(DD_RAWDCF,("parse: cvt_rawdcf: minute delta check OK\n")); clock_time->utctime = newtime; } else { - rtc = CVT_FAIL|CVT_BADTIME; + parseprintf(DD_RAWDCF,("parse: cvt_rawdcf: minute delta check FAIL - ignore timestamp\n")); + rtc = CVT_SKIP; } t->tcode = newtime; } diff --git a/libparse/parse.c b/libparse/parse.c index 9e663f911..64167f152 100644 --- a/libparse/parse.c +++ b/libparse/parse.c @@ -697,14 +697,14 @@ timepacket( { case CVT_FAIL: parseio->parse_badformat++; - break; + return cvtrtc; case CVT_NONE: /* * too bad - pretend bad format */ parseio->parse_badformat++; - break; + return CVT_NONE; case CVT_OK: break; diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c index 195ec39cb..6801f6209 100644 --- a/ntpd/refclock_parse.c +++ b/ntpd/refclock_parse.c @@ -3782,6 +3782,8 @@ parse_process( msyslog(LOG_WARNING, "PARSE receiver #%d: FAILED TIMECODE: \"%s\" (check receiver configuration / wiring)", CLK_UNIT(parse->peer), mkascii(buffer, sizeof buffer, tmpctl.parsegettc.parse_buffer, (unsigned)(tmpctl.parsegettc.parse_count - 1))); } + /* copy status to show only changes in case of failures */ + parse->timedata.parse_status = parsetime->parse_status; } }