diff --git a/sbin/ipf/Makefile b/sbin/ipf/Makefile index 9c1af0eda726..df57c807a02b 100644 --- a/sbin/ipf/Makefile +++ b/sbin/ipf/Makefile @@ -1,18 +1,8 @@ -# $FreeBSD$ +# $FreeBSD$ -.PATH: ${.CURDIR}/../../contrib/ipfilter ${.CURDIR}/../../contrib/ipfilter/man +#.WAIT +SUBDIR= libipf +SUBDIR+= ipf ipfs ipfstat ipftest ipmon ipnat ippool ipresend +#SUBDIR+= ipsend iptest rules -PROG= ipf -MAN= ipf.4 ipf.5 ipf.8 -MLINKS= ipf.5 ipf.conf.5 \ - ipf.5 ipf6.conf.5 -SRCS= ipf.c parse.c opt.c facpri.c common.c -CFLAGS+=-DUSE_INET6 -DIPL_NAME=\"/dev/ipl\" -CFLAGS+=-I${.CURDIR}/../../sys/contrib/ipfilter/netinet -CFLAGS+=-I${.CURDIR}/../../sys/contrib/ipfilter -CFLAGS+=-I${.CURDIR}/../../contrib/ipfilter -WARNS?= 0 - -MAINTAINER= darrenr@freebsd.org - -.include +.include diff --git a/sbin/ipf/Makefile.inc b/sbin/ipf/Makefile.inc new file mode 100644 index 000000000000..41677b9bcc1f --- /dev/null +++ b/sbin/ipf/Makefile.inc @@ -0,0 +1,24 @@ +# $FreeBSD$ + +.include + +CFLAGS+= -I${.CURDIR}/../../../contrib/ipfilter +CFLAGS+= -I${.CURDIR}/../../../contrib/ipfilter/tools +CFLAGS+= -I${.CURDIR}/../../../sys +CFLAGS+= -I${.CURDIR}/../../../sys/contrib/ipfilter +CFLAGS+= -DSTATETOP -D__UIO_EXPOSE + +IPFOBJDIR= ${.OBJDIR}/../libipf +DPADD+= ${IPFOBJDIR}/libipf.a ${LIBKVM} +LDADD+= -L${IPFOBJDIR} -lipf -lkvm + +CLEANFILES+= y.tab.c y.tab.h + +.PATH: ${.CURDIR}/../../../contrib/ipfilter \ + ${.CURDIR}/../../../contrib/ipfilter/lib \ + ${.CURDIR}/../../../contrib/ipfilter/tools \ + ${.CURDIR}/../../../contrib/ipfilter/man + +.if exists(${.CURDIR}/../../Makefile.inc) +.include "${.CURDIR}/../../Makefile.inc" +.endif diff --git a/sbin/ipf/ipf/Makefile b/sbin/ipf/ipf/Makefile new file mode 100644 index 000000000000..fc8dfe798bf2 --- /dev/null +++ b/sbin/ipf/ipf/Makefile @@ -0,0 +1,44 @@ +# $FreeBSD$ + +.include # 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 +MLINKS= ipl.4 ipfilter.4 ipf.5 ipf.conf.5 ipf.5 ipf6.conf.5 +CFLAGS+= -I. + +DPSRCS+= ipf_l.h ipf_y.h + +CLEANFILES+= ipf_y.c ipf_y.h +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"/' \ + y.tab.c > ${.TARGET} + sed -e 's/yy/ipf_yy/g' \ + y.tab.h > ${.TARGET:.c=.h} + +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 +.endif + +.include diff --git a/sbin/ipf/ipfs/Makefile b/sbin/ipf/ipfs/Makefile new file mode 100644 index 000000000000..a64f805b2ab3 --- /dev/null +++ b/sbin/ipf/ipfs/Makefile @@ -0,0 +1,6 @@ +# $FreeBSD$ + +PROG= ipfs +MAN= ipfs.8 + +.include diff --git a/sbin/ipf/ipfstat/Makefile b/sbin/ipf/ipfstat/Makefile new file mode 100644 index 000000000000..a33c5df38d8f --- /dev/null +++ b/sbin/ipf/ipfstat/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +NOGCCERROR= # defined + +PROG= ipfstat +SRCS= ipfstat.c +MAN= ipfstat.8 +DPADD+= ${LIBCURSES} +LDADD+= -lcurses + +.include diff --git a/sbin/ipf/ipftest/Makefile b/sbin/ipf/ipftest/Makefile new file mode 100644 index 000000000000..b847b03c45bb --- /dev/null +++ b/sbin/ipf/ipftest/Makefile @@ -0,0 +1,103 @@ +# $FreeBSD$ + +NOGCCERROR= # defined + +.include + +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 \ + ip_pool.c ip_scan.c ip_sync.c ip_rules.c \ + ip_fil.c ip_log.c ippool_y.c ippool_l.c ipf_y.c \ + ipf_l.c ipnat_y.c ipnat_l.c md5.c radix.c bpf_filter.c +MAN= ipftest.1 + +CFLAGS+= -DIPFILTER_LOG -DIPFILTER_COMPILED -DIPFILTER_LOOKUP \ + -DIPFILTER_SCAN -DIPFILTER_SYNC -DIPFILTER_CKSUM -I. + +.PATH: ${NETBSDSRCDIR}/sys/netinet + +DPSRCS+= ipnat_l.h ipnat_y.h ippool_l.h ippool_y.h ipf_l.h ipf_y.h + +CLEANFILES+= ipf_y.c ipf_y.h +CLEANFILES+= ipf_l.c ipf_l.h +CLEANFILES+= ipf.tab.c ipf.tab.h +CLEANFILES+= ipnat_y.c ipnat_y.h +CLEANFILES+= ipnat_l.c ipnat_l.h +CLEANFILES+= ipnat.tab.c ipnat.tab.h +CLEANFILES+= ippool_y.c ippool_y.h +CLEANFILES+= ippool_l.c ippool_l.h +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/' \ + -e s/\"ipnat_y.y\"/\"..\\/tools\\/ipnat_y.y\"/ \ + ipnat.tab.c > ${.TARGET} + sed -e 's/yy/ipnat_yy/g' \ + -e 's/y.tab.h/ipnat_y.h/' \ + ipnat.tab.h > ${.TARGET:.c=.h} + +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"/' \ + ippool.tab.c > ${.TARGET} + sed -e 's/yy/ippool_yy/g' \ + ippool.tab.h > ${.TARGET:.c=.h} + +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"/' \ + ipf.tab.c > ${.TARGET} + sed -e 's/yy/ipf_yy/g' \ + ipf.tab.h > ${.TARGET:.c=.h} + +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} + +.include diff --git a/sbin/ipf/ipmon/Makefile b/sbin/ipf/ipmon/Makefile new file mode 100644 index 000000000000..8a71cb47e514 --- /dev/null +++ b/sbin/ipf/ipmon/Makefile @@ -0,0 +1,37 @@ +# $FreeBSD$ + +PROG= ipmon +SRCS= ipmon.c ipmon_y.c ipmon_l.c +MAN= ipmon.8 + +CFLAGS+= -DLOGFAC=LOG_LOCAL0 -I. + +DPSRCS+= ipmon_l.h ipmon_y.h + +CLEANFILES+= ipmon_y.c ipmon_y.h +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"/' \ + y.tab.c > ${.TARGET} + sed -e 's/yy/ipmon_yy/g' \ + y.tab.h > ${.TARGET:.c=.h} + +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} + +.include diff --git a/sbin/ipf/ipnat/Makefile b/sbin/ipf/ipnat/Makefile new file mode 100644 index 000000000000..03ac597538b5 --- /dev/null +++ b/sbin/ipf/ipnat/Makefile @@ -0,0 +1,39 @@ +# $FreeBSD$ + +PROG= ipnat +SRCS= ipnat.c ipnat_y.c ipnat_l.c +MAN= ipnat.8 ipnat.4 ipnat.5 +MLINKS= ipnat.5 ipnat.conf.5 +CFLAGS+= -I. + +DPSRCS+= ipnat_l.h ipnat_y.h + +CLEANFILES+= ipnat_y.c ipnat_y.h +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/' \ + -e s/\"ipnat_y.y\"/\"..\\/tools\\/ipnat_y.y\"/ \ + y.tab.c > ${.TARGET} + sed -e 's/yy/ipnat_yy/g' \ + -e 's/y.tab.h/ipnat_y.h/' \ + y.tab.h > ${.TARGET:.c=.h} + +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} + +.include diff --git a/sbin/ipf/ippool/Makefile b/sbin/ipf/ippool/Makefile new file mode 100644 index 000000000000..d1cf18ad605d --- /dev/null +++ b/sbin/ipf/ippool/Makefile @@ -0,0 +1,36 @@ +# $FreeBSD$ + +PROG= ippool +SRCS= ippool_y.c ippool_l.c kmem.c ippool.c +MAN= ippool.5 ippool.8 +CFLAGS+= -I. + +DPSRCS+= ippool_l.h ippool_y.h + +CLEANFILES+= ippool_y.c ippool_y.h +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"/' \ + y.tab.c > ${.TARGET} + sed -e 's/yy/ippool_yy/g' \ + y.tab.h > ${.TARGET:.c=.h} + +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} + +.include diff --git a/sbin/ipf/ipresend/Makefile b/sbin/ipf/ipresend/Makefile new file mode 100644 index 000000000000..9ce1454916e3 --- /dev/null +++ b/sbin/ipf/ipresend/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.include + +PROG= ipresend +SRCS= ipresend.c ip.c resend.c sbpf.c sock.c 44arp.c +MAN= ipresend.1 + +.PATH: ${.CURDIR}/../../../contrib/ipfilter/ipsend + +.include diff --git a/sbin/ipf/ipsend/Makefile b/sbin/ipf/ipsend/Makefile new file mode 100644 index 000000000000..f555c37d5f58 --- /dev/null +++ b/sbin/ipf/ipsend/Makefile @@ -0,0 +1,40 @@ +# $FreeBSD$ + +NOGCCERROR= # defined + +.include + +PROG= ipsend +SRCS= ipsend.c ip.c ipsopt.c iplang_y.c iplang_l.l sbpf.c \ + sock.c 44arp.c +MAN= ipsend.1 ipsend.5 +DPADD+= ${LIBL} +LDADD+= -ll + +CFLAGS+= -I${NETBSDSRCDIR}/dist/ipf/ipsend +CFLAGS+= -I${NETBSDSRCDIR}/dist/ipf/iplang +CFLAGS+= -I. + +CLEANFILES+= iplang_y.c iplang_y.h + +DPSRCS+= iplang_y.h + +.PATH: ${NETBSDSRCDIR}/dist/ipf/ipsend \ + ${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} + +iplang_y.h: iplang_y.c + +# XXX +# We have a problem with make and linking ipsend +# cc -o /home/source/src/usr.sbin/ipf/ipsend/../../../dist/ipf/ipsend ..... +# isn't correct. +# Use .NOPATH as an workaround for that problem +.NOPATH: ipsend + +.include diff --git a/sbin/ipf/iptest/Makefile b/sbin/ipf/iptest/Makefile new file mode 100644 index 000000000000..647471cf4cef --- /dev/null +++ b/sbin/ipf/iptest/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.include + +PROG= iptest +SRCS= iptest.c iptests.c ip.c sbpf.c sock.c 44arp.c +MAN= iptest.1 + +.PATH: ${NETBSDSRCDIR}/dist/ipf/ipsend + +.include diff --git a/sbin/ipf/libipf/Makefile b/sbin/ipf/libipf/Makefile new file mode 100644 index 000000000000..0f2f90cc2cdc --- /dev/null +++ b/sbin/ipf/libipf/Makefile @@ -0,0 +1,33 @@ +# $FreeBSD$ + +MKPRIVATELIB= yes +USE_SHLIBDIR= yes + +NOGCCERROR= # defined + +LIB= ipf + +SRCS= addicmp.c addipopt.c addkeep.c bcopywrap.c binprint.c \ + buildopts.c checkrev.c count6bits.c count4bits.c debug.c \ + extras.c facpri.c flags.c fill6bits.c genmask.c gethost.c \ + getifname.c getline.c getnattype.c getport.c getportproto.c \ + getproto.c getsumd.c hexdump.c hostmask.c hostname.c \ + hostnum.c icmpcode.c initparse.c ionames.c \ + ipoptsec.c ipf_dotuning.c ipft_ef.c ipft_hx.c ipft_pc.c \ + ipft_sn.c ipft_td.c ipft_tx.c kmem.c kmemcpywrap.c \ + kvatoname.c load_hash.c load_hashnode.c load_pool.c \ + load_poolnode.c loglevel.c make_range.c mutex_emul.c \ + nametokva.c nat_setgroupmap.c ntomask.c optname.c \ + optprint.c optprintv6.c optvalue.c portname.c portnum.c \ + ports.c print_toif.c printactivenat.c printaps.c printbuf.c \ + printhash.c printhashnode.c printip.c printpool.c \ + printpoolnode.c printfr.c printfraginfo.c printhostmap.c \ + printifname.c printhostmask.c printlog.c printmask.c \ + printnat.c printportcmp.c printpacket.c printpacket6.c \ + printsbuf.c printstate.c printtunable.c ratoi.c ratoui.c \ + remove_hash.c remove_hashnode.c remove_pool.c \ + remove_poolnode.c resetlexer.c rwlock_emul.c tcpflags.c \ + tcp_flags.c to_interface.c var.c verbose.c v6ionames.c \ + v6optvalue.c + +.include diff --git a/sbin/ipf/rules/Makefile b/sbin/ipf/rules/Makefile new file mode 100644 index 000000000000..a90907fc9853 --- /dev/null +++ b/sbin/ipf/rules/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.include + +MAN= mkfilters.1 +.if ${MKSHARE} != "no" +FILESDIR= /usr/share/examples/ipf + +FILES= BASIC.NAT BASIC_1.FW BASIC_2.FW example.1 example.2 example.3 \ + example.4 example.5 example.6 example.7 example.8 example.9 \ + example.10 example.11 example.12 example.13 example.sr \ + firewall ftp-proxy ftppxy mediaone nat-setup \ + nat.eg server tcpstate mkfilters +.endif + +.PATH: ${NETBSDSRCDIR}/dist/ipf/rules +.include