Patchset to fix ipfilter build breakage

Ruslan Ermilov ru at FreeBSD.org
Thu Apr 28 01:06:40 PDT 2005


Hi Darren,

On Wed, Apr 27, 2005 at 04:32:06PM +0000, Darren Reed wrote:
> On Tue, Apr 26, 2005 at 06:56:08PM +0300, Ruslan Ermilov wrote:
> > - rescue is still broken: the libipf library is a
> >   culprit -- it has a lot of undefined symbols that
> >   consumers are expected to provide, thus preventing
> >   it to be used in rescue.  When compiling a rescue
> >   binary, it fails with the following:
> ...
> 
> I've been thinking and discussing this.
> 
> Firstly, we don't need all the tools, just ipf should be ok.
> 
> So the trick then is to compile all of the libipf .o's into ipf.lo or
> link libipf.a into ipf.lo
> 
> How's that sound to you?  Can you please supply patch to fix that ? O:-)
> 
The attached patch does this, plus the following:

- removes NetBSD'ism from makefiles, such as including bsd.own.mk,
- fixes one of the compile warnings (easy one),
- adds NO_WERROR to sbin/ipf/Makefile.inc as there's still some
  number of compile warnings, most of them are real bugs on 64-bit
  platforms (see below),
- makes libipf an internal (compile-time only) library,

The unfixed warnings (on amd64) are:

: Script started on Thu Apr 28 10:24:07 2005
: 
: --------------------------------------------------------------
: >>> stage 4.4: building everything
: --------------------------------------------------------------
: ===> sbin/ipf (all)
: ===> sbin/ipf/libipf (all)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c: In function `printstate':
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 2)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 3)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 4)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 5)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 6)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 7)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 8)
: /usr/src/sbin/ipf/libipf/../../../contrib/ipfilter/lib/printstate.c:71: warning: long long int format, long unsigned int arg (arg 9)

Fixing the format specifiers to %qu doesn't work, I don't know if this is a bug or
not that %qu produces a warning when supplied a u_quad_t argument, but I see a
deprecation warning.  I think uint64_t should be used explicitly.

: ===> sbin/ipf/ipf (all)
: ===> sbin/ipf/ipfs (all)
: ===> sbin/ipf/ipfstat (all)
: ===> sbin/ipf/ipftest (all)
: /usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c: In function `fr_ipid_newfrag':
: /usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c:397: warning: cast to pointer from integer of different size
: /usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c: In function `fr_ipid_knownfrag':
: /usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c:582: warning: cast from pointer to integer of different size

This should be easy to fix.  These same (and only these) warnings also prevent the
ipf.ko from being compiled on amd64.

: ===> sbin/ipf/ipmon (all)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c: In function `print_statelog':
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 3)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 4)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 5)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 6)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 7)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 8)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 9)
: /usr/src/sbin/ipf/ipmon/../../../contrib/ipfilter/tools/ipmon.c:887: warning: long long int format, long unsigned int arg (arg 10)

This is like the above warning.

: ===> sbin/ipf/ipnat (all)
: ===> sbin/ipf/ippool (all)
: ===> sbin/ipf/ipresend (all)
: 
: Script done on Thu Apr 28 10:24:56 2005


Hope this helps,
-- 
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
Index: share/mk/sys.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/sys.mk,v
retrieving revision 1.84
diff -u -r1.84 sys.mk
--- share/mk/sys.mk	27 Apr 2005 14:13:55 -0000	1.84
+++ share/mk/sys.mk	28 Apr 2005 06:50:05 -0000
@@ -265,11 +265,6 @@
 .include "${__MAKE_CONF}"
 .endif
 
-# XXX Hack until IPFILTER is buildable again.
-.if !defined(WANT_IPFILTER)
-NO_IPFILTER=
-.endif
-
 # Default executable format
 # XXX hint for bsd.port.mk
 OBJFORMAT?=	elf
Index: contrib/ipfilter/tools/ippool.c
===================================================================
RCS file: /home/ncvs/src/contrib/ipfilter/tools/ippool.c,v
retrieving revision 1.2
diff -u -r1.2 ippool.c
--- contrib/ipfilter/tools/ippool.c	25 Apr 2005 18:20:15 -0000	1.2
+++ contrib/ipfilter/tools/ippool.c	28 Apr 2005 07:23:18 -0000
@@ -639,7 +639,7 @@
 		}
 
 	}
