From: Harlan Stenn Date: Thu, 23 Mar 2017 05:45:08 +0000 (+0000) Subject: [Bug 3358] Spurious KoD log messages in .INIT. phase X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15f1c4a22fa701ffc54258c0e7857882519e4b87;p=thirdparty%2Fntp.git [Bug 3358] Spurious KoD log messages in .INIT. phase bk: 58d360e4UVkZymM7DXxHDluHvTL3WQ --- diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index b1340c569..2b88e07d5 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -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;