(usagi-core 27702) Re: [radvd-devel-l] [PATCH] RADVD:

YOSHIFUJI Hideaki / 吉藤英明 yoshfuji at linux-ipv6.org
Wed Jan 18 11:08:57 EST 2006


In article <43CE5F19.5020308 at tcs.hut.fi> (at Wed, 18 Jan 2006 17:30:33 +0200), Ville Nuorvala <vnuorval at tcs.hut.fi> says:

> There is a small bug in your patch. The on-the-wire Router Lifetime and 
> Home Agent Lifetime fields are defined as 16-bit unsigned integers,
> so if you want to make the values signed you have to use 32-bit integers 
> internally.

Agreed.  And, fine, check for maximum value is already implemented.

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 16:04:11 -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 16:04:11 -0000
@@ -66,7 +66,7 @@
 	uint32_t		AdvReachableTime;
 	uint32_t		AdvRetransTimer;
 	uint8_t			AdvCurHopLimit;
-	uint16_t		AdvDefaultLifetime;
+	int32_t			AdvDefaultLifetime;
 	int			AdvDefaultPreference;
 	int			AdvSourceLLAddress;
 	int			UnicastOnly;
@@ -76,7 +76,7 @@
 	int			AdvHomeAgentInfo;
 	int			AdvHomeAgentFlag;
 	uint16_t		HomeAgentPreference;
-	uint16_t		HomeAgentLifetime;
+	int32_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