svn commit: r223626 - head/contrib/ntp/ntpd

Bjoern A. Zeeb bz at FreeBSD.org
Tue Jun 28 09:46:26 UTC 2011


Author: bz
Date: Tue Jun 28 09:46:25 2011
New Revision: 223626
URL: http://svn.freebsd.org/changeset/base/223626

Log:
  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

Modified:
  head/contrib/ntp/ntpd/ntp_io.c

Modified: head/contrib/ntp/ntpd/ntp_io.c
==============================================================================
--- head/contrib/ntp/ntpd/ntp_io.c	Tue Jun 28 08:41:44 2011	(r223625)
+++ head/contrib/ntp/ntpd/ntp_io.c	Tue Jun 28 09:46:25 2011	(r223626)
@@ -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 */


More information about the svn-src-all mailing list