1 From db0f488ea8f5ded7c57400c9108ec3c9367d75c5 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Thu, 7 Jun 2018 21:37:02 +0100
4 Subject: [PATCH 15/17] Handle some corner cases in RA contructed interfaces
5 with addresses changing interface.
7 Thanks to Vladislav Grishenko for work on this.
9 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
11 src/dhcp6.c | 16 ++++++++++------
12 1 file changed, 10 insertions(+), 6 deletions(-)
16 @@ -640,7 +640,7 @@ static int construct_worker(struct in6_a
19 for (template = daemon->dhcp6; template; template = template->next)
20 - if (!(template->flags & CONTEXT_TEMPLATE))
21 + if (!(template->flags & (CONTEXT_TEMPLATE | CONTEXT_CONSTRUCTED)))
23 /* non-template entries, just fill in interface and local addresses */
24 if (prefix <= template->prefix &&
25 @@ -667,20 +667,23 @@ static int construct_worker(struct in6_a
27 setaddr6part(&end6, addr6part(&template->end6));
29 - /* If there's an absolute address context covering this address
30 - then don't contruct one as well. */
31 for (context = daemon->dhcp6; context; context = context->next)
32 if (!(context->flags & CONTEXT_TEMPLATE) &&
33 IN6_ARE_ADDR_EQUAL(&start6, &context->start6) &&
34 IN6_ARE_ADDR_EQUAL(&end6, &context->end6))
36 - if (context->flags & CONTEXT_CONSTRUCTED)
37 + /* If there's an absolute address context covering this address
38 + then don't construct one as well. */
39 + if (!(context->flags & CONTEXT_CONSTRUCTED))
42 + if (context->if_index == if_index)
44 int cflags = context->flags;
45 context->flags &= ~(CONTEXT_GC | CONTEXT_OLD);
46 if (cflags & CONTEXT_OLD)
48 - /* address went, now it's back */
49 + /* address went, now it's back, and on the same interface */
50 log_context(AF_INET6, context);
51 /* fast RAs for a while */
52 ra_start_unsolicited(param->now, context);
53 @@ -688,9 +691,10 @@ static int construct_worker(struct in6_a
54 /* Add address to name again */
55 if (context->flags & CONTEXT_RA_NAME)
64 if (!context && (context = whine_malloc(sizeof (struct dhcp_context))))