[RFC PATCH 13/14] config: clamp dhcpv6_hostid_len
Christian Marangi
ansuelsmth at gmail.com
Sat Nov 16 07:17:12 PST 2024
On Fri, May 10, 2024 at 12:30:45AM +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 | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/config.c b/src/config.c
> index f4eaa3b..4d35548 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -896,11 +896,12 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
> if ((c = tb[IFACE_ATTR_DHCPV6_HOSTID_LEN])) {
> uint32_t hostid_len = blobmsg_get_u32(c);
>
> - if (hostid_len >= HOSTID_LEN_MIN && hostid_len <= HOSTID_LEN_MAX)
> - iface->dhcpv6_hostid_len = hostid_len;
> - else
> - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
> - iface_attrs[IFACE_ATTR_DHCPV6_HOSTID_LEN].name, iface->name);
> + iface->dhcpv6_hostid_len = (hostid_len < HOSTID_LEN_MIN) ?
> + HOSTID_LEN_MIN : (hostid_len > HOSTID_LEN_MAX) ?
> + HOSTID_LEN_MAX : hostid_len;
> + if (!(hostid_len >= HOSTID_LEN_MIN && hostid_len <= HOSTID_LEN_MAX))
> + syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d",
> + iface_attrs[IFACE_ATTR_DHCPV6_HOSTID_LEN].name, iface->name, iface->dhcpv6_hostid_len);
Same comments of prev and prev prev patch.
>
> }
>
> --
> 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