--- src/contrib/ntpd/Attic/client.c 2004/12/01 04:14:08 1.4 +++ src/contrib/ntpd/Attic/client.c 2004/12/14 16:05:57 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: src/usr.sbin/ntpd/client.c,v 1.45 2004/11/10 11:47:28 henning Exp $ */ +/* $OpenBSD: src/usr.sbin/ntpd/client.c,v 1.48 2004/12/13 12:22:52 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -153,8 +153,8 @@ client_query(struct ntp_peer *p) * Save the real transmit timestamp locally. */ - p->query->msg.xmttime.int_part = arc4random(); - p->query->msg.xmttime.fraction = arc4random(); + p->query->msg.xmttime.int_partl = arc4random(); + p->query->msg.xmttime.fractionl = arc4random(); p->query->xmttime = gettime(); if (ntp_sendmsg(p->query->fd, NULL, &p->query->msg, @@ -194,8 +194,12 @@ client_dispatch(struct ntp_peer *p, u_in ntp_getmsg(buf, size, &msg); - if (msg.orgtime.int_part != p->query->msg.xmttime.int_part || - msg.orgtime.fraction != p->query->msg.xmttime.fraction) + if (msg.orgtime.int_partl != p->query->msg.xmttime.int_partl || + 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); /* @@ -256,7 +260,7 @@ client_dispatch(struct ntp_peer *p, u_in p->state = STATE_REPLY_RECEIVED; /* every received reply which we do not discard increases trust */ - if (p->trustlevel < 10) { + if (p->trustlevel < TRUSTLEVEL_MAX) { if (p->trustlevel < TRUSTLEVEL_BADPEER && p->trustlevel + 1 >= TRUSTLEVEL_BADPEER) log_info("peer %s now valid",