[radvd-devel-l] PATCH: send zero router lifetime when exiting
Pekka Savola
pekkas at netcore.fi
Wed Dec 15 01:56:55 EST 2004
Hi,
Upon re-reading RFC2461bis I came across a SHOULD radvd is not
implementing: send a final multicast RA with zero router lifetime when
exiting.
I've committed the attached patch to CVS. Comments and other
similar fixes welcome. :)
--
Pekka Savola "You each name yourselves king, yet the
Netcore Oy kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
-------------- next part --------------
Index: CHANGES
===================================================================
RCS file: /work/cvsroot/radvd/CHANGES,v
retrieving revision 1.31
diff -u -r1.31 CHANGES
--- CHANGES 26 Oct 2004 05:30:34 -0000 1.31
+++ CHANGES 15 Dec 2004 06:53:02 -0000
@@ -1,5 +1,8 @@
$Id: CHANGES,v 1.31 2004/10/26 05:30:34 psavola Exp $
+12/15/2004 Advertise zero Router Lifetime when shutting down;
+ implements a SHOULD in RFC2461 section 6.2.5.
+
10/16/2004 Update Mobile IPv6 to match RFC 3775, from Greg Daley.
08/20/2004 Minor documentation cleanups.
Index: radvd.c
===================================================================
RCS file: /work/cvsroot/radvd/radvd.c,v
retrieving revision 1.16
diff -u -r1.16 radvd.c
--- radvd.c 20 Aug 2004 08:09:03 -0000 1.16
+++ radvd.c 15 Dec 2004 06:53:02 -0000
@@ -56,6 +56,7 @@
void sigint_handler(int sig);
void timer_handler(void *data);
void kickoff_adverts(void);
+void stop_adverts(void);
void reload_config(void);
void version(void);
void usage(void);
@@ -269,8 +270,10 @@
process(sock, IfaceList, msg, len,
&rcv_addr, pkt_info, hoplimit);
- if (sigterm_received || sigint_received)
+ if (sigterm_received || sigint_received) {
+ stop_adverts();
break;
+ }
if (sighup_received)
{
@@ -322,6 +325,26 @@
}
}
+void
+stop_adverts(void)
+{
+ struct Interface *iface;
+
+ /*
+ * send final RA (a SHOULD in RFC2461 section 6.2.5)
+ */
+
+ for (iface=IfaceList; iface; iface=iface->next) {
+ if( ! iface->UnicastOnly ) {
+ if (iface->AdvSendAdvert) {
+ /* send a final advertisement with zero Router Lifetime */
+ iface->AdvDefaultLifetime = 0;
+ send_ra(sock, iface, NULL);
+ }
+ }
+ }
+}
+
void reload_config(void)
{
struct Interface *iface;
More information about the radvd-devel-l
mailing list