Fixup RAs/DHCPv6 announcing incorrect addresses
authorSteven Barth <steven@midlink.org>
Tue, 1 Sep 2015 13:29:31 +0000 (15:29 +0200)
committerSteven Barth <steven@midlink.org>
Tue, 1 Sep 2015 13:29:31 +0000 (15:29 +0200)
src/dhcpv6-ia.c
src/router.c

index a4598df762913cdae46234287dc33bdc2d061a1f..d301b4f0b5b83f01d1df6c1c91c174ef331fb97e 100644 (file)
@@ -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)
index 853b9e8700e6d762f42f8312cb14c397e92430c5..9c9b55a74a4dd1c59e7273feab434a307e7089ed 100644 (file)
@@ -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))