From eivind@aminor.no  Sat Sep 18 00:31:48 2004
Return-Path: <eivind@aminor.no>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C7C8B16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Sep 2004 00:31:48 +0000 (GMT)
Received: from vimes.aminor.no (vimes.aminor.no [213.187.177.2])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8C05843D39
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Sep 2004 00:31:47 +0000 (GMT)
	(envelope-from eivind@aminor.no)
Received: by vimes.aminor.no (Postfix, from userid 1001)
	id 7441517091; Sat, 18 Sep 2004 02:31:43 +0200 (CEST)
Message-Id: <20040918003143.7441517091@vimes.aminor.no>
Date: Sat, 18 Sep 2004 02:31:43 +0200 (CEST)
From: Eivind Olsen <eivind@aminor.no>
Reply-To: Eivind Olsen <eivind@aminor.no>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: RELENG_5 buildkernel problem with FAST_IPSEC + pf
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         71836
>Category:       kern
>Synopsis:       RELENG_5 buildkernel problem with FAST_IPSEC + pf
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mlaier
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 18 00:40:27 GMT 2004
>Closed-Date:    Thu Sep 30 21:11:25 GMT 2004
>Last-Modified:  Thu Sep 30 21:11:25 GMT 2004
>Originator:     Eivind Olsen
>Release:        FreeBSD 5.2.1-RELEASE-p9 i386
>Organization:
Aminor
>Environment:
System: FreeBSD vimes.eivind 5.2.1-RELEASE-p9 FreeBSD 5.2.1-RELEASE-p9 #0: Tue Jul 6 01:31:41 CEST 2004 root@vimes.eivind:/usr/obj/usr/src/sys/VIMES i386


	
>Description:
	Problems when trying to compile a RELENG_5 kernel which includes both FAST_IPSEC + pc
>How-To-Repeat:
First, I added the following lines to GENERIC, and the kernel compiled fine:

options               FAST_IPSEC      #new IPsec (cannot define w/ IPSEC)
device                crypto          # core crypto support
device                cryptodev       # /dev/crypto for access to h/w
device                rndtest         # FIPS 140-2 entropy tester
device                hifn            # Hifn 7951, 7781, etc.
options               HIFN_DEBUG      # enable debugging support:
hw.hifn.debug
options               HIFN_RNDTEST    # enable rndtest support

Then, I added:

device                pf              #PF OpenBSD packet-filter firewall
device                pflog           #logging support interface for PF
device                pfsync          #synchronization interface for PF

and I got the following error:

