Ignore template contexts where appropriate.

This commit is contained in:
Simon Kelley
2012-12-16 21:52:45 +00:00
parent 7558ecd9ac
commit 6e3dba3fde
2 changed files with 41 additions and 36 deletions

View File

@@ -214,7 +214,8 @@ static int complete_context6(struct in6_addr *local, int prefix,
for (context = daemon->dhcp6; context; context = context->next) for (context = daemon->dhcp6; context; context = context->next)
{ {
if (prefix == context->prefix && if (!(context->flags & CONTEXT_TEMPLATE) &&
prefix == context->prefix &&
is_same_net6(local, &context->start6, prefix) && is_same_net6(local, &context->start6, prefix) &&
is_same_net6(local, &context->end6, prefix)) is_same_net6(local, &context->end6, prefix))
{ {

View File

@@ -102,6 +102,7 @@ void ra_start_unsolicted(time_t now, struct dhcp_context *context)
context->ra_time = now; context->ra_time = now;
else else
for (context = daemon->dhcp6; context; context = context->next) for (context = daemon->dhcp6; context; context = context->next)
if (!(context->flags & CONTEXT_TEMPLATE))
context->ra_time = now + (rand16()/13000); /* range 0 - 5 */ context->ra_time = now + (rand16()/13000); /* range 0 - 5 */
/* re-do frequently for a minute or so, in case the first gets lost. */ /* re-do frequently for a minute or so, in case the first gets lost. */
@@ -350,7 +351,8 @@ static int add_prefixes(struct in6_addr *local, int prefix,
struct dhcp_context *context; struct dhcp_context *context;
for (context = daemon->dhcp6; context; context = context->next) for (context = daemon->dhcp6; context; context = context->next)
if (prefix == context->prefix && if (!(context->flags & CONTEXT_TEMPLATE) &&
prefix == context->prefix &&
is_same_net6(local, &context->start6, prefix) && is_same_net6(local, &context->start6, prefix) &&
is_same_net6(local, &context->end6, prefix)) is_same_net6(local, &context->end6, prefix))
{ {
@@ -536,10 +538,12 @@ static int iface_search(struct in6_addr *local, int prefix,
(void)valid; (void)valid;
for (context = daemon->dhcp6; context; context = context->next) for (context = daemon->dhcp6; context; context = context->next)
if (prefix == context->prefix && if (!(context->flags & CONTEXT_TEMPLATE) &&
prefix == context->prefix &&
is_same_net6(local, &context->start6, prefix) && is_same_net6(local, &context->start6, prefix) &&
is_same_net6(local, &context->end6, prefix)) is_same_net6(local, &context->end6, prefix) &&
if (context->ra_time != 0 && difftime(context->ra_time, param->now) <= 0.0) context->ra_time != 0 &&
difftime(context->ra_time, param->now) <= 0.0)
{ {
/* found an interface that's overdue for RA determine new /* found an interface that's overdue for RA determine new
timeout value and arrange for RA to be sent unless interface is timeout value and arrange for RA to be sent unless interface is