summaryrefslogtreecommitdiff
path: root/accel-pppd/ipv6
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2014-09-01 15:52:07 +0600
committerDmitry Kozlov <xeb@mail.ru>2014-09-13 11:02:14 +0400
commit0d9a9b35c355fa5273055d9cf21630d07adda40f (patch)
treedbd42f567c62a8f059b7a395a2b332e2bb201e66 /accel-pppd/ipv6
parentae5f0170e8b532a60d7a672e6b326615368a7a46 (diff)
downloadaccel-ppp-0d9a9b35c355fa5273055d9cf21630d07adda40f.tar.gz
accel-ppp-0d9a9b35c355fa5273055d9cf21630d07adda40f.zip
ipv6: randomize router adverts as per rfc4861 and add tunable MaxInitialRtrAdvCount, MaxInitialRtrAdvInterval parameters
Diffstat (limited to 'accel-pppd/ipv6')
-rw-r--r--accel-pppd/ipv6/nd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/accel-pppd/ipv6/nd.c b/accel-pppd/ipv6/nd.c
index 8eb4b5ef..12413801 100644
--- a/accel-pppd/ipv6/nd.c
+++ b/accel-pppd/ipv6/nd.c
@@ -192,10 +192,12 @@ static void send_ra_timer(struct triton_timer_t *t)
addr.sin6_addr.s6_addr32[3] = htonl(0x1);
addr.sin6_scope_id = h->ses->ifindex;
- if (h->ra_sent++ == conf_init_ra) {
+ if (h->ra_sent == conf_init_ra) {
h->timer.period = conf_MaxRtrAdvInterval * 1000;
+ h->timer.period -= (conf_MaxRtrAdvInterval - conf_MinRtrAdvInterval) * random() * 1000 / RAND_MAX;
triton_timer_mod(t, 0);
- }
+ } else
+ h->ra_sent++;
ipv6_nd_send_ra(h, &addr);
}
@@ -328,6 +330,7 @@ static int ipv6_nd_start(struct ap_session *ses)
triton_md_enable_handler(&h->hnd, MD_MODE_READ);
triton_timer_add(ses->ctrl->ctx, &h->timer, 0);
+ send_ra_timer(&h->timer);
return 0;
@@ -483,6 +486,13 @@ static void load_config(void)
if (opt)
conf_MinRtrAdvInterval = atoi(opt);
+ opt = conf_get_opt("ipv6-nd", "MaxInitialRtrAdvCount");
+ if (opt)
+ conf_init_ra = atoi(opt);
+ opt = conf_get_opt("ipv6-nd", "MaxInitialRtrAdvInterval");
+ if (opt)
+ conf_init_ra_interval = atoi(opt);
+
opt = conf_get_opt("ipv6-nd", "AdvManagedFlag");
if (opt)
conf_AdvManagedFlag = atoi(opt);