diff options
author | Pierre Pfister <ppfister@cisco.com> | 2017-12-08 15:15:02 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-12-08 18:22:06 +0100 |
commit | 750e457e3000187b85906814a2529ede24775325 (patch) | |
tree | 020851603a89a5cbed9ae0d92e0647a76de037c4 /src/odhcpd.c | |
parent | c516801e3dbb992ce1ea5274439b9b30888d9fb1 (diff) |
Support muliple RAs on single interface
IETF is moving toward implementing IPv6 multihoming by sending
multiple RAs on a single interface:
- draft-ietf-intarea-provisioning-domains-00
- draft-ietf-rtgwg-enterprise-pa-multihoming-02
odhcpd supports configuration of multiple software interfaces
on the same physical interface, which already advertises
multiple RAs, but had two issues:
- Each RA includes all the prefixes available on the interface.
- Replies to sollicits with a single RA.
This patch introduces the prefix_filter configuration parameter
which allows filtering prefixes that are sent in a given RA,
and fixes the sollicit code in order to reply with all the RAs
that are configured on a given interface.
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'src/odhcpd.c')
-rw-r--r-- | src/odhcpd.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c index 97a6de9..58c4338 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -371,12 +371,6 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even if (addr.ll.sll_family == AF_PACKET) destiface = addr.ll.sll_ifindex; - struct interface *iface = - odhcpd_get_interface_by_index(destiface); - - if (!iface && addr.nl.nl_family != AF_NETLINK) - continue; - char ipbuf[INET6_ADDRSTRLEN] = "kernel"; if (addr.ll.sll_family == AF_PACKET && len >= (ssize_t)sizeof(struct ip6_hdr)) @@ -386,10 +380,26 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even else if (addr.in.sin_family == AF_INET) inet_ntop(AF_INET, &addr.in.sin_addr, ipbuf, sizeof(ipbuf)); - syslog(LOG_DEBUG, "Received %li Bytes from %s%%%s", (long)len, - ipbuf, (iface) ? iface->ifname : "netlink"); + // From netlink + if (addr.nl.nl_family == AF_NETLINK) { + syslog(LOG_DEBUG, "Received %li Bytes from %s%%%s", (long)len, + ipbuf, "netlink"); + e->handle_dgram(&addr, data_buf, len, NULL, dest); + return; + } else if (destiface != 0) { + struct interface *iface; + list_for_each_entry(iface, &interfaces, head) { + if (iface->ifindex != destiface) + continue; + + syslog(LOG_DEBUG, "Received %li Bytes from %s%%%s", (long)len, + ipbuf, iface->ifname); + + e->handle_dgram(&addr, data_buf, len, iface, dest); + } + } + - e->handle_dgram(&addr, data_buf, len, iface, dest); } } |