svn commit: r231249 - stable/8/contrib/ntp/ntpd

Bjoern A. Zeeb bz at FreeBSD.org
Thu Feb 9 07:27:59 UTC 2012


Author: bz
Date: Thu Feb  9 07:27:59 2012
New Revision: 231249
URL: http://svn.freebsd.org/changeset/base/231249

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

Modified:
  stable/8/contrib/ntp/ntpd/ntp_io.c
Directory Properties:
  stable/8/contrib/ntp/   (props changed)

Modified: stable/8/contrib/ntp/ntpd/ntp_io.c
==============================================================================
--- stable/8/contrib/ntp/ntpd/ntp_io.c	Thu Feb  9 06:50:43 2012	(r231248)
+++ stable/8/contrib/ntp/ntpd/ntp_io.c	Thu Feb  9 07:27:59 2012	(r231249)
@@ -2646,14 +2646,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-stable-8 mailing list