[RFC PATCH 10/14] config: clamp ra_hoplimit to maximum (instead of complaining)
Christian Marangi
ansuelsmth at gmail.com
Sat Nov 16 07:14:19 PST 2024
On Fri, May 10, 2024 at 12:30:42AM +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 54fb9b5..e0f2d80 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -961,11 +961,12 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
> if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) {
> uint32_t ra_hoplimit = blobmsg_get_u32(c);
>
> - if (ra_hoplimit <= 255)
> - iface->ra_hoplimit = ra_hoplimit;
> - else
> - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
> - iface_attrs[IFACE_ATTR_RA_HOPLIMIT].name, iface->name);
> + /* rfc4861#section-6.2.1 : AdvCurHopLimit */
> + iface->ra_hoplimit = (ra_hoplimit <= 255)? ra_hoplimit : 255;
> + if(ra_hoplimit > 255)
> + syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d",
> + iface_attrs[IFACE_ATTR_RA_HOPLIMIT].name, iface->name, iface->ra_hoplimit);
> +
Same comments as prev patch.
> }
>
> if ((c = tb[IFACE_ATTR_RA_MTU])) {
> --
> 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