[RFC PATCH 08/14] router: clamp prefix valid_lt to interface valid_lifetime

Paul Donald newtwen+github at gmail.com
Thu May 9 15:30:40 PDT 2024


From: Paul Donald <newtwen at gmail.com>

Before:
==
ICMPv6 Option (Prefix information : fd26:3c30:a222::/64)
    Type: Prefix information (3)
    Length: 4 (32 bytes)
    Prefix Length: 64
    Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A)
    Valid Lifetime: Infinity (4294967295)
    Preferred Lifetime: Infinity (4294967295)
    Reserved
    Prefix: fd26:3c30:a222::

==After (valid_lifetime set to 6 hours):==
ICMPv6 Option (Prefix information : fd26:3c30:a222::/64)
    Type: Prefix information (3)
    Length: 4 (32 bytes)
    Prefix Length: 64
    Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A)
    Valid Lifetime: 21600 (6 hours)
    Preferred Lifetime: 21600 (6 hours)
    Reserved
    Prefix: fd26:3c30:a222::
==

Signed-off-by: Paul Donald <newtwen at gmail.com>
---
 src/router.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/router.c b/src/router.c
index b859c46..00752af 100644
--- a/src/router.c
+++ b/src/router.c
@@ -600,6 +600,13 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr
 
 			if (iface->ra_useleasetime && valid_lt > iface->dhcp_leasetime)
 				valid_lt = iface->dhcp_leasetime;
+
+			/* currently the only way to control ULA valid_lifetime */
+			if (valid_lt > iface->valid_lifetime) {
+				// set to possibly user mandated valid_lifetime
+				valid_lt = iface->valid_lifetime;
+			}
+
 		}
 
 		if (preferred_lt > valid_lt) {
-- 
2.44.0




More information about the openwrt-devel mailing list