]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3102] Zero origin issues
authorHarlan Stenn <stenn@ntp.org>
Thu, 13 Oct 2016 08:24:48 +0000 (01:24 -0700)
committerHarlan Stenn <stenn@ntp.org>
Thu, 13 Oct 2016 08:24:48 +0000 (01:24 -0700)
bk: 57ff44d0W6suoUHdd2ZvRM3z87j2QA

ChangeLog
ntpd/ntp_proto.c

index 494dae3f58514900a954363c1736efbc5fd381cf..8b286578b75bc3cb14722505c8482e918a3e604e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
   - implemented Miroslav Lichvars <mlichvar@redhat.com> suggestion
     to skip interface updates based on incoming packets
 * [Bug 3116] unit tests for NTP time stamp expansion. <perlinger@ntp.org>
+* [Bug 3102] Zero origin issues.  HStenn.
 * [Bug 3100] ntpq can't retrieve daemon_version <perlinger@ntp.org>
   - fixed extended sysvar lookup (bug introduced with bug 3008 fix)
 * [Bug 3095] Compatibility with openssl 1.1 <perlinger@ntp.org>
index 513b99f683e3db8935e283aadbc5f51ea3f916e5..b296291b2fb4e43b3a6afcfc01336e22f625943c 100644 (file)
@@ -1645,13 +1645,38 @@ receive(
        } else if (peer->flip == 0) {
                INSIST(0 != hisstratum);
                INSIST(STRATUM_UNSPEC != hisstratum);
+
                if (0) {
                } else if (L_ISZERO(&p_org)) {
+                       char *action;
+
+                       L_CLR(&peer->aorg);
+                       /**/
+                       switch (hismode) {
+                       /* We allow 0org for: */
+                           case UCHAR_MAX:
+                               action = "Allow";
+                               break;
+                       /* We disallow 0org for: */
+                           case MODE_UNSPEC:
+                           case MODE_ACTIVE:
+                           case MODE_PASSIVE:
+                           case MODE_CLIENT:
+                           case MODE_SERVER:
+                           case MODE_BROADCAST:
+                               action = "Drop";
+                               peer->bogusorg++;
+                               peer->flash |= TEST2;   /* bogus */
+                               break;
+                           default:
+                               INSIST(!"receive(): impossible hismode");
+                               break;
+                       }
+                       /**/
                        msyslog(LOG_INFO,
-                               "receive: Got 0 origin timestamp from %s@%s xmt %#010x.%08x",
-                               hm_str, ntoa(&peer->srcadr),
+                               "receive: %s 0 origin timestamp from %s@%s xmt %#010x.%08x",
+                               action, hm_str, ntoa(&peer->srcadr),
                                ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf));
-                       L_CLR(&peer->aorg);
                } else if (!L_ISEQU(&p_org, &peer->aorg)) {
                        /* are there cases here where we should bail? */
                        /* Should we set TEST2 if we decide to try xleave? */