[radvd-devel-l] [PATCH] Add support for NEMO Basic

Pekka Savola pekkas at netcore.fi
Wed Sep 28 07:00:11 EDT 2005


On Wed, 28 Sep 2005, Ville Nuorvala wrote:
> Until now radvd has only needed 8-bit flag fields, but this is unfortunately 
> a 16-bit one. What exactly troubles you about the definition? Are you worried 
> the BYTE_ORDER check won't work on all platforms?
>
> I'm only familiar with gcc and glibc, so I'm not sure what happens if you use 
> another compiler or other headers, but at least the glibc version of 
> netinet/icmp6.h defines multi-byte fields (such as the Neighbor Advertisement 
> flags) in network byte order just like I defined ND_OPT_HAI_FLAG_SUPPORT_MR.

It seems that this BYTE_ORDER stuff is more widely supported than I 
realized, so it seems like an OK approach.

I've committed in the support.  I had to enhance (and a fix an earlier 
bug because HomeAgentInfo is interface-specific) the radvdump printer 
for 'radvdump -f' support.  Note that there are two basically 
identical codepaths with slightly different output formats.. :-( Maybe 
the defaut mode could be removed..

The diff against CVS is attached.

What is the status wrt. your NEMO support (e.g., are you making new 
releases soon?) -- i.e., is there a date by which you'd like us to 
release a new version of radvd supporting NEMO?

-- 
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.44
diff -u -r1.44 CHANGES
--- CHANGES	18 Aug 2005 07:22:22 -0000	1.44
+++ CHANGES	28 Sep 2005 10:54:49 -0000
@@ -1,5 +1,8 @@
 $Id: CHANGES,v 1.44 2005/08/18 07:22:22 psavola Exp $
 
+09/28/2005	Add NEMO Basic support (RFC3961) and fix default
+		HomeAgentLifetime, from Ville Nuorvala.
+
 08/18/2005	Implement more robust timer handler, especially
 		because some Linux kernels don't seem to behave
 		all that well; see http://lkml.org/lkml/2005/4/29/163.
Index: defaults.h
===================================================================
RCS file: /work/cvsroot/radvd/defaults.h,v
retrieving revision 1.13
diff -u -r1.13 defaults.h
--- defaults.h	27 Sep 2005 09:39:38 -0000	1.13
+++ defaults.h	28 Sep 2005 10:54:49 -0000
@@ -176,5 +176,17 @@
 
 /* #define MAX_RTR_SOLICITATIONS This MAY be ignored by MIPv6 */
 
+/* NEMO extensions, off by default */
+#define DFLT_AdvMobRtrSupportFlag      	0
+
+/* Flags */
+
+#ifndef ND_OPT_HAI_FLAG_SUPPORT_MR
+#if BYTE_ORDER == BIG_ENDIAN
+#define ND_OPT_HAI_FLAG_SUPPORT_MR	0x8000
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define ND_OPT_HAI_FLAG_SUPPORT_MR	0x0080
+#endif
+#endif
 
 #endif
Index: gram.y
===================================================================
RCS file: /work/cvsroot/radvd/gram.y,v
retrieving revision 1.11
diff -u -r1.11 gram.y
--- gram.y	5 Jul 2005 07:07:45 -0000	1.11
+++ gram.y	28 Sep 2005 10:54:50 -0000
@@ -91,6 +91,8 @@
 %token		T_AdvRoutePreference
 %token		T_AdvRouteLifetime
 
+%token		T_AdvMobRtrSupportFlag
+
 %token		T_BAD_TOKEN
 
 %type	<str>	name
@@ -306,6 +308,10 @@
 		{
 			iface->UnicastOnly = $2;
 		}
+		| T_AdvMobRtrSupportFlag SWITCH ';'
+		{
+			iface->AdvMobRtrSupportFlag = $2;
+		}
 		;
 		
 prefixlist	: prefixdef
Index: interface.c
===================================================================
RCS file: /work/cvsroot/radvd/interface.c,v
retrieving revision 1.10
diff -u -r1.10 interface.c
--- interface.c	29 Mar 2005 15:15:20 -0000	1.10
+++ interface.c	28 Sep 2005 10:54:50 -0000
@@ -36,6 +36,7 @@
 	iface->AdvHomeAgentFlag	  = DFLT_AdvHomeAgentFlag;
 	iface->HomeAgentPreference = DFLT_HomeAgentPreference;
 	iface->MinDelayBetweenRAs   = DFLT_MinDelayBetweenRAs;
+	iface->AdvMobRtrSupportFlag = DFLT_AdvMobRtrSupportFlag;
 
 	iface->MinRtrAdvInterval  = -1;
 	iface->AdvDefaultLifetime = -1;
@@ -193,6 +194,12 @@
 			"AdvHomeAgentFlag for %s must be set with HomeAgentInfo", iface->Name);
 		res = -1;
 	}
