summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2011-06-28 09:46:25 +0000
committerbz <bz@FreeBSD.org>2011-06-28 09:46:25 +0000
commit5eb4e348c846241663feac5cdfc0c79ebb1e312f (patch)
treed8dd1f05e885a31ba92e42bbdc2b1b872c3d1676 /contrib/ntp/ntpd
parent29ff2b4aff0cd24ac5e6e02ed95642fdf23c433d (diff)
downloadFreeBSD-src-5eb4e348c846241663feac5cdfc0c79ebb1e312f.zip
FreeBSD-src-5eb4e348c846241663feac5cdfc0c79ebb1e312f.tar.gz
Compare port numbers correctly. They are stored by SRCPORT()
in host byte order, so we need to compare them as such. Properly compare IPv6 addresses as well. This allows the, by default, 8 badaddrs slots per address family to work correctly and only print sendto() errors once. The change is no longer applicable to any latest upstream versions. Approved by: roberto Sponsored by: Sandvine Incorporated MFC after: 1 week
Diffstat (limited to 'contrib/ntp/ntpd')
-rw-r--r--contrib/ntp/ntpd/ntp_io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c
index 8dac3c4..2d5572a 100644
--- a/contrib/ntp/ntpd/ntp_io.c
+++ b/contrib/ntp/ntpd/ntp_io.c
@@ -2716,14 +2716,14 @@ sendpkt(
for (slot = ERRORCACHESIZE; --slot >= 0; )
if(dest->ss_family == AF_INET) {
- if (badaddrs[slot].port == ((struct sockaddr_in*)dest)->sin_port &&
+ if (badaddrs[slot].port == SRCPORT(dest) &&
badaddrs[slot].addr.s_addr == ((struct sockaddr_in*)dest)->sin_addr.s_addr)
break;
}
#ifdef INCLUDE_IPV6_SUPPORT
else if (dest->ss_family == AF_INET6) {
- if (badaddrs6[slot].port == ((struct sockaddr_in6*)dest)->sin6_port &&
- badaddrs6[slot].addr.s6_addr == ((struct sockaddr_in6*)dest)->sin6_addr.s6_addr)
+ if (badaddrs6[slot].port == SRCPORT(dest) &&
+ !memcmp(&badaddrs6[slot].addr, &((struct sockaddr_in6*)dest)->sin6_addr, sizeof(struct in6_addr)))
break;
}
#endif /* INCLUDE_IPV6_SUPPORT */
OpenPOWER on IntegriCloud