1 From 0ddb8769bb809cd118840553e12be86297cdf246 Mon Sep 17 00:00:00 2001
2 From: Neil Jerram <Neil.Jerram@metaswitch.com>
3 Date: Wed, 10 Jun 2015 22:11:06 +0100
4 Subject: [PATCH 107/113] Extend --bridge-interface aliasing to DHCPv6.
7 src/dhcp6.c | 28 +++++++++++++++++++++++++++-
8 1 file changed, 27 insertions(+), 1 deletion(-)
10 diff --git a/src/dhcp6.c b/src/dhcp6.c
11 index ee2aa5d3bf3c..4c60c6e86c0c 100644
14 @@ -144,6 +144,8 @@ void dhcp6_packet(time_t now)
16 if ((port = relay_reply6(&from, sz, ifr.ifr_name)) == 0)
18 + struct dhcp_bridge *bridge, *alias;
20 for (tmp = daemon->if_except; tmp; tmp = tmp->next)
21 if (tmp->name && wildcard_match(tmp->name, ifr.ifr_name))
23 @@ -160,6 +162,30 @@ void dhcp6_packet(time_t now)
24 memset(&parm.fallback, 0, IN6ADDRSZ);
25 memset(&parm.ll_addr, 0, IN6ADDRSZ);
26 memset(&parm.ula_addr, 0, IN6ADDRSZ);
28 + /* If the interface on which the DHCPv6 request was received is
29 + an alias of some other interface (as specified by the
30 + --bridge-interfaces option), change parm.ind so that we look
31 + for DHCPv6 contexts associated with the aliased interface
32 + instead of with the aliasing one. */
33 + for (bridge = daemon->bridges; bridge; bridge = bridge->next)
35 + for (alias = bridge->alias; alias; alias = alias->next)
36 + if (wildcard_matchn(alias->iface, ifr.ifr_name, IF_NAMESIZE))
38 + parm.ind = if_nametoindex(bridge->iface);
41 + my_syslog(MS_DHCP | LOG_WARNING,
42 + _("unknown interface %s in bridge-interface"),
52 for (context = daemon->dhcp6; context; context = context->next)
53 if (IN6_IS_ADDR_UNSPECIFIED(&context->start6) && context->prefix == 0)
54 @@ -208,7 +234,7 @@ void dhcp6_packet(time_t now)
55 /* May have configured relay, but not DHCP server */
56 if (!daemon->doing_dhcp6)
60 lease_prune(NULL, now); /* lose any expired leases */
62 port = dhcp6_reply(parm.current, if_index, ifr.ifr_name, &parm.fallback,