]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3358] Spurious KoD log messages in .INIT. phase
authorHarlan Stenn <stenn@ntp.org>
Thu, 23 Mar 2017 05:45:08 +0000 (05:45 +0000)
committerHarlan Stenn <stenn@ntp.org>
Thu, 23 Mar 2017 05:45:08 +0000 (05:45 +0000)
bk: 58d360e4UVkZymM7DXxHDluHvTL3WQ

ntpd/ntp_proto.c

index b1340c569e56605897ea246df08cb0195de6a0bd..2b88e07d588efe8a8ec4ad153aaeb1b9b774aedb 100644 (file)
@@ -633,6 +633,8 @@ receive(
        hisleap = PKT_LEAP(pkt->li_vn_mode);
        hismode = (int)PKT_MODE(pkt->li_vn_mode);
        hisstratum = PKT_TO_STRATUM(pkt->stratum);
+
+       /* See basic mode and broadcast checks, below */
        INSIST(0 != hisstratum);
 
        if (restrict_mask & RES_IGNORE) {
@@ -1600,13 +1602,13 @@ receive(
         * see if this is an interleave broadcast packet until after
         * we've validated the MAC that SHOULD be provided.
         *
-        * hisstratum should never be 0.
+        * hisstratum cannot be 0 - see assertion above.
         * If hisstratum is 15, then we'll advertise as UNSPEC but
         * at least we'll be able to sync with the broadcast server.
         */
        } else if (hismode == MODE_BROADCAST) {
-               if (   0 == hisstratum
-                   || STRATUM_UNSPEC <= hisstratum) {
+               /* 0 is unexpected too, and impossible */
+               if (STRATUM_UNSPEC <= hisstratum) {
                        /* Is this a ++sys_declined or ??? */
                        msyslog(LOG_INFO,
                                "receive: Unexpected stratum (%d) in broadcast from %s",
@@ -1683,11 +1685,11 @@ receive(
         *
         * This could also mean somebody is forging packets claiming to
         * be from us, attempting to cause our server to KoD us.
+        *
+        * We have earlier asserted that hisstratum cannot be 0.
+        * If hisstratum is STRATUM_UNSPEC, it means he's not sync'd.
         */
        } else if (peer->flip == 0) {
-               INSIST(0 != hisstratum);
-               INSIST(STRATUM_UNSPEC != hisstratum);
-
                if (0) {
                } else if (L_ISZERO(&p_org)) {
                        const char *action;