[radvd-devel-l] [PATCH] RADVD:

YOSHIFUJI Hideaki / 吉藤英明 yoshfuji at linux-ipv6.org
Wed Jan 18 09:42:12 EST 2006


Hello.

radvd-0.9.1 does not initialize AdvDefaultLifetime (etc.) appropriately.
This bug was introduced by the following patchset.

|Date: 2005/12/30 16:12:23
|Author: psavola
:
|A few more cleanups.  Also clean up the initialization of MinRtrAdvInterval,
|AdvDefaultLifetime, and HomeAgentLifetime.
|
|Members: 
|	interface.c:1.12->1.13 
|	process.c:1.13->1.14 
|	radvd.h:1.16->1.17 
|	radvdump.c:1.12->1.13 

The following patch solve the issue.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji at linux-ipv6.org>

Index: interface.c
===================================================================
RCS file: /work/cvsroot/radvd/interface.c,v
retrieving revision 1.13
diff -u -r1.13 interface.c
--- interface.c	30 Dec 2005 16:12:23 -0000	1.13
+++ interface.c	18 Jan 2006 11:08:55 -0000
@@ -38,10 +38,10 @@
 	iface->MinDelayBetweenRAs   = DFLT_MinDelayBetweenRAs;
 	iface->AdvMobRtrSupportFlag = DFLT_AdvMobRtrSupportFlag;
 
-	iface->MinRtrAdvInterval = DFLT_MinRtrAdvInterval(iface);
-	iface->AdvDefaultLifetime = DFLT_AdvDefaultLifetime(iface);
+	iface->MinRtrAdvInterval = -1;
+	iface->AdvDefaultLifetime = -1;
 	iface->AdvDefaultPreference = DFLT_AdvDefaultPreference;
-	iface->HomeAgentLifetime = DFLT_HomeAgentLifetime(iface);
+	iface->HomeAgentLifetime = -1;
 }
 
 void
@@ -93,6 +93,9 @@
 		prefix = prefix->next;
 	}
 
+	if (iface->MinRtrAdvInterval < 0)
+		iface->MinRtrAdvInterval = DFLT_MinRtrAdvInterval(iface);
+
 	if ((iface->MinRtrAdvInterval < (MIPv6 ? MIN_MinRtrAdvInterval_MIPv6 : MIN_MinRtrAdvInterval)) || 
 		    (iface->MinRtrAdvInterval > MAX_MinRtrAdvInterval(iface)))
 	{
@@ -147,7 +150,10 @@
 			iface->Name, iface->AdvCurHopLimit, MAX_AdvCurHopLimit);
 		res = -1;
 	}
-	
+
+	if (iface->AdvDefaultLifetime < 0)
+		iface->AdvDefaultLifetime = DFLT_AdvDefaultLifetime(iface);
+
 	if ((iface->AdvDefaultLifetime != 0) &&
 	   ((iface->AdvDefaultLifetime > MAX_AdvDefaultLifetime) ||
 	    (iface->AdvDefaultLifetime < MIN_AdvDefaultLifetime(iface))))
@@ -160,6 +166,10 @@
 	}
 
 	/* Mobile IPv6 ext */
+	if (iface->HomeAgentLifetime < 0)
+		iface->HomeAgentLifetime = DFLT_HomeAgentLifetime(iface);
+
+	/* Mobile IPv6 ext */
 	if (iface->AdvHomeAgentInfo)
 	{
 		if ((iface->HomeAgentLifetime > MAX_HomeAgentLifetime) ||
Index: radvd.h
===================================================================
RCS file: /work/cvsroot/radvd/radvd.h,v
retrieving revision 1.17
diff -u -r1.17 radvd.h
--- radvd.h	30 Dec 2005 16:12:23 -0000	1.17
+++ radvd.h	18 Jan 2006 11:08:56 -0000
@@ -66,7 +66,7 @@
 	uint32_t		AdvReachableTime;
 	uint32_t		AdvRetransTimer;
 	uint8_t			AdvCurHopLimit;
-	uint16_t		AdvDefaultLifetime;
+	int16_t			AdvDefaultLifetime;
 	int			AdvDefaultPreference;
 	int			AdvSourceLLAddress;
 	int			UnicastOnly;
@@ -76,7 +76,7 @@
 	int			AdvHomeAgentInfo;
 	int			AdvHomeAgentFlag;
 	uint16_t		HomeAgentPreference;
-	uint16_t		HomeAgentLifetime;
+	int16_t			HomeAgentLifetime;
 
 	/* NEMO extensions */
 	int			AdvMobRtrSupportFlag;

-- 
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