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 §6.2.1 : AdvCurHopLimit */
+ iface->ra_hoplimit = ra_hoplimit <= AdvCurHopLimit ? ra_hoplimit : AdvCurHopLimit;
+ if(ra_hoplimit > AdvCurHopLimit)
+ syslog(LOG_WARNING, "Clamped invalid %s value configured for interface '%s' to %d",
+ iface_attrs[IFACE_ATTR_RA_HOPLIMIT].name, iface->name, iface->ra_hoplimit);
+
}
if ((c = tb[IFACE_ATTR_RA_MTU])) {
* MUST be no greater than 3,600,000 msec
*/
#define AdvReachableTime 3600000
+/* RFC4861 §6.2.1 : AdvCurHopLimit
+ The value should be set to the current
+ diameter of the Internet. The value zero means
+ unspecified (by this router).
+
+ Note: this value is an 8 bit int, so max 255.
+*/
+#define AdvCurHopLimit 255
#define ND_RA_FLAG_PROXY 0x4
#define ND_RA_PREF_HIGH (1 << 3)