From b8f53276092dc48409006fec3c1e90383820cbc5 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Tue, 1 Sep 2015 15:29:31 +0200 Subject: [PATCH] Fixup RAs/DHCPv6 announcing incorrect addresses --- src/dhcpv6-ia.c | 2 +- src/router.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index a4598df..d301b4f 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -739,7 +739,7 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status, size_t entrlen = sizeof(n) - 4; if (iface->managed < RELAYD_MANAGED_NO_AFLAG && i != m && - addrs[i].prefix == 64) + addrs[i].prefix <= 64) continue; if (datalen + entrlen + 4 > buflen || a->assigned == 0) diff --git a/src/router.c b/src/router.c index 853b9e8..9c9b55a 100644 --- a/src/router.c +++ b/src/router.c @@ -244,15 +244,15 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add odhcpd_get_mac(iface, adv.lladdr.data); // If not currently shutting down - struct odhcpd_ipaddr *addrs = NULL; + struct odhcpd_ipaddr addrs[8]; ssize_t ipcnt = 0; int64_t minvalid = INT64_MAX; int64_t maxvalid = 0; // If not shutdown if (iface->timer_rs.cb) { - addrs = iface->ia_addr; ipcnt = iface->ia_addr_len; + memcpy(addrs, iface->ia_addr, ipcnt * sizeof(*addrs)); // Check default route if (parse_routes(addrs, ipcnt)) -- 2.30.2