diff --git a/src/config.h b/src/config.h index cb31eb6..91eb70f 100644 --- a/src/config.h +++ b/src/config.h @@ -46,6 +46,7 @@ #define SOA_REFRESH 1200 /* SOA refresh default */ #define SOA_RETRY 180 /* SOA retry default */ #define SOA_EXPIRY 1209600 /* SOA expiry default */ +#define RA_INTERVAL 600 /* Send unsolicited RA's this often when not provoked. */ /* compile-time options: uncomment below to enable or do eg. make COPTS=-DHAVE_BROKEN_RTC diff --git a/src/radv.c b/src/radv.c index 648568a..d0f4422 100644 --- a/src/radv.c +++ b/src/radv.c @@ -390,8 +390,8 @@ static int add_prefixes(struct in6_addr *local, int prefix, if (time > context->lease_time) { time = context->lease_time; - if (time < 600u) - time = 600; + if (time < ((unsigned int)RA_INTERVAL)) + time = RA_INTERVAL; } if (context->flags & CONTEXT_DEPRECATE) @@ -572,8 +572,8 @@ static int iface_search(struct in6_addr *local, int prefix, /* range 5 - 20 */ context->ra_time = param->now + 5 + (rand16()/4400); else - /* range 450 - 600 */ - context->ra_time = param->now + 450 + (rand16()/440); + /* range 3/4 - 1 times RA_INTERVAL */ + context->ra_time = param->now + (3 * RA_INTERVAL)/4 + ((RA_INTERVAL * (unsigned int)rand16()) >> 18); /* zero timers for other contexts on the same subnet, so they don't timeout independently */