// RA runtime data
struct odhcpd_event router_event;
struct uloop_timeout timer_rs;
+ uint32_t ra_sent;
// DHCPv6 runtime data
struct odhcpd_event dhcpv6_event;
}
iface->router_event.handle_dgram = handle_icmpv6;
+ iface->ra_sent = 0;
odhcpd_register(&iface->router_event);
} else {
uloop_timeout_cancel(&iface->timer_rs);
msecs = (labs(msecs) % ((*maxival != minival) ? (*maxival - minival)*1000 : 500)) +
minival*1000;
+ /* RFC 2461 6.2.4 For the first MAX_INITIAL_RTR_ADVERTISEMENTS advertisements */
+ /* if the timer is bigger than MAX_INITIAL_RTR_ADVERT_INTERVAL it should be */
+ /* set to MAX_INITIAL_RTR_ADVERT_INTERVAL */
+ /* Off by one as an initial interval timer has already expired */
+ if ((iface->ra_sent + 1) < MaxInitialRtAdvs && msecs > MaxInitialRtrAdvInterval*1000)
+ msecs = MaxInitialRtrAdvInterval*1000;
+
return msecs;
}
syslog(LOG_NOTICE, "Sending a RA on %s", iface->name);
- odhcpd_send(iface->router_event.uloop.fd, &dest, iov, ARRAY_SIZE(iov), iface);
+ if (odhcpd_send(iface->router_event.uloop.fd, &dest, iov, ARRAY_SIZE(iov), iface) > 0)
+ iface->ra_sent++;
free(pfxs);
free(routes);
(void*)(opt + opt->len) <= (void*)(end); opt += opt->len)
-#define MaxRtrAdvInterval 1800
-#define MinRtrAdvInterval 3
+#define MaxInitialRtrAdvInterval 16
+#define MaxInitialRtAdvs 3
+#define MaxRtrAdvInterval 1800
+#define MinRtrAdvInterval 3
-#define ND_RA_FLAG_PROXY 0x4
-#define ND_RA_PREF_HIGH (1 << 3)
-#define ND_RA_PREF_LOW (3 << 3)
+#define ND_RA_FLAG_PROXY 0x4
+#define ND_RA_PREF_HIGH (1 << 3)
+#define ND_RA_PREF_LOW (3 << 3)