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

Christian Marangi ansuelsmth at gmail.com
Sat Nov 16 07:09:54 PST 2024


On Fri, May 10, 2024 at 12:30:40AM +0200, Paul Donald wrote:
> 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>

More info on this? Maybe why? Scenario this fix?

> ---
>  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

Use /* */ for consistent comments.

> +				valid_lt = iface->valid_lifetime;
> +			}
> +
>  		}
>  
>  		if (preferred_lt > valid_lt) {
> -- 
> 2.44.0
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

-- 
	Ansuel



More information about the openwrt-devel mailing list