summaryrefslogtreecommitdiffstats
path: root/parseutil/dcfd.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
committerroberto <roberto@FreeBSD.org>2013-12-04 21:33:17 +0000
commitd54cfbdce4a9878ef65216dea36b62cf6646b84b (patch)
treea618007bb41d13153794a598e3d904ace2976324 /parseutil/dcfd.c
parentfd23eea016bd30c806a3ee90eb6f397470c2fa46 (diff)
downloadFreeBSD-src-d54cfbdce4a9878ef65216dea36b62cf6646b84b.zip
FreeBSD-src-d54cfbdce4a9878ef65216dea36b62cf6646b84b.tar.gz
Virgin import of ntpd 4.2.6p5.
When the series of commits is complete, things like https://cert.litnet.lt/en/docs/ntp-distributed-reflection-dos-attacks should be fixed. PR: bin/148836 (except that we import a newer version) Asked by: Too many MFC after: 2 weeks
Diffstat (limited to 'parseutil/dcfd.c')
-rw-r--r--parseutil/dcfd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/parseutil/dcfd.c b/parseutil/dcfd.c
index c87ab35..a65ad89 100644
--- a/parseutil/dcfd.c
+++ b/parseutil/dcfd.c
@@ -185,7 +185,7 @@ static char pat[] = "-\\|/";
#define R_SHIFT(_X_, _Y_) (((_X_) < 0) ? -(-(_X_) >> (_Y_)) : ((_X_) >> (_Y_)))
-static struct timeval max_adj_offset = { 0, 128000 };
+static long max_adj_offset_usec = 128000;
static long clock_adjust = 0; /* current adjustment value (usec * 2^USECSCALE) */
static long accum_drift = 0; /* accumulated drift value (usec / ADJINTERVAL) */
@@ -195,8 +195,8 @@ static char skip_adjust = 1; /* discard first adjustment (bad samples) */
/*
* DCF77 state flags
*/
-#define DCFB_ANNOUNCE 0x0001 /* switch time zone warning (DST switch) */
-#define DCFB_DST 0x0002 /* DST in effect */
+#define DCFB_ANNOUNCE 0x0001 /* switch time zone warning (DST switch) */
+#define DCFB_DST 0x0002 /* DST in effect */
#define DCFB_LEAP 0x0004 /* LEAP warning (1 hour prior to occurrence) */
#define DCFB_ALTERNATE 0x0008 /* alternate antenna used */
@@ -1042,7 +1042,8 @@ adjust_clock(
toffset = *offset;
toffset.tv_sec = l_abs(toffset.tv_sec);
toffset.tv_usec = l_abs(toffset.tv_usec);
- if (timercmp(&toffset, &max_adj_offset, >))
+ if (toffset.tv_sec ||
+ (!toffset.tv_sec && toffset.tv_usec > max_adj_offset_usec))
{
/*
* hopeless - set the clock - and clear the timing
@@ -1609,7 +1610,7 @@ main(
struct sigaction act;
# ifdef HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION
- act.sa_sigaction = (void (*) P((int, siginfo_t *, void *)))0;
+ act.sa_sigaction = (void (*) (int, siginfo_t *, void *))0;
# endif /* HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION */
act.sa_handler = tick;
sigemptyset(&act.sa_mask);
OpenPOWER on IntegriCloud