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])) {
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)