-	printf("%u object%s flushed\n", flush.iplf_count,
+	printf("%zd object%s flushed\n", flush.iplf_count,
 	       (flush.iplf_count == 1) ? "" : "s");
 
 	return 0;
Index: sbin/ipf/Makefile.inc
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/Makefile.inc,v
retrieving revision 1.1
diff -u -r1.1 Makefile.inc
--- sbin/ipf/Makefile.inc	25 Apr 2005 18:55:50 -0000	1.1
+++ sbin/ipf/Makefile.inc	28 Apr 2005 07:52:49 -0000
@@ -1,6 +1,6 @@
 #	$FreeBSD: src/sbin/ipf/Makefile.inc,v 1.1 2005/04/25 18:55:50 darrenr Exp $
 
-.include <bsd.own.mk>
+NO_WERROR=	# XXX
 
 CFLAGS+=	-I${.CURDIR}/../../../contrib/ipfilter
 CFLAGS+=	-I${.CURDIR}/../../../contrib/ipfilter/tools
@@ -8,9 +8,9 @@
 CFLAGS+=	-I${.CURDIR}/../../../sys/contrib/ipfilter
 CFLAGS+=	-DSTATETOP -D__UIO_EXPOSE
 
-IPFOBJDIR=	${.OBJDIR}/../libipf
-DPADD+=		${IPFOBJDIR}/libipf.a ${LIBKVM}
-LDADD+=		-L${IPFOBJDIR} -lipf -lkvm
+LIBIPF=		${.OBJDIR}/../libipf/libipf.a
+DPADD+=		${LIBIPF} ${LIBKVM}
+LDADD+=		${LIBIPF} -lkvm
 
 CLEANFILES+=	y.tab.c y.tab.h
 
@@ -19,6 +19,4 @@
 	${.CURDIR}/../../../contrib/ipfilter/tools	\
 	${.CURDIR}/../../../contrib/ipfilter/man
 
-.if exists(${.CURDIR}/../../Makefile.inc)
-.include "${.CURDIR}/../../Makefile.inc"
-.endif
+.include "../Makefile.inc"
Index: sbin/ipf/ipf/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/ipf/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sbin/ipf/ipf/Makefile	25 Apr 2005 18:55:50 -0000	1.1
+++ sbin/ipf/ipf/Makefile	28 Apr 2005 07:18:42 -0000
@@ -1,7 +1,5 @@
 #	$FreeBSD: src/sbin/ipf/ipf/Makefile,v 1.1 2005/04/25 18:55:50 darrenr Exp $
 
-.include <bsd.own.mk>		# for MKDYNAMICROOT definition
-
 PROG=		ipf
 SRCS=		ipf.c ipfcomp.c ipf_y.c ipf_l.c
 MAN=		ipf.8 ipf.4 ipf.5 ipl.4
@@ -14,7 +12,6 @@
 CLEANFILES+=	ipf_l.c ipf_l.h
 
 ipf_y.c: ipf_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -d ${.ALLSRC}
 	sed -e 's/yy/ipf_yy/g' \
 	    -e 's/"ipf_y.y"/"..\/tools\/ipf_y.y"/' \
@@ -25,20 +22,18 @@
 ipf_y.h: ipf_y.c
 
 ipf_l.c: lexer.c
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipf_yy/g' \
 	    -e 's/y.tab.h/ipf_y.h/' \
 	    -e 's/lexer.h/ipf_l.h/' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ipf_l.h: lexer.h
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipf_yy/g' \
 	    ${.ALLSRC} > ${.TARGET}
 
-BINDIR=		/sbin
-.if defined(NO_DYNAMICROOT)
-LDSTATIC?=	-static
+.if defined(RESCUE)
+LIBIPF_SRCS!=	cd ${.CURDIR}/../libipf && ${MAKE} -V SRCS
+SRCS+=	${LIBIPF_SRCS}
 .endif
 
 .include <bsd.prog.mk>
Index: sbin/ipf/ipftest/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/ipftest/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- sbin/ipf/ipftest/Makefile	26 Apr 2005 15:35:50 -0000	1.2
+++ sbin/ipf/ipftest/Makefile	28 Apr 2005 07:53:05 -0000
@@ -1,9 +1,5 @@
 #	$FreeBSD: src/sbin/ipf/ipftest/Makefile,v 1.2 2005/04/26 15:35:50 darrenr Exp $
 
-NOGCCERROR=	# defined
-
-.include <bsd.own.mk>
-
 PROG=		ipftest
 SRCS=		ipftest.c fil.c ip_frag.c ip_state.c ip_nat.c \
 		ip_proxy.c ip_auth.c ip_htable.c ip_lookup.c \
@@ -30,7 +26,6 @@
 CLEANFILES+=	ippool.tab.c ippool.tab.h
 
 ipnat_y.c: ipnat_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -b ipnat -d ${.ALLSRC}
 	sed -e 's/yy/ipnat_yy/g' \
 	    -e 's/y.tab.c/ipnat_y.c/' \
@@ -43,19 +38,16 @@
 ipnat_y.h: ipnat_y.c
 
 ipnat_l.c: lexer.c
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipnat_yy/g' \
 	    -e 's/y.tab.h/ipnat_y.h/' \
 	    -e 's/lexer.h/ipnat_l.h/' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ipnat_l.h: lexer.h
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipnat_yy/g' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ippool_y.c: ippool_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -b ippool -d ${.ALLSRC}
 	sed -e 's/yy/ippool_yy/g' \
 	    -e 's/"ippool_y.y"/"..\/tools\/ippool_y.y"/' \
@@ -66,19 +58,16 @@
 ippool_y.h: ippool_y.c
 
 ippool_l.c: lexer.c
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ippool_yy/g' \
 	    -e 's/y.tab.h/ippool_y.h/' \
 	    -e 's/lexer.h/ippool_l.h/' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ippool_l.h: lexer.h
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ippool_yy/g' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ipf_y.c: ipf_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -b ipf -d ${.ALLSRC}
 	sed -e 's/yy/ipf_yy/g' \
 	    -e 's/"ipf_y.y"/"..\/tools\/ipf_y.y"/' \
@@ -89,14 +78,12 @@
 ipf_y.h: ipf_y.c
 
 ipf_l.c: lexer.c
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipf_yy/g' \
 	     -e 's/y.tab.h/ipf_y.h/' \
 	     -e 's/lexer.h/ipf_l.h/' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ipf_l.h: lexer.h
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipf_yy/g' \
 	    ${.ALLSRC} > ${.TARGET}
 
Index: sbin/ipf/ipmon/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/ipmon/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sbin/ipf/ipmon/Makefile	25 Apr 2005 18:55:51 -0000	1.1
+++ sbin/ipf/ipmon/Makefile	28 Apr 2005 07:18:46 -0000
@@ -12,7 +12,6 @@
 CLEANFILES+=	ipmon_l.c ipmon_l.h
 
 ipmon_y.c: ipmon_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -d ${.ALLSRC}
 	sed -e 's/yy/ipmon_yy/g' \
 	    -e 's/"ipmon_y.y"/"..\/tools\/ipmon_y.y"/' \
@@ -23,14 +22,12 @@
 ipmon_y.h: ipmon_y.c
 
 ipmon_l.c: lexer.c
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipmon_yy/g' \
 	    -e 's/y.tab.h/ipmon_y.h/' \
 	    -e 's/lexer.h/ipmon_l.h/' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ipmon_l.h: lexer.h
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipmon_yy/g' \
 	    ${.ALLSRC} > ${.TARGET}
 
Index: sbin/ipf/ipnat/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/ipnat/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sbin/ipf/ipnat/Makefile	25 Apr 2005 18:55:51 -0000	1.1
+++ sbin/ipf/ipnat/Makefile	26 Apr 2005 14:52:06 -0000
@@ -12,7 +12,6 @@
 CLEANFILES+=	ipnat_l.c ipnat_l.h
 
 ipnat_y.c: ipnat_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -d ${.ALLSRC}
 	sed -e 's/yy/ipnat_yy/g' \
 	    -e 's/y.tab.c/ipnat_y.c/' \
@@ -25,14 +24,12 @@
 ipnat_y.h: ipnat_y.c
 
 ipnat_l.c: lexer.c
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipnat_yy/g' \
 	    -e 's/y.tab.h/ipnat_y.h/' \
 	    -e 's/lexer.h/ipnat_l.h/' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ipnat_l.h: lexer.h
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ipnat_yy/g' \
 	    ${.ALLSRC} > ${.TARGET}
 
Index: sbin/ipf/ippool/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/ippool/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sbin/ipf/ippool/Makefile	25 Apr 2005 18:55:51 -0000	1.1
+++ sbin/ipf/ippool/Makefile	28 Apr 2005 07:18:48 -0000
@@ -11,7 +11,6 @@
 CLEANFILES+=	ippool_l.c ippool_l.h
 
 ippool_y.c: ippool_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -d ${.ALLSRC}
 	sed -e 's/yy/ippool_yy/g' \
 	    -e 's/"ippool_y.y"/"..\/tools\/ippool_y.y"/' \
@@ -22,14 +21,12 @@
 ippool_y.h: ippool_y.c
 
 ippool_l.c: lexer.c
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ippool_yy/g' \
 	    -e 's/y.tab.h/ippool_y.h/' \
 	    -e 's/lexer.h/ippool_l.h/' \
 	    ${.ALLSRC} > ${.TARGET}
 
 ippool_l.h: lexer.h
-	${_MKTARGET_CREATE}
 	sed -e 's/yy/ippool_yy/g' \
 	    ${.ALLSRC} > ${.TARGET}
 
Index: sbin/ipf/ipresend/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/ipresend/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sbin/ipf/ipresend/Makefile	25 Apr 2005 18:55:51 -0000	1.1
+++ sbin/ipf/ipresend/Makefile	28 Apr 2005 07:52:26 -0000
@@ -1,7 +1,5 @@
 #	$FreeBSD: src/sbin/ipf/ipresend/Makefile,v 1.1 2005/04/25 18:55:51 darrenr Exp $
 
-.include <bsd.own.mk>
-
 PROG=		ipresend
 SRCS=		ipresend.c ip.c resend.c sbpf.c sock.c 44arp.c
 MAN=		ipresend.1
Index: sbin/ipf/ipsend/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/ipsend/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sbin/ipf/ipsend/Makefile	25 Apr 2005 18:55:51 -0000	1.1
+++ sbin/ipf/ipsend/Makefile	26 Apr 2005 14:52:13 -0000
@@ -23,7 +23,6 @@
 		${NETBSDSRCDIR}/dist/ipf/iplang
 
 iplang_y.c: iplang_y.y
-	${_MKTARGET_CREATE}
 	${YACC} -d ${.ALLSRC}
 	mv y.tab.c ${.TARGET}
 	mv y.tab.h ${.TARGET:.c=.h}
Index: sbin/ipf/libipf/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ipf/libipf/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sbin/ipf/libipf/Makefile	25 Apr 2005 18:55:52 -0000	1.1
+++ sbin/ipf/libipf/Makefile	28 Apr 2005 07:53:22 -0000
@@ -1,11 +1,7 @@
 #	$FreeBSD: src/sbin/ipf/libipf/Makefile,v 1.1 2005/04/25 18:55:52 darrenr Exp $
 
-MKPRIVATELIB=	yes
-USE_SHLIBDIR=	yes
-
-NOGCCERROR=	# defined
-
 LIB=		ipf
+INTERNALLIB=
 
 SRCS=		addicmp.c addipopt.c addkeep.c bcopywrap.c binprint.c \
 		buildopts.c checkrev.c count6bits.c count4bits.c debug.c \
Index: rescue/rescue/Makefile
===================================================================
RCS file: /home/ncvs/src/rescue/rescue/Makefile,v
retrieving revision 1.42
diff -u -r1.42 Makefile
--- rescue/rescue/Makefile	18 Mar 2005 12:55:07 -0000	1.42
+++ rescue/rescue/Makefile	28 Apr 2005 07:08:01 -0000
@@ -124,7 +124,7 @@
 .endif
 
 .if !defined(NO_IPFILTER)
-CRUNCH_PROGS_sbin+= ipf ipfs ipfstat ipmon ipnat
+CRUNCH_PROGS_sbin+= ipf
 .endif
 
 # crunchgen does not like C++ programs; this should be fixed someday
@@ -166,6 +166,7 @@
 CRUNCH_SRCDIR_fore_dnld= $(.CURDIR)/../../sbin/atm/fore_dnld
 CRUNCH_SRCDIR_ilmid= $(.CURDIR)/../../sbin/atm/ilmid
 CRUNCH_SRCDIR_rtquery= $(.CURDIR)/../../sbin/routed/rtquery
+CRUNCH_SRCDIR_ipf= $(.CURDIR)/../../sbin/ipf/ipf
 CRUNCH_ALIAS_reboot= fastboot halt fasthalt
 CRUNCH_ALIAS_restore= rrestore
 CRUNCH_ALIAS_dump= rdump
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050428/1baba238/attachment-0001.bin


More information about the freebsd-current mailing list