[PATCH 4/9] router: inherit user-assigned preferred_lifetime

Paul Donald newtwen+github at gmail.com
Thu Apr 4 17:53:07 PDT 2024


From: Paul Donald <newtwen at gmail.com>

Inherit preferred_lifetime value irrespective of whether ra_useleasetime
is set or not.

User-provided values for preferred_lifetime are now assigned, instead of
ignored.

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

diff --git a/src/router.c b/src/router.c
index 335218f..3890c0b 100644
--- a/src/router.c
+++ b/src/router.c
@@ -590,9 +590,10 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr
 		if (addr->preferred_lt > (uint32_t)now) {
 			preferred_lt = TIME_LEFT(addr->preferred_lt, now);
 
-			if (iface->ra_useleasetime &&
-			    preferred_lt > iface->preferred_lifetime)
+			if (preferred_lt > iface->preferred_lifetime) {
+				// set to possibly user mandated preferred_lt
 				preferred_lt = iface->preferred_lifetime;
+			}
 		}
 
 		if (addr->valid_lt > (uint32_t)now) {
-- 
2.44.0




More information about the openwrt-devel mailing list