router: improve RFC7084 compliancy
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 9 Apr 2018 15:01:45 +0000 (17:01 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 9 Apr 2018 15:08:28 +0000 (17:08 +0200)
Send Router Information Option as well for prefixes with length 64 in order
to be compliant with L-3 in RFC7084: An IPv6 CE router must advertise
itself as a router for the delegated prefixes using the "Route Information
Option".

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/router.c

index e62282b..e9919b2 100644 (file)
@@ -519,10 +519,10 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
 
        for (ssize_t i = 0; i < ipcnt; ++i) {
                struct odhcpd_ipaddr *addr = &addrs[i];
 
        for (ssize_t i = 0; i < ipcnt; ++i) {
                struct odhcpd_ipaddr *addr = &addrs[i];
-               if (addr->dprefix > 64 || addr->dprefix == 0 || addr->valid <= (uint32_t)now ||
-                               (addr->dprefix == 64 && addr->prefix == 64)) {
+               if (addr->dprefix > 64 || addr->dprefix == 0 || addr->valid <= (uint32_t)now)
                        continue; // Address not suitable
                        continue; // Address not suitable
-               } else if (addr->dprefix > 32) {
+
+               if (addr->dprefix > 32) {
                        addr->addr.in6.s6_addr32[1] &= htonl(~((1U << (64 - addr->dprefix)) - 1));
                } else if (addr->dprefix <= 32) {
                        addr->addr.in6.s6_addr32[0] &= htonl(~((1U << (32 - addr->dprefix)) - 1));
                        addr->addr.in6.s6_addr32[1] &= htonl(~((1U << (64 - addr->dprefix)) - 1));
                } else if (addr->dprefix <= 32) {
                        addr->addr.in6.s6_addr32[0] &= htonl(~((1U << (32 - addr->dprefix)) - 1));