From: Harlan Stenn Date: Thu, 26 Apr 2001 00:35:51 +0000 (-0000) Subject: ChangeLog, ntp.h, ntp_config.h, ntp_proto.c, Makefile.in: X-Git-Tag: NTP_4_0_99_M~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e3e63281cb67310d1ab323ff60be65ddebb0efa;p=thirdparty%2Fntp.git ChangeLog, ntp.h, ntp_config.h, ntp_proto.c, Makefile.in: * ntpd/ntp_proto.c (receive): Keep track of packet versions. Implement RES_LIMITED. * include/ntp_config.h (CONF_RES_LIMITED): * include/ntp.h (RES_LIMITED): Leave the bits in the original order. From Dave Mills. bk: 3ae76d673CbcA3PcSdgNR_14zFJIrw --- diff --git a/ChangeLog b/ChangeLog index 59a8b6e78e..d1c977faf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2001-04-25 Harlan Stenn + * ntpd/ntp_proto.c (receive): Keep track of packet versions. + Implement RES_LIMITED. + * include/ntp_config.h (CONF_RES_LIMITED): + * include/ntp.h (RES_LIMITED): Leave the bits in the original + order. + From Dave Mills. + * util/timetrim.c: * util/Makefile.am: * ntpdc/ntpdc_ops.c: diff --git a/include/ntp.h b/include/ntp.h index 8aafc89d15..c2c47e9629 100644 --- a/include/ntp.h +++ b/include/ntp.h @@ -747,12 +747,12 @@ struct restrictlist { #define RES_NOPEER 0x020 /* don't allocate memory resources */ #define RES_NOTRAP 0x040 /* don't allow him to set traps */ #define RES_LPTRAP 0x080 /* traps set by him are low priority */ -#define RES_VERSION 0x100 /* serve only current version */ -#define RES_LIMITED 0x200 /* limit per net number of clients */ +#define RES_LIMITED 0x100 /* limit per net number of clients */ +#define RES_VERSION 0x200 /* serve only current version */ #define RES_ALLFLAGS \ (RES_IGNORE|RES_DONTSERVE|RES_DONTTRUST|RES_NOQUERY\ - |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP|RES_LIMITED) + |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP|RES_LIMITED|RES_VERSION) /* * Match flags diff --git a/include/ntp_config.h b/include/ntp_config.h index 9a03eb0ece..5dea3d25f8 100644 --- a/include/ntp_config.h +++ b/include/ntp_config.h @@ -87,8 +87,8 @@ #define CONF_RES_NOTRAP 8 #define CONF_RES_LPTRAP 9 #define CONF_RES_NTPPORT 10 -#define CONF_RES_VERSION 11 -#define CONF_RES_LIMITED 12 +#define CONF_RES_LIMITED 11 +#define CONF_RES_VERSION 12 /* * "trap" modifier keywords diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index 98f4564ea5..9b49e1e244 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -306,24 +306,27 @@ receive( if (restrict_mask & RES_IGNORE) return; /* no amything */ pkt = &rbufp->recv_pkt; - if (PKT_VERSION(pkt->li_vn_mode) >= NTP_VERSION) + if (PKT_VERSION(pkt->li_vn_mode) == NTP_VERSION) { sys_newversionpkt++; - else if (PKT_VERSION(pkt->li_vn_mode) >= NTP_OLDVERSION) + } else if (restrict_mask & RES_VERSION) { + sys_unknownversion++; /* unknown version */ + return; + } else if (PKT_VERSION(pkt->li_vn_mode) >= NTP_OLDVERSION) { sys_oldversionpkt++; - else { + } else { sys_unknownversion++; /* unknown version */ return; } if (PKT_MODE(pkt->li_vn_mode) == MODE_PRIVATE) { if (restrict_mask & RES_NOQUERY) - return; /* no query private */ + return; /* no query private */ process_private(rbufp, ((restrict_mask & RES_NOMODIFY) == 0)); return; } if (PKT_MODE(pkt->li_vn_mode) == MODE_CONTROL) { if (restrict_mask & RES_NOQUERY) - return; /* no query control */ + return; /* no query control */ process_control(rbufp, restrict_mask); return; } diff --git a/util/Makefile.in b/util/Makefile.in index b91d341e55..c10e3a04b5 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -118,7 +118,7 @@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = ansi2knr -bin_PROGRAMS = ntp-genkeys @MAKE_NTPTIME@ @MAKE_TICKADJ@ @MAKE_TIMETRIM@ +bin_PROGRAMS = @MAKE_NTPTIME@ @MAKE_TICKADJ@ @MAKE_TIMETRIM@ ntp-genkeys EXTRA_PROGRAMS = byteorder hist jitter kern longsize ntptime \ precision sht testrs6000 tickadj timetrim @@ -141,8 +141,8 @@ CONFIG_CLEAN_FILES = EXTRA_PROGRAMS = byteorder$(EXEEXT) hist$(EXEEXT) jitter$(EXEEXT) \ kern$(EXEEXT) longsize$(EXEEXT) ntptime$(EXEEXT) precision$(EXEEXT) \ sht$(EXEEXT) testrs6000$(EXEEXT) tickadj$(EXEEXT) timetrim$(EXEEXT) -bin_PROGRAMS = ntp-genkeys$(EXEEXT) @MAKE_NTPTIME@ @MAKE_TICKADJ@ \ -@MAKE_TIMETRIM@ +bin_PROGRAMS = @MAKE_NTPTIME@ @MAKE_TICKADJ@ @MAKE_TIMETRIM@ \ +ntp-genkeys$(EXEEXT) PROGRAMS = $(bin_PROGRAMS)