Browse Source

Discard replies with alarm flag set or invalid stratum; ok henning@

OPENBSD_3_7
dtucker 20 years ago
parent
commit
1bfbeb3ca8
2 changed files with 7 additions and 2 deletions
  1. +5
    -1
      src/usr.sbin/ntpd/client.c
  2. +2
    -1
      src/usr.sbin/ntpd/ntp.h

+ 5
- 1
src/usr.sbin/ntpd/client.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: client.c,v 1.47 2004/12/09 20:24:46 mickey Exp $ */
/* $OpenBSD: client.c,v 1.48 2004/12/13 12:22:52 dtucker Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -198,6 +198,10 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime)
msg.orgtime.fractionl != p->query->msg.xmttime.fractionl)
return (0);
if ((msg.status & LI_ALARM) == LI_ALARM || msg.stratum == 0 ||
msg.stratum > NTP_MAXSTRATUM)
return (0);
/*
* From RFC 2030 (with a correction to the delay math):
*


+ 2
- 1
src/usr.sbin/ntpd/ntp.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntp.h,v 1.10 2004/12/08 15:47:38 mickey Exp $ */
/* $OpenBSD: ntp.h,v 1.11 2004/12/13 12:22:52 dtucker Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@ -145,5 +145,6 @@ struct ntp_query {
#define JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
#define NTP_VERSION 4
#define NTP_MAXSTRATUM 15
#endif /* _NTP_H_ */

Loading…
Cancel
Save