[RFC PATCH 09/14] config: clamp ra_reachabletime to RFC maximum (instead of complaining)
Christian Marangi
ansuelsmth at gmail.com
Sat Nov 16 07:13:21 PST 2024
On Fri, May 10, 2024 at 12:30:41AM +0200, Paul Donald wrote:
> From: Paul Donald <newtwen at gmail.com>
>
> Attempt to be helpful.
Better commit description please. (also apply this to every other
comment, declerative comments and NOT as continuation of title)
>
> Signed-off-by: Paul Donald <newtwen at gmail.com>
> ---
> src/config.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/config.c b/src/config.c
> index 6b3cb01..54fb9b5 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -939,11 +939,13 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
> if ((c = tb[IFACE_ATTR_RA_REACHABLETIME])) {
> uint32_t ra_reachabletime = blobmsg_get_u32(c);
>
> - if (ra_reachabletime <= 3600000)
> - iface->ra_reachabletime = ra_reachabletime;
> - else
> - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
> - iface_attrs[IFACE_ATTR_RA_REACHABLETIME].name, iface->name);
> + /* rfc4861#section-6.2.1 : AdvReachableTime :
> + * MUST be no greater than 3,600,000 msec
> + */
> + iface->ra_reachabletime = (ra_reachabletime <= 3600000)? ra_reachabletime : 3600000;
> + if(ra_reachabletime > 3600000)
> + syslog(LOG_INFO, "Clamped invalid %s value configured for interface '%s' to %d",
> + iface_attrs[IFACE_ATTR_RA_REACHABLETIME].name, iface->name, iface->ra_reachabletime);
I would keep LOG_ERR, also space before ? and drop the ( ).
> }
>
> if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) {
> --
> 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