Subject: kern/33015: jornada720 kernel doesn't compile in in6 ( all arm32 target probably won't compile with INET6)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <degroote@enseirb.fr>
List: netbsd-bugs
Date: 03/06/2006 20:35:00
>Number:         33015
>Category:       kern
>Synopsis:       jornada720 kernel doesn't compile in in6 ( all arm32 target probably won't compile with INET6)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 06 20:35:00 +0000 2006
>Originator:     arnaud degroote
>Release:        current
>Organization:
>Environment:
NetBSD Hermes.at.home 3.99.16 NetBSD 3.99.16 (HERMES) #1: Sun Mar  5 22:23:51 CET 2006  zul@Hermes.at.home:/usr/build_tmp/objdir/sys/arch/i386/compile/HERMES i386
>Description:
I try to crosscompile a jornada720 kernel with ipv6 ( with the last revision of in6.c 1.98). There is a problem with a shadowed variable ( variable delay defined arch/arm32/param.h and in the function in6_update_ifa of in6.c). This is the error message :

/usr/build_tmp/tooldir/bin/arm--netbsdelf-gcc -ffreestanding -O2 -Wcomment -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-sign-compare -fno-zero-initialized-in-bss -Dhpcarm -Darm32 -I. -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DLKM -DCONSPEED=19200 -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/arm/string -c /usr/src/sys/netinet6/in6.c

/usr/src/sys/netinet6/in6.c: In function `in6_update_ifa':
/usr/src/sys/netinet6/in6.c:780: warning: declaration of `delay' shadows a global declaration
arm/arm32/param.h:120: warning: shadowed declaration is here
>How-To-Repeat:
/usr/src/build.sh -m hpcarm kernel=JORNADA720 for example 
>Fix:
The following patch solves the issues but maybe there is a better solution.

Index: in6.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/netinet6/in6.c,v
retrieving revision 1.98
diff -u -r1.98 in6.c
--- in6.c	5 Mar 2006 23:47:08 -0000	1.98
+++ in6.c	6 Mar 2006 20:30:24 -0000
@@ -777,7 +777,7 @@
 	struct in6_multi_mship *imm;
 	struct in6_multi *in6m_sol;
 	struct rtentry *rt;
-	int delay;
+	int in6_delay;
 
 	in6m_sol = NULL;
 
@@ -1062,7 +1062,7 @@
 			    "in6_setscope failed\n");
 			goto cleanup;
 		}
-		delay = 0;
+		in6_delay = 0;
 		if ((flags & IN6_IFAUPDATE_DADDELAY)) {
 			/*
 			 * We need a random delay for DAD on the address
@@ -1071,13 +1071,13 @@
 			 * avoid report collision.
 			 * [draft-ietf-ipv6-rfc2462bis-02.txt]
 			 */
-			delay = arc4random() %
+			in6_delay = arc4random() %
 			    (MAX_RTR_SOLICITATION_DELAY * hz);
 		}
 
 #define	MLTMASK_LEN  4	/* mltmask's masklen (=32bit=4octet) */
 		/* join solicited multicast addr for new host id */
-		imm = in6_joingroup(ifp, &llsol, &error, delay);
+		imm = in6_joingroup(ifp, &llsol, &error, in6_delay);
 		if (!imm) {
 			nd6log((LOG_ERR,
 			    "in6_update_ifa: addmulti "
@@ -1152,18 +1152,18 @@
 		/*
 		 * join node information group address
 		 */
-		delay = 0;
+		in6_delay = 0;
 		if ((flags & IN6_IFAUPDATE_DADDELAY)) {
 			/*
 			 * The spec doesn't say anything about delay for this
 			 * group, but the same logic should apply.
 			 */
-			delay = arc4random() %
+			in6_delay = arc4random() %
 			    (MAX_RTR_SOLICITATION_DELAY * hz);
 		}
 		if (in6_nigroup(ifp, hostname, hostnamelen, &mltaddr) == 0) {
 			imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error,
-			    delay); /* XXX jinmei */
+			    in6_delay); /* XXX jinmei */
 			if (!imm) {
 				nd6log((LOG_WARNING, "in6_update_ifa: "
 				    "addmulti failed for %s on %s (errno=%d)\n",
@@ -1239,7 +1239,7 @@
 	{
 		int mindelay, maxdelay;
 
-		delay = 0;
+		in6_delay = 0;
 		if ((flags & IN6_IFAUPDATE_DADDELAY)) {
 			/*
 			 * We need to impose a delay before sending an NS
@@ -1256,14 +1256,14 @@
 			}
 			maxdelay = MAX_RTR_SOLICITATION_DELAY * hz;
 			if (maxdelay - mindelay == 0)
-				delay = 0;
+				in6_delay = 0;
 			else {
-				delay =
+				in6_delay =
 				    (arc4random() % (maxdelay - mindelay)) +
 				    mindelay;
 			}
 		}
-		nd6_dad_start((struct ifaddr *)ia, delay);
+		nd6_dad_start((struct ifaddr *)ia, in6_delay);
 	}
 
 	return (error);