[radvd-devel-l] [RADVD PATCH] MAX_INITIAL_RTR_ADVERT_INTERVAL
support.
YOSHIFUJI Hideaki / 吉藤英明
yoshfuji at linux-ipv6.org
Mon Aug 7 06:39:19 EDT 2006
Hello.
This patch (against current CVS tree) adds MAX_INITIAL_RTR_ADVERT_INTERVAL
support.
Regards,
Index: TODO
===================================================================
RCS file: /work/cvsroot/radvd/TODO,v
retrieving revision 1.22
diff -u -r1.22 TODO
--- TODO 23 May 2006 06:37:43 -0000 1.22
+++ TODO 7 Aug 2006 07:26:12 -0000
@@ -29,14 +29,6 @@
- section 6.2.1: Adv{Valid,Preferred}Lifetime that decrements in real time,
that is, one that will result in a Lifetime of zero at the specified time in
the future. (MUST)
- - section 6.2.4: For the first few advertisements (up to
- MAX_INITIAL_RTR_ADVERTISEMENTS) sent from an interface when it
- becomes an advertising interface, if the randomly chosen interval is
- greater than MAX_INITIAL_RTR_ADVERT_INTERVAL, the timer SHOULD be set
- to MAX_INITIAL_RTR_ADVERT_INTERVAL instead. Using a smaller interval
- for the initial advertisements increases the likelihood of a router
- being discovered quickly when it first becomes available, in the
- presence of possible packet loss. (SHOULD)
- section 6.2.5: when AdvSendAdvertisements changes to FALSE, we don't send
a final RA with zero Router Lifetime (we just send it when shutting down).
(SHOULD)
Index: radvd.c
===================================================================
RCS file: /work/cvsroot/radvd/radvd.c,v
retrieving revision 1.28
diff -u -r1.28 radvd.c
--- radvd.c 23 May 2006 06:52:46 -0000 1.28
+++ radvd.c 7 Aug 2006 07:26:12 -0000
@@ -311,6 +311,13 @@
send_ra(sock, iface, NULL);
next = rand_between(iface->MinRtrAdvInterval, iface->MaxRtrAdvInterval);
+
+ if (iface->init_racount < MAX_INITIAL_RTR_ADVERTISEMENTS)
+ {
+ iface->init_racount++;
+ next = min(MAX_INITIAL_RTR_ADVERT_INTERVAL, next);
+ }
+
set_timer(&iface->tm, next);
}
@@ -350,7 +357,11 @@
/* send an initial advertisement */
send_ra(sock, iface, NULL);
- set_timer(&iface->tm, iface->MaxRtrAdvInterval);
+ iface->init_racount++;
+
+ set_timer(&iface->tm,
+ min(MAX_INITIAL_RTR_ADVERT_INTERVAL,
+ iface->MaxRtrAdvInterval));
}
}
}
Index: radvd.h
===================================================================
RCS file: /work/cvsroot/radvd/radvd.h,v
retrieving revision 1.22
diff -u -r1.22 radvd.h
--- radvd.h 9 Jun 2006 11:46:49 -0000 1.22
+++ radvd.h 7 Aug 2006 07:26:12 -0000
@@ -40,6 +40,8 @@
struct timer_lst *prev;
};
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+
struct AdvPrefix;
#define HWADDR_MAX 16
@@ -50,6 +52,8 @@
struct in6_addr if_addr;
unsigned int if_index;
+ uint8_t init_racount; /* Initial RAs */
+
uint8_t if_hwaddr[HWADDR_MAX];
int if_hwaddr_len;
int if_prefix_len;
--
YOSHIFUJI Hideaki @ USAGI Project <yoshfuji at linux-ipv6.org>
GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
More information about the radvd-devel-l
mailing list