]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ChangeLog, ntp_loopfilter.c, ntp_proto.c:
authorHarlan Stenn <stenn@ntp.org>
Thu, 10 May 2001 05:16:49 +0000 (05:16 -0000)
committerHarlan Stenn <stenn@ntp.org>
Thu, 10 May 2001 05:16:49 +0000 (05:16 -0000)
  * ntpd/ntp_proto.c (receive): Validate the source port.  Lose
  NTPv1 support.
  * ntpd/ntp_loopfilter.c (local_clock): Sanity check sys_poll
  earlier instead of later.
  From: Dave Mills.
ChangeLog, aclocal.m4, configure, configure.in:
  * configure.in: 4.0.99k33

bk: 3afa2441pPmQJNtfAHIYBndLfP4qgA

ChangeLog
configure
configure.in
ntpd/ntp_loopfilter.c
ntpd/ntp_proto.c

index 5bba961e87d6b764e35bf75f6428bab78bfd2f96..4c678afcb127fdf08624c719d5f4268545426e10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2001-05-10  Harlan Stenn  <stenn@whimsy.udel.edu>
 
+       * configure.in: 4.0.99k33
+
+       * ntpd/ntp_proto.c (receive): Validate the source port.  Lose
+       NTPv1 support.
+       * ntpd/ntp_loopfilter.c (local_clock): Sanity check sys_poll
+       earlier instead of later.
+       From: Dave Mills.
+
        * ntpd/refclock_oncore.c (oncore_msg_any): We don't always have
        GETTIMEOFDAY().
 
index 64fca1b2c66dfe6129ab8575b1a65544b96db9cf..985a26952f07fcd2e2a7c403d07752295d519f5e 100755 (executable)
--- a/configure
+++ b/configure
@@ -1397,7 +1397,7 @@ fi
 
 # Define the identity of the package.
 PACKAGE=ntp
-VERSION=4.0.99k32
+VERSION=4.0.99k33
 
 cat >>confdefs.h <<EOF
 #define PACKAGE "$PACKAGE"
index ea7ec1afd7a90f676e5752c65b05b75f4ccf73bc..dfb9361e6c012bfc874e16d621a45b03547bde22 100644 (file)
@@ -5,7 +5,7 @@ AC_CANONICAL_SYSTEM
 AC_DEFINE_UNQUOTED(STR_SYSTEM, "$target")
 AM_CONFIG_HEADER(config.h)
 AC_ARG_PROGRAM
-AM_INIT_AUTOMAKE(ntp, 4.0.99k32)
+AM_INIT_AUTOMAKE(ntp, 4.0.99k33)
 AC_PREREQ(2.49)
 
 ac_cv_var_oncore_ok=no
index 980292a30a8cd75763ce89022a045161329b80fe..882ebf80daf0313ed8c031a5f91f89794998cd9b 100644 (file)
@@ -212,7 +212,7 @@ local_clock(
 #endif
        if (!ntp_enable) {
                record_loop_stats();
-               return(0);
+               return (0);
        }
 
        /*
@@ -255,7 +255,7 @@ local_clock(
                        printf("ntpd: time slew %.6fs\n", fp_offset);
                }
                record_loop_stats();
-               exit(0);
+               exit (0);
        }
 
        /*
@@ -290,6 +290,10 @@ local_clock(
         * these actions interact with the command line options.
         */
        retval = 0;
+       if (sys_poll > peer->maxpoll)
+               sys_poll = peer->maxpoll;
+       else if (sys_poll < peer->minpoll)
+               sys_poll = peer->minpoll;
        clock_frequency = flladj = plladj = 0;
        mu = peer->epoch - last_time;
        if (fabs(fp_offset) > clock_max && clock_max > 0) {
@@ -403,10 +407,6 @@ local_clock(
                 * and ignore it.
                 */
                default:
-                       if (sys_poll > peer->maxpoll)
-                               sys_poll = peer->maxpoll;
-                       else if (sys_poll < peer->minpoll)
-                               sys_poll = peer->minpoll;
                        allow_panic = TRUE;
                        if (fabs(fp_offset - last_offset) >
                            CLOCK_SGATE * oerror && mu <
index 865f3c3837e5e6390b1c6095f2deedf4ed1f40e1..c19958b83fc68921e001bc19ef09552b1bd9cdb0 100644 (file)
@@ -307,8 +307,12 @@ receive(
                    current_time, ntoa(&rbufp->dstadr->sin),
                    ntoa(&rbufp->recv_srcadr), restrict_mask);
 #endif
-       if (restrict_mask & RES_IGNORE) {
+       if (restrict_mask & RES_IGNORE)
                return;                         /* no anything */
+       if (!(SRCPORT(&rbufp->recv_srcadr) == NTP_PORT ||
+           SRCPORT(&rbufp->recv_srcadr) >= IPPORT_RESERVED)) {
+               sys_badlength++;
+               return;                         /* invalid port */
        }
        pkt = &rbufp->recv_pkt;
        if (PKT_VERSION(pkt->li_vn_mode) == NTP_VERSION) {
@@ -318,7 +322,7 @@ receive(
                sys_oldversionpkt++;            /* old version */
        } else {
                sys_unknownversion++;
-               return;
+               return;                         /* invalid version */
        }
        if (PKT_MODE(pkt->li_vn_mode) == MODE_PRIVATE) {
                if (restrict_mask & RES_NOQUERY)
@@ -335,30 +339,16 @@ receive(
        }
        if (rbufp->recv_length < LEN_PKT_NOMAC) {
                sys_badlength++;
-               return;                         /* no runt packets */
+               return;                         /* runt packet */
        }
 
        /*
-        * Figure out his mode and validate the packet. This has some
-        * legacy raunch that probably should be removed. If from NTPv1
-        * mode zero, The mode is determined from the source port. If
-        * the port number is zero, it is from a symmetric active
-        * association; otherwise, it is from a client association. From
-        * NTPv2 on, all we do is toss out mode zero packets, since
-        * control and private mode packets have already been handled.
+        * Validate mode. Note that NTPv1 is no longer supported.
         */
        hismode = (int)PKT_MODE(pkt->li_vn_mode);
-       if (PKT_VERSION(pkt->li_vn_mode) == NTP_OLDVERSION && hismode ==
-           0) {
-               if (SRCPORT(&rbufp->recv_srcadr) == NTP_PORT)
-                       hismode = MODE_ACTIVE;
-               else
-                       hismode = MODE_CLIENT;
-       } else {
-               if (hismode == MODE_UNSPEC) {
-                       sys_badlength++;
-                       return;                 /* invalid mode */
-               }
+       if (hismode == MODE_UNSPEC) {
+               sys_badlength++;
+               return;                         /* invalid mode */
        }
 
        /*