Subject: Re: cannot compile current kernel
To: Arto Selonen <arto+dated+1138175414.d63599bb71e2248d@selonen.org>
From: Kurt Schreiner <ks@ub.uni-mainz.de>
List: current-users
Date: 01/25/2006 11:48:18
--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

On Wed, Jan 25, 2006 at 09:49:09AM +0200, Arto Selonen wrote:
> 
> #   compile  BLAH/vers.o
> /obj/i386/tools/bin/i386--netbsdelf-gcc   -ffreestanding   -O2 -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 
> -Di386 -I.
> -I/cvs/src/sys/arch 
> -I/cvs/src/sys -nostdinc -DLKM -DDIAGNOSTIC -DDEBUG -DMAXUSERS=64 -D_KERNEL 
> -D_KERNEL_OPT -I/cvs/src/sys/lib/libkern/../../../common/lib/libc/quad 
> -I/cvs/src/sys/lib/libkern/../../../common/lib/libc/string 
> -I/cvs/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string
> -I/cvs/src/sys/dist/ipf  -c vers.c
> #      link  BLAH/netbsd
> /obj/i386/tools/bin/i386--netbsdelf-ld -T
> /cvs/src/sys/arch/i386/conf/kern.ldscript -Ttext c0100000
> -e start -X -o netbsd ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
> key.o(.text+0x5bf): In function `key_allocsa':
> : undefined reference to `sa6_recoverscope'
The same happend here...

> There were no changes to the kernel config, and the build was done on a 
> 3.99.10 system, where a similar build succeeded with the same kernel 
> config on Jan 18th, and started failing this Monday (Jan 23rd). My 
> *guess* is that the recent ipv6 changes may have something to do with 
> this, ie. http://mail-index.netbsd.org/source-changes/2006/01/21/0000.html
Yep, compiles for me with the attached patch to src/sys/netkey/key.c
Maybe I've put some more #ifdef INET6's in than really needed...

Kurt

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=netkey-diff

--- /u/NetBSD/src/sys/netkey/key.c	2006-01-22 16:47:25.000000000 +0100
+++ /u/NetBSD/lsrc/sys/netkey/key.c	2006-01-22 17:36:37.000000000 +0100
@@ -756,7 +756,10 @@
 	struct secasvar *sav, *match;
 	u_int stateidx, state, tmpidx, matchidx;
 	struct sockaddr_in sin;
+
+#ifdef INET6
 	struct sockaddr_in6 sin6;
+#endif
 	int s;
 	int chkport = 0;
 
@@ -815,6 +818,7 @@
 				continue;
 
 			break;
+#ifdef INET6
 		case AF_INET6:
 			bzero(&sin6, sizeof(sin6));
 			sin6.sin6_family = AF_INET6;
@@ -831,6 +835,7 @@
 			    chkport) != 0)
 				continue;
 			break;
+#endif
 		default:
 			ipseclog((LOG_DEBUG, "key_allocsa: "
 			    "unknown address family=%d.\n",
@@ -856,6 +861,7 @@
 				continue;
 
 			break;
+#ifdef INET6
 		case AF_INET6:
 			bzero(&sin6, sizeof(sin6));
 			sin6.sin6_family = AF_INET6;
@@ -872,6 +878,7 @@
 			    chkport) != 0)
 				continue;
 			break;
+#endif
 		default:
 			ipseclog((LOG_DEBUG, "key_allocsa: "
 			    "unknown address family=%d.\n", family));
@@ -1790,12 +1797,14 @@
 					return key_senderror(so, m, EINVAL);
 				}
 				break;
+#ifdef INET6
 			case AF_INET6:
 				if (((struct sockaddr_in6 *)sa)->sin6_port) {
 					keydb_delsecpolicy(newsp);
 					return key_senderror(so, m, EINVAL);
 				}
 				break;
+#endif
 			default:
 				break;
 			}
@@ -1807,11 +1816,13 @@
 					return key_senderror(so, m, EINVAL);
 				}
 				break;
+#ifdef INET6
 			case AF_INET6:
 				if (((struct sockaddr_in6 *)sa)->sin6_port) {
 					keydb_delsecpolicy(newsp);
 					return key_senderror(so, m, EINVAL);
 				}
+#endif
 				break;
 			default:
 				break;
@@ -3825,9 +3836,11 @@
 		case AF_INET:
 			prefixlen = sizeof(struct in_addr) << 3;
 			break;
+#ifdef INET6
 		case AF_INET6:
 			prefixlen = sizeof(struct in6_addr) << 3;
 			break;
+#endif
 		default:
 			; /*XXX*/
 		}
@@ -4486,6 +4499,7 @@
 		    (caddr_t)&satosin(&spidx1->src)->sin_addr, spidx0->prefs))
 			return 0;
 		break;
+#ifdef INET6
 	case AF_INET6:
 		if (satosin6(&spidx0->src)->sin6_port != IPSEC_PORT_ANY &&
 		    satosin6(&spidx0->src)->sin6_port !=
@@ -4504,6 +4518,7 @@
 		    (caddr_t)&satosin6(&spidx1->src)->sin6_addr, spidx0->prefs))
 			return 0;
 		break;
+#endif
 	default:
 		/* XXX */
 		if (bcmp(&spidx0->src, &spidx1->src, spidx0->src.ss_len) != 0)
@@ -4521,6 +4536,7 @@
 		    (caddr_t)&satosin(&spidx1->dst)->sin_addr, spidx0->prefd))
 			return 0;
 		break;
+#ifdef INET6
 	case AF_INET6:
 		if (satosin6(&spidx0->dst)->sin6_port != IPSEC_PORT_ANY &&
 		    satosin6(&spidx0->dst)->sin6_port !=
@@ -4539,6 +4555,7 @@
 		    (caddr_t)&satosin6(&spidx1->dst)->sin6_addr, spidx0->prefd))
 			return 0;
 		break;
+#endif
 	default:
 		/* XXX */
 		if (bcmp(&spidx0->dst, &spidx1->dst, spidx0->dst.ss_len) != 0)
@@ -4572,6 +4589,7 @@
 		if (port && satosin(sa1)->sin_port != satosin(sa2)->sin_port)
 			return 1;
 		break;
+#ifdef INET6
 	case AF_INET6:
 		if (sa1->sa_len != sizeof(struct sockaddr_in6))
 			return 1;	/*EINVAL*/
@@ -4588,6 +4606,7 @@
 			return 1;
 		}
 		break;
+#endif
 	default:
 		if (bcmp(sa1, sa2, sa1->sa_len) != 0)
 			return 1;
@@ -7759,6 +7778,7 @@
 				goto senderror;
 			}
 			break;
+#ifdef INET6
 		case AF_INET6:
 			if (PFKEY_ADDR_SADDR(src0)->sa_len !=
 			    sizeof(struct sockaddr_in6)) {
@@ -7766,7 +7786,6 @@
 				error = EINVAL;
 				goto senderror;
 			}
-#ifdef INET6
 			/*
 			 * Check validity of the scope zone ID of the
 			 * addresses, and embed the zone ID into the address
@@ -7792,9 +7811,11 @@
 		case AF_INET:
 			plen = sizeof(struct in_addr) << 3;
 			break;
+#ifdef INET6
 		case AF_INET6:
 			plen = sizeof(struct in6_addr) << 3;
 			break;
+#endif
 		default:
 			plen = 0;	/*fool gcc*/
 			break;

--NzB8fVQJ5HfG6fxh--