1997-02-09 22:50:16 +00:00
|
|
|
#
|
2000-05-24 02:14:22 +00:00
|
|
|
# Copyright (C) 1993-2000 by Darren Reed.
|
1997-02-09 22:50:16 +00:00
|
|
|
#
|
1997-11-16 04:52:19 +00:00
|
|
|
# Redistribution and use in source and binary forms are permitted
|
|
|
|
# provided that this notice is preserved and due credit is given
|
|
|
|
# to the original author and the contributors.
|
1997-02-09 22:50:16 +00:00
|
|
|
#
|
2000-07-19 13:52:47 +00:00
|
|
|
# $Id: Makefile,v 2.11.2.2 2000/07/18 13:58:10 darrenr Exp $
|
1997-02-09 22:50:16 +00:00
|
|
|
#
|
1997-05-25 15:45:04 +00:00
|
|
|
BINDEST=/usr/local/bin
|
|
|
|
SBINDEST=/sbin
|
|
|
|
MANDIR=/usr/local/man
|
1997-04-03 10:22:02 +00:00
|
|
|
#To test prototyping
|
1999-11-08 20:51:23 +00:00
|
|
|
CC=gcc -Wstrict-prototypes -Wmissing-prototypes
|
|
|
|
#CC=gcc
|
1998-03-21 10:04:55 +00:00
|
|
|
#CC=cc -Dconst=
|
1997-02-09 22:50:16 +00:00
|
|
|
DEBUG=-g
|
2000-05-24 02:14:22 +00:00
|
|
|
CFLAGS=-I$$(TOP) -g
|
1997-04-03 10:22:02 +00:00
|
|
|
CPU=`uname -m`
|
1997-11-16 04:52:19 +00:00
|
|
|
CPUDIR=`uname -s|sed -e 's@/@@g'`-`uname -r`-`uname -m`
|
1997-02-09 22:50:16 +00:00
|
|
|
#
|
|
|
|
# To enable this to work as a Loadable Kernel Module...
|
|
|
|
#
|
|
|
|
IPFLKM=-DIPFILTER_LKM
|
|
|
|
#
|
|
|
|
# To enable logging of blocked/passed packets...
|
|
|
|
#
|
|
|
|
IPFLOG=-DIPFILTER_LOG
|
|
|
|
#
|
|
|
|
# The facility you wish to log messages from ipmon to syslogd with.
|
|
|
|
#
|
|
|
|
LOGFAC=-DLOGFAC=LOG_LOCAL0
|
2000-05-24 02:14:22 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Uncomment the next 3 lines if you want to view the state table a la top(1)
|
|
|
|
# (requires that you have installed ncurses).
|
|
|
|
#STATETOP_CFLAGS=-DSTATETOP
|
|
|
|
#
|
|
|
|
# Where to find the ncurses include files (if not in default path),
|
|
|
|
#
|
|
|
|
#STATETOP_INC=
|
|
|
|
#STATETOP_INC=-I/usr/local/include
|
|
|
|
#
|
|
|
|
# How to link the ncurses library
|
|
|
|
#
|
|
|
|
#STATETOP_LIB=-lncurses
|
|
|
|
#STATETOP_LIB=-L/usr/local/lib -lncurses
|
|
|
|
|
|
|
|
#
|
|
|
|
# Uncomment this when building IPv6 capability.
|
|
|
|
#
|
|
|
|
#INET6=-DUSE_INET6
|
1997-02-09 22:50:16 +00:00
|
|
|
#
|
|
|
|
# For packets which don't match any pass rules or any block rules, set either
|
|
|
|
# FR_PASS or FR_BLOCK (respectively). It defaults to FR_PASS if left
|
|
|
|
# undefined. This is ignored for ipftest, which can thus return three
|
|
|
|
# results: pass, block and nomatch. This is the sort of "block unless
|
|
|
|
# explicitly allowed" type #define switch.
|
|
|
|
#
|
1997-03-02 15:40:21 +00:00
|
|
|
POLICY=-DIPF_DEFAULT_PASS=FR_PASS
|
1997-02-09 22:50:16 +00:00
|
|
|
#
|
2000-05-24 02:14:22 +00:00
|
|
|
MFLAGS1='CFLAGS=$(CFLAGS) $(ARCHINC) $(SOLARIS2) $(INET6)' \
|
1997-02-09 22:50:16 +00:00
|
|
|
"IPFLOG=$(IPFLOG)" "LOGFAC=$(LOGFAC)" "POLICY=$(POLICY)" \
|
1997-11-16 04:52:19 +00:00
|
|
|
"SOLARIS2=$(SOLARIS2)" "DEBUG=$(DEBUG)" "DCPU=$(CPU)" \
|
2000-05-24 02:14:22 +00:00
|
|
|
"CPUDIR=$(CPUDIR)" 'STATETOP_CFLAGS=$(STATETOP_CFLAGS)' \
|
|
|
|
'STATETOP_INC=$(STATETOP_INC)' 'STATETOP_LIB=$(STATETOP_LIB)'
|
|
|
|
DEST="BINDEST=$(BINDEST)" "SBINDEST=$(SBINDEST)" "MANDIR=$(MANDIR)"
|
1999-11-08 20:51:23 +00:00
|
|
|
MFLAGS=$(MFLAGS1) "IPFLKM=$(IPFLKM)"
|
1997-11-16 04:52:19 +00:00
|
|
|
#
|
|
|
|
SHELL=/bin/sh
|
1997-02-09 22:50:16 +00:00
|
|
|
#
|
|
|
|
########## ########## ########## ########## ########## ########## ##########
|
|
|
|
#
|
|
|
|
CP=/bin/cp
|
|
|
|
RM=/bin/rm
|
|
|
|
CHMOD=/bin/chmod
|
|
|
|
INSTALL=install
|
|
|
|
#
|
|
|
|
|
|
|
|
all:
|
|
|
|
@echo "Chose one of the following targets for making IP filter:"
|
|
|
|
@echo ""
|
1999-11-08 20:51:23 +00:00
|
|
|
@echo "solaris - auto-selects SunOS4.1.x/Solaris 2.3-6/Solaris2.4-6x86"
|
1997-11-16 04:52:19 +00:00
|
|
|
@echo "netbsd - compile for NetBSD"
|
|
|
|
@echo "openbsd - compile for OpenBSD"
|
|
|
|
@echo "freebsd - compile for FreeBSD 2.0, 2.1 or earlier"
|
|
|
|
@echo "freebsd22 - compile for FreeBSD-2.2 or greater"
|
1999-11-08 20:51:23 +00:00
|
|
|
@echo "freebsd3 - compile for FreeBSD-3.x"
|
2000-05-24 02:14:22 +00:00
|
|
|
@echo "freebsd4 - compile for FreeBSD-4.x"
|
1997-11-16 04:52:19 +00:00
|
|
|
@echo "bsd - compile for generic 4.4BSD systems"
|
1997-02-09 22:50:16 +00:00
|
|
|
@echo "bsdi - compile for BSD/OS"
|
1997-11-16 04:52:19 +00:00
|
|
|
@echo "irix - compile for SGI IRIX"
|
1998-03-21 10:04:55 +00:00
|
|
|
@echo "linux - compile for Linux 2.0.31+"
|
1997-02-09 22:50:16 +00:00
|
|
|
@echo ""
|
|
|
|
|
|
|
|
tests:
|
|
|
|
@if [ -d test ]; then (cd test; make) \
|
|
|
|
else echo test directory not present, sorry; fi
|
|
|
|
|
1997-05-25 15:45:04 +00:00
|
|
|
include:
|
1999-11-08 20:51:23 +00:00
|
|
|
if [ ! -f netinet/done ] ; then \
|
|
|
|
(cd netinet; ln -s ../*.h .; ln -s ../ip_ftp_pxy.c .; ln -s ../ip_rcmd_pxy.c .; ln -s ../ip_raudio_pxy.c .); \
|
1997-11-16 04:52:19 +00:00
|
|
|
(cd netinet; ln -s ../ipsend/tcpip.h tcpip.h); \
|
|
|
|
touch netinet/done; \
|
|
|
|
fi
|
1997-05-25 15:45:04 +00:00
|
|
|
|
|
|
|
sunos solaris: include
|
1997-02-09 22:50:16 +00:00
|
|
|
./buildsunos
|
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
freebsd22: include
|
1997-11-16 04:52:19 +00:00
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
|
|
|
-rm -f BSD/$(CPUDIR)/ioconf.h
|
1997-05-25 15:45:04 +00:00
|
|
|
@if [ -n $(IPFILKERN) ] ; then \
|
1999-11-08 20:51:23 +00:00
|
|
|
if [ -f /sys/compile/$(IPFILKERN)/ioconf.h ] ; then \
|
|
|
|
ln -s /sys/compile/$(IPFILKERN)/ioconf.h BSD/$(CPUDIR); \
|
1998-06-20 18:29:38 +00:00
|
|
|
else \
|
1997-11-16 04:52:19 +00:00
|
|
|
ln -s /sys/$(IPFILKERN)/ioconf.h BSD/$(CPUDIR); \
|
1998-06-20 18:29:38 +00:00
|
|
|
fi \
|
1997-05-25 15:45:04 +00:00
|
|
|
elif [ ! -f `uname -v|sed -e 's@^.*:\(/[^: ]*\).*@\1@'`/ioconf.h ] ; then \
|
|
|
|
echo -n "Can't find ioconf.h in "; \
|
|
|
|
echo `uname -v|sed -e 's@^.*:\(/[^: ]*\).*@\1@'`; \
|
1997-04-03 10:22:02 +00:00
|
|
|
exit 1;\
|
1997-05-25 15:45:04 +00:00
|
|
|
else \
|
|
|
|
ln -s `uname -v|sed -e 's@^.*:\(/[^: ]*\).*@\1@'`/ioconf.h BSD/$(CPU) ; \
|
1997-04-03 10:22:02 +00:00
|
|
|
fi
|
1997-05-25 15:45:04 +00:00
|
|
|
make freebsd
|
|
|
|
|
2000-05-24 02:14:22 +00:00
|
|
|
freebsd4: include
|
2000-07-19 13:52:47 +00:00
|
|
|
if [ x$INET6 = x ] ; then \
|
|
|
|
echo "#undef INET6" > opt_inet6.h; \
|
|
|
|
else \
|
|
|
|
echo "#define INET6" > opt_inet6.h; \
|
|
|
|
fi
|
2000-05-24 02:14:22 +00:00
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
|
|
|
(cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) "ML=mlfk_ipl.c" "MLD=mlfk_ipl.c" "LKM=ipf.ko" "DLKM=-DKLD_MODULE"; cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS1); cd ..)
|
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
freebsd3 freebsd30: include
|
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
|
|
|
(cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS1) "ML=mlf_ipl.c" LKM= ; cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS1); cd ..)
|
|
|
|
|
1997-05-25 15:45:04 +00:00
|
|
|
netbsd: include
|
1997-11-16 04:52:19 +00:00
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
1998-06-20 18:29:38 +00:00
|
|
|
(cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) 'DLKM=-D_LKM' "ML=mln_ipl.c"; cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
|
1997-11-16 04:52:19 +00:00
|
|
|
|
|
|
|
openbsd openbsd21: include
|
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
1998-06-20 18:29:38 +00:00
|
|
|
(cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) 'DLKM=-D_LKM' "ML=mln_ipl.c"; cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
|
1997-05-25 15:45:04 +00:00
|
|
|
|
|
|
|
freebsd freebsd20 freebsd21: include
|
1997-11-16 04:52:19 +00:00
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
1998-06-20 18:29:38 +00:00
|
|
|
(cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) "ML=mlf_ipl.c"; cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
|
1997-04-03 10:22:02 +00:00
|
|
|
|
1997-05-25 15:45:04 +00:00
|
|
|
bsd: include
|
1997-11-16 04:52:19 +00:00
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
1998-06-20 18:29:38 +00:00
|
|
|
(cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS); cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
|
1997-02-09 22:50:16 +00:00
|
|
|
|
1997-05-25 15:45:04 +00:00
|
|
|
bsdi bsdos: include
|
1997-11-16 04:52:19 +00:00
|
|
|
make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
|
1998-06-20 18:29:38 +00:00
|
|
|
(cd BSD/$(CPUDIR); make build "CC=$(CC)" TOP=../.. $(MFLAGS) LKM= ; cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend "CC=$(CC)" TOP=../.. $(MFLAGS); cd ..)
|
1997-11-16 04:52:19 +00:00
|
|
|
|
|
|
|
irix IRIX: include
|
|
|
|
make setup "TARGOS=IRIX" "CPUDIR=$(CPUDIR)"
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd IRIX/$(CPUDIR); smake build TOP=../.. $(DEST) $(MFLAGS); cd ..)
|
|
|
|
(cd IRIX/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(DEST) $(MFLAGS); cd ..)
|
1997-11-16 04:52:19 +00:00
|
|
|
|
|
|
|
linux: include
|
|
|
|
make setup "TARGOS=Linux" "CPUDIR=$(CPUDIR)"
|
|
|
|
./buildlinux
|
|
|
|
|
|
|
|
linuxrev:
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd Linux/$(CPUDIR); make build TOP=../.. $(DEST) $(MFLAGS) LKM= ; cd ..)
|
|
|
|
(cd Linux/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(DEST) $(MFLAGS); cd ..)
|
1997-11-16 04:52:19 +00:00
|
|
|
|
|
|
|
setup:
|
|
|
|
-if [ ! -d $(TARGOS)/$(CPUDIR) ] ; then mkdir $(TARGOS)/$(CPUDIR); fi
|
|
|
|
-rm -f $(TARGOS)/$(CPUDIR)/Makefile $(TARGOS)/$(CPUDIR)/Makefile.ipsend
|
|
|
|
-ln -s ../Makefile $(TARGOS)/$(CPUDIR)/Makefile
|
|
|
|
-ln -s ../Makefile.ipsend $(TARGOS)/$(CPUDIR)/Makefile.ipsend
|
1997-02-09 22:50:16 +00:00
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
clean: clean-include
|
1997-02-09 22:50:16 +00:00
|
|
|
${RM} -f core *.o ipt fils ipf ipfstat ipftest ipmon if_ipl \
|
2000-07-19 13:52:47 +00:00
|
|
|
vnode_if.h $(LKM) *~ opt_inet6.h
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd SunOS4; make clean)
|
|
|
|
(cd SunOS5; make clean)
|
1997-02-09 22:50:16 +00:00
|
|
|
(cd BSD; make clean)
|
1997-11-16 04:52:19 +00:00
|
|
|
(cd Linux; make clean)
|
|
|
|
if [ "`uname -s`" = "IRIX" ]; then (cd IRIX; make clean); fi
|
1997-02-09 22:50:16 +00:00
|
|
|
[ -d test ] && (cd test; make clean)
|
|
|
|
(cd ipsend; make clean)
|
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
clean-include:
|
|
|
|
sh -c 'cd netinet; for i in *; do if [ -h $$i ] ; then /bin/rm -f $$i; fi; done'
|
|
|
|
${RM} -f netinet/done
|
|
|
|
|
|
|
|
clean-bsd: clean-include
|
1997-02-09 22:50:16 +00:00
|
|
|
(cd BSD; make clean)
|
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
clean-sunos4: clean-include
|
1997-02-09 22:50:16 +00:00
|
|
|
(cd SunOS4; make clean)
|
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
clean-sunos5: clean-include
|
1997-02-09 22:50:16 +00:00
|
|
|
(cd SunOS5; make clean)
|
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
clean-irix: clean-include
|
1997-11-16 04:52:19 +00:00
|
|
|
(cd IRIX; make clean)
|
|
|
|
|
1999-11-08 20:51:23 +00:00
|
|
|
clean-linux: clean-include
|
1997-11-16 04:52:19 +00:00
|
|
|
(cd Linux; make clean)
|
|
|
|
|
1997-02-09 22:50:16 +00:00
|
|
|
get:
|
|
|
|
-@for i in ipf.c ipt.h solaris.c ipf.h kmem.c ipft_ef.c linux.h \
|
|
|
|
ipft_pc.c fil.c ipft_sn.c mln_ipl.c fils.c ipft_td.c \
|
|
|
|
mls_ipl.c ip_compat.h ipl.h opt.c ip_fil.c ipl_ldev.c \
|
|
|
|
parse.c ip_fil.h ipmon.c pcap.h ip_sfil.c ipt.c snoop.h \
|
|
|
|
ip_state.c ip_state.h ip_nat.c ip_nat.h ip_frag.c \
|
|
|
|
ip_frag.h ip_sfil.c misc.c; do \
|
|
|
|
if [ ! -f $$i ] ; then \
|
|
|
|
echo "getting $$i"; \
|
|
|
|
sccs get $$i; \
|
|
|
|
fi \
|
|
|
|
done
|
|
|
|
|
1997-04-03 10:22:02 +00:00
|
|
|
sunos4 solaris1:
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd SunOS4; make build TOP=.. "CC=$(CC)" $(DEST) $(MFLAGS); cd ..)
|
|
|
|
(cd SunOS4; make -f Makefile.ipsend "CC=$(CC)" TOP=.. $(DEST) $(MFLAGS); cd ..)
|
1997-04-03 10:22:02 +00:00
|
|
|
|
|
|
|
sunos5 solaris2:
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd SunOS5/$(CPUDIR); make build TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS) "SOLARIS2=$(SOLARIS2)" "CPU=-Dsparc -D__sparc__"; cd ..)
|
|
|
|
(cd SunOS5/$(CPUDIR); make -f Makefile.ipsend TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS); cd ..)
|
1997-04-03 10:22:02 +00:00
|
|
|
|
|
|
|
sunos5x86 solaris2x86:
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd SunOS5/$(CPUDIR); make build TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS) "SOLARIS2=$(SOLARIS2)" "CPU=-Di86pc -Di386 -D__i386__"; cd ..)
|
|
|
|
(cd SunOS5/$(CPUDIR); make -f Makefile.ipsend TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS); cd ..)
|
1998-06-20 18:29:38 +00:00
|
|
|
|
|
|
|
install-linux:
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd Linux/$(CPUDIR); make install "TOP=../.." $(DEST) $(MFLAGS); cd ..)
|
|
|
|
(cd Linux/$(CPUDIR); make -f Makefile.ipsend INSTALL=$(INSTALL) install "TOP=../.." $(DEST) $(MFLAGS); cd ..)
|
1997-04-03 10:22:02 +00:00
|
|
|
|
1997-11-16 04:52:19 +00:00
|
|
|
install-bsd:
|
|
|
|
(cd BSD/$(CPUDIR); make install "TOP=../.." $(MFLAGS); cd ..)
|
|
|
|
(cd BSD/$(CPUDIR); make -f Makefile.ipsend INSTALL=$(INSTALL) install "TOP=../.." $(MFLAGS); cd ..)
|
1997-05-25 15:45:04 +00:00
|
|
|
|
1997-02-09 22:50:16 +00:00
|
|
|
install-sunos4: solaris
|
1997-04-03 10:22:02 +00:00
|
|
|
(cd SunOS4; $(MAKE) "CPU=$(CPU) TOP=.." install)
|
1997-05-25 15:45:04 +00:00
|
|
|
|
1997-02-09 22:50:16 +00:00
|
|
|
install-sunos5: solaris
|
1997-04-03 10:22:02 +00:00
|
|
|
(cd SunOS5; $(MAKE) "CPU=$(CPU) TOP=.." install)
|
1997-02-09 22:50:16 +00:00
|
|
|
|
1997-11-16 04:52:19 +00:00
|
|
|
install-irix: irix
|
2000-05-24 02:14:22 +00:00
|
|
|
(cd IRIX; smake install "CPU=$(CPU) TOP=.." $(DEST) $(MFLAGS))
|
1997-11-16 04:52:19 +00:00
|
|
|
|
1997-02-09 22:50:16 +00:00
|
|
|
rcsget:
|
|
|
|
-@for i in ipf.c ipt.h solaris.c ipf.h kmem.c ipft_ef.c linux.h \
|
|
|
|
ipft_pc.c fil.c ipft_sn.c mln_ipl.c fils.c ipft_td.c \
|
|
|
|
mls_ipl.c ip_compat.h ipl.h opt.c ip_fil.c ipl_ldev.c \
|
|
|
|
parse.c ip_fil.h ipmon.c pcap.h ip_sfil.c ipt.c snoop.h \
|
|
|
|
ip_state.c ip_state.h ip_nat.c ip_nat.h ip_frag.c \
|
|
|
|
ip_frag.h ip_sfil.c misc.c; do \
|
|
|
|
if [ ! -f $$i ] ; then \
|
|
|
|
echo "getting $$i"; \
|
|
|
|
co $$i; \
|
|
|
|
fi \
|
|
|
|
done
|
|
|
|
|
|
|
|
do-cvs:
|
|
|
|
find . -type d -name CVS -print | xargs /bin/rm -rf
|
|
|
|
find . -type f -name .cvsignore -print | xargs /bin/rm -f
|