[radvd-devel-l] [PATCH] Sending initial RAs in smaller intervals
Pekka Savola
pekkas at netcore.fi
Tue Feb 7 13:06:23 EST 2006
Hi,
Sure -- unless I hear comments on this, I'll merge this before the
next release.
On Tue, 7 Feb 2006, Jirka Bohac wrote:
> RFC 2461, section 6.2.4 says:
> 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.
>
> radvd does not do this, even though the constants are already
> defined in defaults.h.
>
> The following patch fixes that:
>
> diff -Naur radvd-0.9.1/radvd.c radvd-0.9.1-patched/radvd.c
> --- radvd-0.9.1/radvd.c 2005-12-30 16:13:11.000000000 +0100
> +++ radvd-0.9.1-patched/radvd.c 2006-02-07 18:44:09.000000000 +0100
> @@ -302,6 +302,12 @@
> send_ra(sock, iface, NULL);
>
> next = rand_between(iface->MinRtrAdvInterval, iface->MaxRtrAdvInterval);
> + if (iface->InitialAdvLeft > 1) {
> + --iface->InitialAdvLeft;
> + if (next > MAX_INITIAL_RTR_ADVERT_INTERVAL)
> + next = MAX_INITIAL_RTR_ADVERT_INTERVAL;
> + }
> +
> set_timer(&iface->tm, next);
> }
>
> @@ -339,9 +345,11 @@
> if (iface->AdvSendAdvert)
> {
> /* send an initial advertisement */
> + iface->InitialAdvLeft = MAX_INITIAL_RTR_ADVERTISEMENTS - 1;
> send_ra(sock, iface, NULL);
>
> - set_timer(&iface->tm, iface->MaxRtrAdvInterval);
> + set_timer(&iface->tm, iface->MaxRtrAdvInterval > MAX_INITIAL_RTR_ADVERT_INTERVAL ?
> + MAX_INITIAL_RTR_ADVERT_INTERVAL : iface->MaxRtrAdvInterval);
> }
> }
> }
> diff -Naur radvd-0.9.1/radvd.h radvd-0.9.1-patched/radvd.h
> --- radvd-0.9.1/radvd.h 2005-12-30 17:12:23.000000000 +0100
> +++ radvd-0.9.1-patched/radvd.h 2006-02-07 18:44:09.000000000 +0100
> @@ -70,6 +70,7 @@
> int AdvDefaultPreference;
> int AdvSourceLLAddress;
> int UnicastOnly;
> + int InitialAdvLeft;
>
> /* Mobile IPv6 extensions */
> int AdvIntervalOpt;
>
>
>
>
>
> Please, is it possible to merge this?
>
>
> Thanks,
>
>
--
Pekka Savola "You each name yourselves king, yet the
Netcore Oy kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
More information about the radvd-devel-l
mailing list