ed8a6e6197aecef4cb5c997f637c16796f0f6623
[openwrt/staging/rmilecki.git] /
1 From 0a496f059c1e9d75c33cce4c1211d58422ba4f62 Mon Sep 17 00:00:00 2001
2 From: Maarten de Vries <maarten+dnsmasq@m.de-vri.es>
3 Date: Fri, 11 May 2018 23:20:58 +0100
4 Subject: [PATCH 09/17] Do unsolicited RAs for interfaces which appear after
5 dnsmasq startup.
6
7 I noticed that dnsmasq often wasn't sending any unsolicited RAs for me.
8
9 This turned out to happen when the interface (a bridge interface) wasn't
10 created yet at the time dnsmasq started. When dnsmasq is started after
11 the interface is created, it sends RAs as expected. I assume this also
12 extends to other types of virtual interfaces that are created after
13 dnsmasq starts.
14
15 Digging into the source, it seems to be caused by a missing call to
16 ra_start_unsolicited for non-template contexts in construct_worker from
17 src/dhcp6.c. The attached patch adds that call, but only if the
18 interface index or address changed to prevent doing fast RAs for no reason.
19
20 I tested it on my own server and it appears to work as expected. When
21 the interface is created and configured, dnsmasq does fast RAs for a
22 while and then settles into slow RAs.
23
24 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
25 ---
26 src/dhcp6.c | 7 +++++++
27 1 file changed, 7 insertions(+)
28
29 --- a/src/dhcp6.c
30 +++ b/src/dhcp6.c
31 @@ -647,6 +647,13 @@ static int construct_worker(struct in6_a
32 is_same_net6(local, &template->start6, template->prefix) &&
33 is_same_net6(local, &template->end6, template->prefix))
34 {
35 + /* First time found, do fast RA. */
36 + if (template->if_index != if_index || !IN6_ARE_ADDR_EQUAL(&template->local6, local))
37 + {
38 + ra_start_unsolicited(param->now, template);
39 + param->newone = 1;
40 + }
41 +
42 template->if_index = if_index;
43 template->local6 = *local;
44 }