+	if (iface->AdvMobRtrSupportFlag && !(iface->AdvHomeAgentInfo))
+	{
+		flog(LOG_ERR, 
+			"AdvHomeAgentInfo for %s must be set with AdvMobRtrSupportFlag", iface->Name);
+		res = -1;
+	}
 
 	/* XXX: need this? prefix = iface->AdvPrefixList; */
 
Index: radvd.conf.5.man
===================================================================
RCS file: /work/cvsroot/radvd/radvd.conf.5.man,v
retrieving revision 1.13
diff -u -r1.13 radvd.conf.5.man
--- radvd.conf.5.man	27 Sep 2005 09:44:59 -0000	1.13
+++ radvd.conf.5.man	28 Sep 2005 10:54:50 -0000
@@ -287,6 +287,15 @@
 Default: 0
 
 .TP
+.BR AdvMobRtrSupportFlag " " on | off
+
+When set, the Home Agent signals it supports Mobile Router
+registrations (specified by NEMO Basic).  AdvHomeAgentInfo must also
+be set when using this option.
+
+Default: off
+
+.TP
 .BR AdvIntervalOpt " " on | off
 
 When set, Advertisement Interval Option (specified by Mobile IPv6)
@@ -524,8 +533,11 @@
 draft-ietf-ipv6-router-selection-07.txt,
 work-in-progress, January 2005.
 .PP
-D. Johnson, C. Perkins, J. Arkko, "Mobility Support in IPv6",
+Johnson, D., Perkins, C., and J. Arkko, "Mobility Support in IPv6",
 RFC 3775, June 2004.
+.PP
+Devarapalli, V., Wakikawa, R., Petrescu, A., and P. Thubert "Network Mobility (NEMO) Basic Support Protocol",
+RFC 3963, January 2005.
 
 .SH "SEE ALSO"
 
Index: radvd.h
===================================================================
RCS file: /work/cvsroot/radvd/radvd.h,v
retrieving revision 1.13
diff -u -r1.13 radvd.h
--- radvd.h	26 Jul 2005 19:21:04 -0000	1.13
+++ radvd.h	28 Sep 2005 10:54:50 -0000
@@ -78,6 +78,9 @@
 	int16_t			HomeAgentPreference;
 	uint16_t		HomeAgentLifetime;
 
+	/* NEMO extensions */
+	int			AdvMobRtrSupportFlag;
+
 	struct AdvPrefix	*AdvPrefixList;
 	struct AdvRoute		*AdvRouteList;
 	struct timer_lst	tm;
@@ -130,7 +133,7 @@
 struct HomeAgentInfo {
 	uint8_t			type;
 	uint8_t			length;
-	uint16_t		reserved;
+	uint16_t		flags_reserved;
 	int16_t			preference;
 	uint16_t		lifetime;
 };	
