diff options
author | Steven Barth <steven@midlink.org> | 2015-07-07 16:01:13 +0200 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2015-07-07 16:01:13 +0200 |
commit | fd3e3bbc461fcbbaefff9339da2e9b6c85a5b4a1 (patch) | |
tree | 3895bd2f9a9ab585fb30cfd32d9dd9c4709f968b /src/router.c | |
parent | fb47b59a249adaff373aefe1bf09e635082ee0b3 (diff) |
router: also send RAs to every known neighbor
Diffstat (limited to 'src/router.c')
-rw-r--r-- | src/router.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/router.c b/src/router.c index f942d8f..718f170 100644 --- a/src/router.c +++ b/src/router.c @@ -37,6 +37,7 @@ static void sigusr1_refresh(int signal); static struct odhcpd_event router_event = {{.fd = -1}, handle_icmpv6}; static FILE *fp_route = NULL; +#define RA_IOV_LEN 6 int init_router(void) @@ -205,6 +206,18 @@ static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len) return found_default; } +// Unicsat RAs +static void send_neigh_ra(const struct in6_addr *addr, + const struct interface *iface, void *data) +{ + struct sockaddr_in6 dest = { + .sin6_family = AF_INET6, + .sin6_addr = *addr, + .sin6_scope_id = iface->ifindex, + }; + odhcpd_send(router_event.uloop.fd, &dest, data, RA_IOV_LEN, iface); +} + // Router Advert server mode static uint64_t send_router_advert(struct interface *iface, const struct in6_addr *from) @@ -443,7 +456,8 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add .data = {0, 0, maxival >> 24, maxival >> 16, maxival >> 8, maxival} }; - struct iovec iov[] = {{&adv, (uint8_t*)&adv.prefix[cnt] - (uint8_t*)&adv}, + struct iovec iov[RA_IOV_LEN] = { + {&adv, (uint8_t*)&adv.prefix[cnt] - (uint8_t*)&adv}, {&routes, routes_cnt * sizeof(*routes)}, {&dns, (dns_cnt) ? sizeof(dns) : 0}, {dns_addr, dns_cnt * sizeof(*dns_addr)}, @@ -457,6 +471,7 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add odhcpd_send(router_event.uloop.fd, &dest, iov, ARRAY_SIZE(iov), iface); + odhcpd_iterate_interface_neighbors(iface, send_neigh_ra, iov); return msecs; } |