DHCPv6 interface issues

Shane Kerr Shane_Kerr at isc.org
Mon Aug 6 15:57:43 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ug. There is no log_warning(). This one should at least compile. :(

- --- common/discover.c.old	2007-07-13 08:43:40.000000000 +0200
+++ common/discover.c	2007-08-06 17:56:27.000000000 +0200
@@ -233,7 +233,7 @@
 	int lifnum;
 #endif

- -	ifaces->sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+	ifaces->sock = socket(local_family, SOCK_DGRAM, IPPROTO_UDP);
 	if (ifaces->sock < 0) {
 		log_error("Error creating socket to list interfaces; %m");
 		return 0;
@@ -1152,12 +1152,24 @@
 			       ? tmp -> shared_network -> subnets
 			       : (struct subnet *)0);
 		     subnet; subnet = subnet -> next_sibling) {
- -			if (!subnet -> interface_address.len) {
- -				/* Set the interface address for this subnet
- -				   to the first address we found. */
- -				subnet -> interface_address.len = 4;
- -				memcpy (subnet -> interface_address.iabuf,
- -					&tmp->addresses[0].s_addr, 4);
+			/* Set the interface address for this subnet
+			   to the first address we found. */
+		     	if (subnet->interface_address.len == 0) {
+				if (tmp->address_count > 0) {
+					subnet->interface_address.len = 4;
+					memcpy(subnet->interface_address.iabuf,
+					       &tmp->addresses[0].s_addr, 4);
+				} else if (tmp->v6address_count > 0) {
+					subnet->interface_address.len = 16;
+					memcpy(subnet->interface_address.iabuf,
+					       &tmp->v6addresses[0].s6_addr,
+					       16);
+				} else {
+					/* XXX: should be one */
+					log_error("%s missing an interface "
+						  "address", tmp->name);
+					continue;
+				}
 			}
 		}

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGt0T2MsfZxBO4kbQRAnhtAKDKYpFcpHokRJMsmiStvdcqAf/kGwCgukuS
VSg/l8flROO18H6ebRE1TDg=
=MnWe
-----END PGP SIGNATURE-----


More information about the dhcp-users mailing list