[RFC PATCH 09/14] config: clamp ra_reachabletime to RFC maximum (instead of complaining)
Paul Donald
newtwen+github at gmail.com
Thu May 9 15:30:41 PDT 2024
From: Paul Donald <newtwen at gmail.com>
Attempt to be helpful.
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);
}
if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) {
--
2.44.0
More information about the openwrt-devel
mailing list