router: don't announce prefixes with valid lifetime equal to 0
authorHans Dedecker <dedeckeh@gmail.com>
Tue, 21 Feb 2017 08:54:36 +0000 (09:54 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Tue, 21 Feb 2017 09:58:56 +0000 (10:58 +0100)
Don't set prefix valid lifetime to 0 in case the preferred lifetime
equals 0 and valid lifetime gets smaller than 7200.
In corner cases it leads to router lifetime being set although no
prefixes are announced with a valid lifetime different from 0.

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

index ffafb9451f3c106e0c594c033cc4fc3b48d54ed8..e8a9aa97760c0a048c08958792bb1a6d0c9b8c6d 100644 (file)
@@ -358,11 +358,8 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
                }
 
                valid = TIME_LEFT(addr->valid, now);
-               if (iface->ra_useleasetime) {
-                       if (valid > iface->dhcpv4_leasetime)
-                               valid = iface->dhcpv4_leasetime;
-               } else if (!preferred && valid < 7200)
-                       valid = 0;
+               if (iface->ra_useleasetime && valid > iface->dhcpv4_leasetime)
+                       valid = iface->dhcpv4_leasetime;
 
                if (minvalid > valid)
                        minvalid = valid;