Index: radvdump.c
===================================================================
RCS file: /work/cvsroot/radvd/radvdump.c,v
retrieving revision 1.8
diff -u -r1.8 radvdump.c
--- radvdump.c	20 Jun 2004 17:52:41 -0000	1.8
+++ radvdump.c	28 Sep 2005 10:54:50 -0000
@@ -342,6 +342,9 @@
 			ha_info = (struct HomeAgentInfo *)opt_str;
 
 			printf("\tAdvHomeAgentInfo:\n");
+			/* NEMO ext */
+			printf("\t\tAdvMobRtrSupportFlag: %s\n",
+			       (ha_info->flags_reserved & ND_OPT_HAI_FLAG_SUPPORT_MR)?"on":"off");
 			printf("\t\tHomeAgentPreference: %hu", (unsigned short)ntohs(ha_info->preference));
 			printf("\n");
 			printf("\t\tHomeAgentLifetime: %hu", (unsigned short)ntohs(ha_info->lifetime));
@@ -475,10 +478,14 @@
 		case ND_OPT_HOME_AGENT_INFO:
 			ha_info = (struct HomeAgentInfo *)opt_str;
 
-			/* XXX: !DFLT depends on current DFLT_ value */
-			if (!edefs || !DFLT_AdvHomeAgentInfo)
+			/* XXX: we check DFLT_HomeAgentInfo by interface, and it's outside
+			   of context here, so we always need to print it out.. */
 			printf("\tAdvHomeAgentInfo on;\n");
 
+			/* NEMO ext */
+			if (!edefs || DFLT_AdvMobRtrSupportFlag != (ha_info->flags_reserved & ND_OPT_HAI_FLAG_SUPPORT_MR))
+				printf("\tAdvMobRtrSupportFlag %s;\n", (ha_info->flags_reserved & ND_OPT_HAI_FLAG_SUPPORT_MR)?"on":"off");
+
 			if (!edefs || DFLT_HomeAgentPreference != (unsigned short)ntohs(ha_info->preference))
 			printf("\tHomeAgentPreference %hu;\n", (unsigned short)ntohs(ha_info->preference));
 			/* Hum.. */
Index: scanner.l
===================================================================
RCS file: /work/cvsroot/radvd/scanner.l,v
retrieving revision 1.9
diff -u -r1.9 scanner.l
--- scanner.l	26 Oct 2004 05:30:34 -0000	1.9
+++ scanner.l	28 Sep 2005 10:54:50 -0000
@@ -80,6 +80,8 @@
 
 MinDelayBetweenRAs      { return T_MinDelayBetweenRAs; }
 
+AdvMobRtrSupportFlag	{ return T_AdvMobRtrSupportFlag; }
+
 {addr}		{
 			static struct in6_addr addr;
 			int i;
Index: send.c
===================================================================
RCS file: /work/cvsroot/radvd/send.c,v
retrieving revision 1.17
diff -u -r1.17 send.c
--- send.c	15 Feb 2005 08:32:06 -0000	1.17
+++ send.c	28 Sep 2005 10:54:50 -0000
@@ -218,13 +218,16 @@
 	 * Dynamic Home Agent Address Discovery
 	 */
 
-	if(iface->AdvHomeAgentInfo && (iface->HomeAgentPreference != 0 ||
-		iface->HomeAgentLifetime != iface->AdvDefaultLifetime))
+	if(iface->AdvHomeAgentInfo &&
+	   (iface->AdvMobRtrSupportFlag || iface->HomeAgentPreference != 0 ||
+	    iface->HomeAgentLifetime != iface->AdvDefaultLifetime))
+
 	{
 		struct HomeAgentInfo ha_info;
  		ha_info.type		= ND_OPT_HOME_AGENT_INFO;
 		ha_info.length		= 1;
-		ha_info.reserved	= 0;
+		ha_info.flags_reserved	=
+			(iface->AdvMobRtrSupportFlag)?ND_OPT_HAI_FLAG_SUPPORT_MR:0;
 		ha_info.preference	= htons(iface->HomeAgentPreference);
 		ha_info.lifetime	= htons(iface->HomeAgentLifetime);
 


More information about the radvd-devel-l mailing list