DHCPv6 interface issues

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


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

Marcus,

Can you try this patch (against the original discover.c code)?

Thanks for working with us on this. Apologies for the problems. :(

Marcus Goller wrote:
> I just added an IPv6 interface on bge0, which seems to get me a bit further:
> Wrote 0 deleted host decls to leases file.
> Wrote 0 new dynamic host decls to leases file.
> Wrote 0 leases to leases file.
> 
> No subnet declaration for bge1 (fe80::203:baff:fea0:253a).
> ** Ignoring requests on bge1.  If this is not what
>    you want, please write a subnet declaration
>    in your dhcpd.conf file for the network segment
>    to which interface bge1 is attached. **
> 
> Changing my config from
> 
> subnet6 fe80::203:baff:fea0:0/128 {
>         range6 fe80::203:baff:fea0:0/112;
> }
> 
> - which is probably pretty useless looking at it now -, to
> 
> subnet6 fe80::203:baff:fea0:253a/128 {
> }
> 
> gets rid of the interface messages, but gives my a core dump.
> 
> ./dhcpd -cf test-a.conf -lf /tmp/test.leases -6 -d bge1
> Internet Systems Consortium DHCP Server 4.0.0a2
> Copyright 2004-2007 Internet Systems Consortium.
> All rights reserved.
> For info, please visit http://www.isc.org/sw/dhcp/
> Wrote 0 deleted host decls to leases file.
> Wrote 0 new dynamic host decls to leases file.
> Wrote 0 leases to leases file.
> Segmentation Fault (core dumped)
> 
> The debugger gives me the following:
> 
> program terminated by signal SEGV (no mapping at the fault address)
> Current function is discover_interfaces
>  1163                                   memcpy (subnet ->
> interface_address.iabuf,
> (dbx)

- --- common/discover.c.old	2007-07-13 08:43:40.000000000 +0200
+++ common/discover.c	2007-08-06 17:44:11.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_warning("%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

iD8DBQFGt0KgMsfZxBO4kbQRAs3rAKDn05V//SK+Gkzs6VBt+fS/7XqwiwCeKgqO
5ZlusmuuLIVzDuvRYjDjQec=
=A6xZ
-----END PGP SIGNATURE-----


More information about the dhcp-users mailing list