[RFC PATCH 14/14] config: clamp dhcpv6_pd_min_len

Christian Marangi ansuelsmth at gmail.com
Sat Nov 16 07:17:40 PST 2024


On Fri, May 10, 2024 at 12:30:46AM +0200, Paul Donald wrote:
> From: Paul Donald <newtwen at gmail.com>
> 
> Attempt to be helpful.
> 
> Signed-off-by: Paul Donald <newtwen at gmail.com>
> ---
>  src/config.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/config.c b/src/config.c
> index 4d35548..7484519 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -883,11 +883,11 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
>  
>  	if ((c = tb[IFACE_ATTR_DHCPV6_PD_MIN_LEN])) {
>  		uint32_t pd_min_len = blobmsg_get_u32(c);
> -		if (pd_min_len != 0 && pd_min_len <= PD_MIN_LEN_MAX)
> -			iface->dhcpv6_pd_min_len = pd_min_len;
> -		else
> -			syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
> -					iface_attrs[IFACE_ATTR_DHCPV6_PD_MIN_LEN].name, iface->name);
> +
> +		iface->dhcpv6_pd_min_len = (pd_min_len >= PD_MIN_LEN_MAX) ? PD_MIN_LEN_MAX : pd_min_len;
> +		if (pd_min_len >= PD_MIN_LEN_MAX)
> +			syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d",
> +					iface_attrs[IFACE_ATTR_DHCPV6_PD_MIN_LEN].name, iface->name, iface->dhcpv6_pd_min_len);

Same comments of prev prev patch.

>  	}
>  
>  	if ((c = tb[IFACE_ATTR_DHCPV6_NA]))
> -- 
> 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