cc -c -O -pipe -march=pentium3 -Wall -Wredundant-decls -Wnested-externs -Wst
rict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  
-fformat-extensions -std=c99  -nostdinc -I-  -I. -I/usr/src/sys -I/usr/src/s
ys/contrib/dev/acpica -I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/ipf
ilter -I/usr/src/sys/contrib/pf -I/usr/src/sys/contrib/dev/ath -I/usr/src/sy
s/contrib/dev/ath/freebsd -I/usr/src/sys/contrib/ngatm -D_KERNEL -include
opt_global.h -fno-common -finline-limit=8000 --param
inline-unit-growth=100 --param
arge-function-growth=1000  -mno-align-long-strings -mpreferred-stack-boundar
y=2 -ffreestanding -Werror  /usr/src/sys/netinet/ip_id.c
cc -c -O -pipe -march=pentium3 -Wall -Wredundant-decls -Wnested-externs -Wst
rict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  
-fformat-extensions -std=c99  -nostdinc -I-  -I. -I/usr/src/sys -I/usr/src/s
ys/contrib/dev/acpica -I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/ipf
ilter -I/usr/src/sys/contrib/pf -I/usr/src/sys/contrib/dev/ath -I/usr/src/sy
s/contrib/dev/ath/freebsd -I/usr/src/sys/contrib/ngatm -D_KERNEL -include
opt_global.h -fno-common -finline-limit=8000 --param
inline-unit-growth=100 --param
arge-function-growth=1000  -mno-align-long-strings -mpreferred-stack-boundar
y=2 -ffreestanding -Werror  /usr/src/sys/netinet/in_pcb.c
cc -c -O -pipe -march=pentium3 -Wall -Wredundant-decls -Wnested-externs -Wst
rict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  
-fformat-extensions -std=c99  -nostdinc -I-  -I. -I/usr/src/sys -I/usr/src/s
ys/contrib/dev/acpica -I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/ipf
ilter -I/usr/src/sys/contrib/pf -I/usr/src/sys/contrib/dev/ath -I/usr/src/sy
s/contrib/dev/ath/freebsd -I/usr/src/sys/contrib/ngatm -D_KERNEL -include
opt_global.h -fno-common -finline-limit=8000 --param
inline-unit-growth=100 --param
arge-function-growth=1000  -mno-align-long-strings -mpreferred-stack-boundar
y=2 -ffreestanding -Werror  /usr/src/sys/netinet/in_proto.c
In file included from /usr/src/sys/netinet/in_proto.c:91:
/usr/src/sys/contrib/pf/net/pfvar.h:57: error: redefinition of `union
sockaddr_union'
*** Error code 1

Stop in /usr/obj/usr/src/sys/VIMES.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.

Finally, I commented out the FAST_IPSEC line, and the kernel compiled fine
again.
Looks like there might be something odd with pf + FAST_IPSEC? Or am I
misinterpreting things here?
	
>Fix:

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->mlaier 
Responsible-Changed-By: mlaier 
Responsible-Changed-When: Sat Sep 18 00:47:17 GMT 2004 
Responsible-Changed-Why:  
This one's mine (I am afraid). Seems that we need to move sockaddr_union in 
some globally reachable place ... :- 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71836 

From: Max Laier <max@love2party.net>
To: freebsd-gnats-submit@freebsd.org, eivind@aminor.no
Cc:  
Subject: Re: kern/71836: RELENG_5 buildkernel problem with FAST_IPSEC + pf
Date: Thu, 23 Sep 2004 02:06:02 +0200

 --Boundary-00=_sNhUBmFuQhsFC3t
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 Okay ... I resort to the easy: Add a protecting #define to both places and be 
 done. Diff attached or at: 
  http://people.freebsd.org/~mlaier/sockaddr_union.fix.diff
 
 -- 
  Max
 
 --Boundary-00=_sNhUBmFuQhsFC3t
 Content-Type: text/x-diff;
   charset="us-ascii";
   name="sockaddr_union.fix.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="sockaddr_union.fix.diff"
 
 Index: contrib/pf/net/pfvar.h
 ===================================================================
 RCS file: /usr/store/mlaier/fcvs/src/sys/contrib/pf/net/pfvar.h,v
 retrieving revision 1.8
 diff -u -r1.8 pfvar.h
 --- contrib/pf/net/pfvar.h	12 Aug 2004 13:59:44 -0000	1.8
 +++ contrib/pf/net/pfvar.h	23 Sep 2004 00:01:41 -0000
 @@ -49,16 +49,6 @@
  
  #ifdef __FreeBSD__
  #include <netinet/in.h>
 -/*
 - * XXX
 - *  If we include <netipsec/keydb.h>, we need _KERNEL definition.
 - *  This makes pfctl compilation difficult.
 - */
 -union sockaddr_union {
 -	struct sockaddr		sa;
 -	struct sockaddr_in	sin;
 -	struct sockaddr_in6	sin6;
 -};
  #endif
  
  #include <netinet/tcp_fsm.h>
 @@ -831,6 +821,15 @@
  #define	pfrts_name	pfrts_t.pfrt_name
  #define pfrts_flags	pfrts_t.pfrt_flags
  
 +#ifndef _SOCKADDR_UNION_DEFINED
 +#define	_SOCKADDR_UNION_DEFINED
 +union sockaddr_union {
 +	struct sockaddr		sa;
 +	struct sockaddr_in	sin;
 +	struct sockaddr_in6	sin6;
 +};
 +#endif /* _SOCKADDR_UNION_DEFINED */
 +
  SLIST_HEAD(pfr_kentryworkq, pfr_kentry);
  struct pfr_kentry {
  	struct radix_node	 pfrke_node[2];
 Index: netipsec/keydb.h
 ===================================================================
 RCS file: /usr/store/mlaier/fcvs/src/sys/netipsec/keydb.h,v
 retrieving revision 1.3
 diff -u -r1.3 keydb.h
 --- netipsec/keydb.h	29 Sep 2003 22:57:43 -0000	1.3
 +++ netipsec/keydb.h	22 Sep 2004 23:56:07 -0000
 @@ -37,6 +37,8 @@
  
  #include <netipsec/key_var.h>
  
 +#ifndef _SOCKADDR_UNION_DEFINED
 +#define	_SOCKADDR_UNION_DEFINED
  /*
   * The union of all possible address formats we handle.
   */
 @@ -45,6 +47,7 @@
  	struct sockaddr_in	sin;
  	struct sockaddr_in6	sin6;
  };
 +#endif /* _SOCKADDR_UNION_DEFINED */
  
  /* Security Assocciation Index */
  /* NOTE: Ensure to be same address family */
 
 --Boundary-00=_sNhUBmFuQhsFC3t--
State-Changed-From-To: open->closed 
State-Changed-By: mlaier 
State-Changed-When: Thu Sep 30 21:10:32 GMT 2004 
State-Changed-Why:  
Committed to CURRENT and RELENG_5, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71836 
>Unformatted:
