5ded822efe659846385ce94b5981ad1e950931a5
[openwrt/staging/jow.git] /
1 From c488b68e75ee5304007eef37203c4fc10193d191 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Sat, 2 Jun 2018 13:06:00 +0100
4 Subject: [PATCH 11/17] Handle standard and contructed dhcp-ranges on the same
5 interface.
6
7 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
8 ---
9 CHANGELOG | 6 ++++++
10 src/dhcp6.c | 29 +++++++++++++++++------------
11 2 files changed, 23 insertions(+), 12 deletions(-)
12
13 --- a/CHANGELOG
14 +++ b/CHANGELOG
15 @@ -23,6 +23,12 @@ version 2.80
16 which packets should be dumped is given by the --dumpmask
17 option.
18
19 + Handle the case of both standard and constructed dhcp-ranges on the
20 + same interface better. We don't now contruct a dhcp-range if there's
21 + already one specified. This allows the specified interface to
22 + have different parameters and avoids advertising the same
23 + prefix twice. Thanks to Luis Marsano for spotting this case.
24 +
25
26 version 2.79
27 Fix parsing of CNAME arguments, which are confused by extra spaces.
28 --- a/src/dhcp6.c
29 +++ b/src/dhcp6.c
30 @@ -667,23 +667,28 @@ static int construct_worker(struct in6_a
31 end6 = *local;
32 setaddr6part(&end6, addr6part(&template->end6));
33
34 + /* If there's an absolute address context covering this address
35 + then don't contruct one as well. */
36 for (context = daemon->dhcp6; context; context = context->next)
37 - if ((context->flags & CONTEXT_CONSTRUCTED) &&
38 + if (!(context->flags & CONTEXT_TEMPLATE) &&
39 IN6_ARE_ADDR_EQUAL(&start6, &context->start6) &&
40 IN6_ARE_ADDR_EQUAL(&end6, &context->end6))
41 {
42 - int flags = context->flags;
43 - context->flags &= ~(CONTEXT_GC | CONTEXT_OLD);
44 - if (flags & CONTEXT_OLD)
45 + if (context->flags & CONTEXT_CONSTRUCTED)
46 {
47 - /* address went, now it's back */
48 - log_context(AF_INET6, context);
49 - /* fast RAs for a while */
50 - ra_start_unsolicited(param->now, context);
51 - param->newone = 1;
52 - /* Add address to name again */
53 - if (context->flags & CONTEXT_RA_NAME)
54 - param->newname = 1;
55 + int cflags = context->flags;
56 + context->flags &= ~(CONTEXT_GC | CONTEXT_OLD);
57 + if (cflags & CONTEXT_OLD)
58 + {
59 + /* address went, now it's back */
60 + log_context(AF_INET6, context);
61 + /* fast RAs for a while */
62 + ra_start_unsolicited(param->now, context);
63 + param->newone = 1;
64 + /* Add address to name again */
65 + if (context->flags & CONTEXT_RA_NAME)
66 + param->newname = 1;
67 + }
68 }
69 break;
70 }