More IPv6 address allocation fixes.
diff --git a/src/dhcp6.c b/src/dhcp6.c
index 9922c85..c290993 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -211,7 +211,8 @@
for (context = daemon->dhcp6; context; context = context->next)
{
- if (!(context->flags & CONTEXT_TEMPLATE) &&
+ if ((context->flags & CONTEXT_DHCP) &&
+ !(context->flags & CONTEXT_TEMPLATE) &&
prefix == context->prefix &&
is_same_net6(local, &context->start6, prefix) &&
is_same_net6(local, &context->end6, prefix))
@@ -361,8 +362,7 @@
struct dhcp_context *tmp;
for (tmp = context; tmp; tmp = tmp->current)
- if ((tmp->flags & CONTEXT_STATIC) &&
- is_same_net6(&tmp->start6, taddr, tmp->prefix) &&
+ if (is_same_net6(&tmp->start6, taddr, tmp->prefix) &&
match_netid(tmp->filter, netids, 1))
return tmp;
diff --git a/src/rfc3315.c b/src/rfc3315.c
index f24a3c6..8fd050c 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -82,18 +82,20 @@
{
struct dhcp_context *c;
context = NULL;
+
+ if (!IN6_IS_ADDR_LOOPBACK(link_address) &&
+ !IN6_IS_ADDR_LINKLOCAL(link_address) &&
+ !IN6_IS_ADDR_MULTICAST(link_address))
+ for (c = daemon->dhcp6; c; c = c->next)
+ if ((c->flags & CONTEXT_DHCP) &&
+ !(c->flags & CONTEXT_TEMPLATE) &&
+ is_same_net6(link_address, &c->start6, c->prefix) &&
+ is_same_net6(link_address, &c->end6, c->prefix))
+ {
+ c->current = context;
+ context = c;
+ }
- for (c = daemon->dhcp6; c; c = c->next)
- if (!IN6_IS_ADDR_LOOPBACK(link_address) &&
- !IN6_IS_ADDR_LINKLOCAL(link_address) &&
- !IN6_IS_ADDR_MULTICAST(link_address) &&
- is_same_net6(link_address, &c->start6, c->prefix) &&
- is_same_net6(link_address, &c->end6, c->prefix))
- {
- c->current = context;
- context = c;
- }
-
if (!context)
{
inet_ntop(AF_INET6, link_address, daemon->addrbuff, ADDRSTRLEN);