From: Paul Donald Date: Fri, 10 Oct 2025 11:43:23 +0000 (+0200) Subject: config: cap ra_retranstime and warn instead of only logging an error X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=434b0613399721ff50ecef499d595e5f4c5ce003;p=project%2Fodhcpd.git config: cap ra_retranstime and warn instead of only logging an error Set to the currently defined maximum of 60,000msec via a define. Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcpd/pull/225 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/config.c b/src/config.c index 8cc43db..05daf5d 100644 --- a/src/config.c +++ b/src/config.c @@ -1371,11 +1371,10 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) { uint32_t ra_retranstime = blobmsg_get_u32(c); - if (ra_retranstime <= 60000) - iface->ra_retranstime = ra_retranstime; - else - syslog(LOG_ERR, "Invalid %s value configured for interface '%s'", - iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name); + iface->ra_retranstime = ra_retranstime <= RETRANS_TIMER_MAX ? ra_retranstime : RETRANS_TIMER_MAX; + if (ra_retranstime > RETRANS_TIMER_MAX) + syslog(LOG_WARNING, "Clamped invalid %s value configured for interface '%s' to %d", + iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name, iface->ra_retranstime); } if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) { diff --git a/src/router.h b/src/router.h index 6358493..6d82666 100644 --- a/src/router.h +++ b/src/router.h @@ -78,6 +78,11 @@ struct icmpv6_opt { Note: this value is an 8 bit int, so max 255. */ #define AdvCurHopLimit 255 +/* RFC4861 §10 - constants + Node constants: + RETRANS_TIMER 1,000 milliseconds +*/ +#define RETRANS_TIMER_MAX 60000 #define ND_RA_FLAG_PROXY 0x4 #define ND_RA_PREF_HIGH (1 << 3)