Commit 861c8914 authored by Simon Kelley's avatar Simon Kelley

Change rules for constructing DHCPv6 ranges.

parent 8939c95f
...@@ -119,6 +119,11 @@ version 2.67 ...@@ -119,6 +119,11 @@ version 2.67
6939 for this to work. It always works for directly 6939 for this to work. It always works for directly
connected clients. Thanks to Vladislav Grishenko connected clients. Thanks to Vladislav Grishenko
for prompting this feature. for prompting this feature.
Remove the rule for constructed DHCP ranges that the local
address must be either the first or last address in the
range. This was originally to avoid SLAAC addresses, but
we now explicitly autoconfig and privacy addresses instead.
version 2.66 version 2.66
......
...@@ -652,24 +652,20 @@ This forms a template which describes how to create ranges, based on the address ...@@ -652,24 +652,20 @@ This forms a template which describes how to create ranges, based on the address
.B --dhcp-range=::1,::400,constructor:eth0 .B --dhcp-range=::1,::400,constructor:eth0
will look for addresses of the form <network>::1 or <network>:400 on will look for addresses on
eth0 and then create a range from <network>::1 to <network>::400. If eth0 and then create a range from <network>::1 to <network>::400. If
the interface is assigned more than one network, then the the interface is assigned more than one network, then the
corresponding ranges will be automatically created, and then corresponding ranges will be automatically created, and then
deprecated and finally removed again as the address is deprecated and deprecated and finally removed again as the address is deprecated and
then deleted. The interface name may have a final "*" wildcard. Note then deleted. The interface name may have a final "*" wildcard. Note
that just any address on eth0 will not do: the non-prefix part must be that just any address on eth0 will not do: it must not be an
equal either the start or end address given in the dhcp-range. This is autoconfigured or privacy address, or be deprecated.
to prevent prefixes becoming perpetual if the interface
gains a SLAAC address for the prefix when it is advertised by dnsmasq.
If a dhcp-range is only being used for stateless DHCP and/or SLAAC, If a dhcp-range is only being used for stateless DHCP and/or SLAAC,
then the address can be simply :: then the address can be simply ::
.B --dhcp-range=::,constructor:eth0 .B --dhcp-range=::,constructor:eth0
This removes the condition above, and will pick up the prefix from any address on eth0 which is NOT
autoconfigured, slaac, temporary or deprecated.
There is a variant of the constructor: syntax using the keyword There is a variant of the constructor: syntax using the keyword
.B constructor-noauth. .B constructor-noauth.
......
...@@ -602,6 +602,12 @@ static int construct_worker(struct in6_addr *local, int prefix, ...@@ -602,6 +602,12 @@ static int construct_worker(struct in6_addr *local, int prefix,
IN6_IS_ADDR_MULTICAST(local)) IN6_IS_ADDR_MULTICAST(local))
return 1; return 1;
if (!(flags & IFACE_PERMANENT))
return 1;
if (flags & IFACE_DEPRECATED)
return 1;
if (!indextoname(daemon->doing_dhcp6 ? daemon->dhcp6fd : daemon->icmp6fd, if_index, ifrn_name)) if (!indextoname(daemon->doing_dhcp6 ? daemon->dhcp6fd : daemon->icmp6fd, if_index, ifrn_name))
return 0; return 0;
...@@ -618,11 +624,7 @@ static int construct_worker(struct in6_addr *local, int prefix, ...@@ -618,11 +624,7 @@ static int construct_worker(struct in6_addr *local, int prefix,
} }
} }
else if ((addr6part(local) == addr6part(&template->start6) || else if (wildcard_match(template->template_interface, ifrn_name))
addr6part(local) == addr6part(&template->end6) ||
(IN6_IS_ADDR_UNSPECIFIED(&template->start6) &&
IFACE_PERMANENT == (flags & (IFACE_PERMANENT | IFACE_DEPRECATED)))) &&
wildcard_match(template->template_interface, ifrn_name))
{ {
start6 = *local; start6 = *local;
setaddr6part(&start6, addr6part(&template->start6)); setaddr6part(&start6, addr6part(&template->start6));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment