diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2013-01-10 11:47:38 +0000 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2013-01-10 11:47:38 +0000 |
commit | baeb3adf21ad2e4311fd8ed60768d1a4b0f8c2db (patch) | |
tree | 23a02850c8f870e0e19de6dce23f380fc5c4830d | |
parent | 39f6a04ca42af0f167b67c1a66ce3df6d2385c75 (diff) | |
download | dnsmasq-baeb3adf21ad2e4311fd8ed60768d1a4b0f8c2db.tar.gz |
More IPv6 address allocation fixes.v2.66test8
-rw-r--r-- | src/dhcp6.c | 6 | ||||
-rw-r--r-- | src/rfc3315.c | 24 |
2 files changed, 16 insertions, 14 deletions
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 @@ static int complete_context6(struct in6_addr *local, int prefix, 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 *address6_valid(struct dhcp_context *context, 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 @@ static int dhcp6_maybe_relay(struct in6_addr *link_address, struct dhcp_netid ** { 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); |