[ntp:bk-ntp-dev-send] BitKeeper diffs

Harlan Stenn stenn at deacon.udel.edu
Sat Jun 9 23:23:19 PDT 2007


#### ChangeSet ####
2007-06-07 09:28:16-04:00, mayer at pogo.udel.edu 
  Bug #854 Broadcast address was not correctly set for interface addresses

==== ChangeLog ====
2007-06-07 09:28:05-04:00, mayer at pogo.udel.edu +1 -0
  Bug #854 Broadcast address was not correctly set for interface addresses

--- 1.1.1.17/ChangeLog	2007-05-29 01:32:14 -04:00
+++ 1.1.1.18/ChangeLog	2007-06-07 09:28:05 -04:00
@@ -1,3 +1,4 @@
+* [Bug 854] Broadcast address was not correctly set for interface addresses
 * [Bug 829] reduce syslog noise, while there fix Enabled/Disable logging
 	    to reflect the actual configuration.
 * [Bug 795] Moved declaration of variable to top of function.

#### ChangeSet ####
2007-06-07 09:25:17-04:00, mayer at pogo.udel.edu 
  Bug #854 Broadcast address was not correctly set for interface addresses

==== ports/winnt/libisc/interfaceiter.c ====
2007-06-07 09:24:57-04:00, mayer at pogo.udel.edu +35 -13
  Bug #854 Broadcast address was not correctly set for interface addresses

--- 1.6/ports/winnt/libisc/interfaceiter.c	2004-08-14 00:36:04 -04:00
+++ 1.7/ports/winnt/libisc/interfaceiter.c	2007-06-07 09:24:57 -04:00
@@ -99,6 +99,26 @@ get_addr(unsigned int family, isc_netadd
 	}
 }
 
+/*
+ * The WSAIoctl code is not fetching the broadcast address for each interface address
+ * so we need to reconstruct it from the address and its network mask
+ */
+static void
+get_broadcastaddr(isc_netaddr_t *bcastaddr, isc_netaddr_t *addr, isc_netaddr_t *netmask) {
+
+	unsigned char *p, *a, *n;
+	int i;
+
+	p = (unsigned char *) &bcastaddr->type.in;
+	a = (unsigned char *) &addr->type.in;
+	n = (unsigned char *) &netmask->type.in;
+
+	for (i=0; i < 4; i++) {
+		p[i] = (unsigned char) (a[i] | ~n[i]);
+	}
+
+}
+
 isc_result_t
 isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
 	char strbuf[ISC_STRERRORSIZE]; 
@@ -271,6 +291,18 @@ internal_current(isc_interfaceiter_t *it
 	}
 
 	/*
+	 * Get the network mask.
+	 */
+	switch (family) {
+	case AF_INET:
+		get_addr(family, &iter->current.netmask,
+			 (struct sockaddr *)&(iter->IFData.iiNetmask));
+		break;
+	case AF_INET6:
+		break;
+	}
+
+	/*
 	 * If the interface is point-to-point, get the destination address.
 	 */
 	if ((iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0) {
@@ -281,25 +313,15 @@ internal_current(isc_interfaceiter_t *it
 	 * If the interface is broadcast, get the broadcast address.
 	 */
 	if ((iter->current.flags & INTERFACE_F_BROADCAST) != 0) {
-		get_addr(family, &iter->current.broadcast,
+		get_addr(family, &iter->current.broadcast, 
 		(struct sockaddr *)&(iter->IFData.iiBroadcastAddress));
+		get_broadcastaddr(&iter->current.broadcast, &iter->current.address,
+				   &iter->current.netmask);
 	}
 
 	if (ifNamed == FALSE)
 		sprintf(iter->current.name,
 			"IP Interface %d", iter->numIF);
-
-	/*
-	 * Get the network mask.
-	 */
-	switch (family) {
-	case AF_INET:
-		get_addr(family, &iter->current.netmask,
-			 (struct sockaddr *)&(iter->IFData.iiNetmask));
-		break;
-	case AF_INET6:
-		break;
-	}
 
 	return (ISC_R_SUCCESS);
 }


More information about the bk-ntp-dev-send mailing list