[ntpsec commit] Forward-port Frank Kardel's fix for NTP Classic [Bug 2836] .
Eric S. Raymond
esr at ntpsec.org
Thu Oct 22 14:10:34 UTC 2015
Module: ntpsec
Branch: master
Commit: fc03342073a695d7425c1c2ee36c87af6c61dfc9
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=fc03342073a695d7425c1c2ee36c87af6c61dfc9
Author: Eric S. Raymond <esr at thyrsus.com>
Date: Thu Oct 22 10:07:55 2015 -0400
Forward-port Frank Kardel's fix for NTP Classic [Bug 2836].
---
NEWS | 5 +++++
libparse/clk_rawdcf.c | 6 ++++--
libparse/parse.c | 4 ++--
ntpd/refclock_parse.c | 2 ++
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index d1792e1..e1a8e1a 100644
--- a/NEWS
+++ b/NEWS
@@ -6,4 +6,9 @@ Much of the traditional function of a news file is now better addressed
by browsing the comments in the revision history. This file will focus
on user-visible changes.
+== Forward-ported bugfixes from NTP Classic ==
+
+* [Bug 2836] DFC77 patches from Frank Kardel to make decoding more
+ robust, and require 2 consecutive timestamps to be consistent.
+
// end
diff --git a/libparse/clk_rawdcf.c b/libparse/clk_rawdcf.c
index 4e1bf8c..b738243 100644
--- a/libparse/clk_rawdcf.c
+++ b/libparse/clk_rawdcf.c
@@ -196,7 +196,7 @@ convert_rawdcf(
if (size < 57)
{
msyslog(LOG_ERR, "parse: convert_rawdcf: INCOMPLETE DATA - time code only has %d bits", size);
- return CVT_NONE;
+ return CVT_FAIL|CVT_BADFMT;
}
for (i = 0; i < size; i++)
@@ -454,11 +454,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 5776c1b..8610187 100644
--- a/libparse/parse.c
+++ b/libparse/parse.c
@@ -635,14 +635,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 927819d..4d7eb8b 100644
--- a/ntpd/refclock_parse.c
+++ b/ntpd/refclock_parse.c
@@ -3217,6 +3217,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;
}
}
More information about the vc
mailing list