#!/bin/sh

###
###  ipf-purge - remove installed traces of IP Filter
###
###  usage:  ipf-purge
###
###  This script will remove installed traces of IP Filter from the system,
###  either the version bundled with FreeBSD or a version of IP Filter
###  installed by hand.  The main use of this script would be to clean out
###  the system version (say after a full "make world") so that IP Filter
###  can be cleanly installed later by hand.  All IP Filter system binaries,
###  header files, and kernel source files are removed.
###
###  Paul Hart <hart@iserver.com>


# first the FreeBSD system (as of 3.4-RELEASE) layout
for i in					\
    /sbin/ipf					\
    /usr/include/netinet/ip_auth.h		\
    /usr/include/netinet/ip_compat.h		\
    /usr/include/netinet/ip_fil.h		\
    /usr/include/netinet/ip_frag.h		\
    /usr/include/netinet/ip_nat.h		\
    /usr/include/netinet/ip_proxy.h		\
    /usr/include/netinet/ip_state.h		\
    /usr/include/netinet/ipl.h			\
    /usr/sbin/ipfstat				\
    /usr/sbin/ipftest				\
    /usr/sbin/ipmon				\
    /usr/sbin/ipnat				\
    /usr/sbin/ipresend				\
    /usr/sbin/ipsend				\
    /usr/sbin/iptest				\
    /usr/share/man/cat1/ipf.1.gz		\
    /usr/share/man/cat1/ipftest.1.gz		\
    /usr/share/man/cat1/ipnat.1.gz		\
    /usr/share/man/cat1/ipresend.1.gz		\
    /usr/share/man/cat1/ipsend.1.gz		\
    /usr/share/man/cat1/iptest.1.gz		\
    /usr/share/man/cat4/ipf.4.gz		\
    /usr/share/man/cat4/ipnat.4.gz		\
    /usr/share/man/cat5/ipf.5.gz		\
    /usr/share/man/cat5/ipnat.5.gz		\
    /usr/share/man/cat5/ipsend.5.gz		\
    /usr/share/man/cat8/ipfstat.8.gz		\
    /usr/share/man/cat8/ipmon.8.gz		\
    /usr/share/man/man1/ipf.1.gz		\
    /usr/share/man/man1/ipftest.1.gz		\
    /usr/share/man/man1/ipnat.1.gz		\
    /usr/share/man/man1/ipresend.1.gz		\
    /usr/share/man/man1/ipsend.1.gz		\
    /usr/share/man/man1/iptest.1.gz		\
    /usr/share/man/man4/ipf.4.gz		\
    /usr/share/man/man4/ipnat.4.gz		\
    /usr/share/man/man5/ipf.5.gz		\
    /usr/share/man/man5/ipnat.5.gz		\
    /usr/share/man/man5/ipsend.5.gz		\
    /usr/share/man/man8/ipfstat.8.gz		\
    /usr/share/man/man8/ipmon.8.gz		\
    /usr/src/sys/netinet/fil.c			\
    /usr/src/sys/netinet/ip_auth.c		\
    /usr/src/sys/netinet/ip_auth.h		\
    /usr/src/sys/netinet/ip_compat.h		\
    /usr/src/sys/netinet/ip_fil.c		\
    /usr/src/sys/netinet/ip_fil.h		\
    /usr/src/sys/netinet/ip_frag.c		\
    /usr/src/sys/netinet/ip_frag.h		\
    /usr/src/sys/netinet/ip_ftp_pxy.c		\
    /usr/src/sys/netinet/ip_log.c		\
    /usr/src/sys/netinet/ip_nat.c		\
    /usr/src/sys/netinet/ip_nat.h		\
    /usr/src/sys/netinet/ip_proxy.c		\
    /usr/src/sys/netinet/ip_proxy.h		\
    /usr/src/sys/netinet/ip_state.c		\
    /usr/src/sys/netinet/ip_state.h		\
    /usr/src/sys/netinet/ipl.h			\
    /usr/src/sys/netinet/mlf_ipl.c
do
    rm -f $i
done

# now the layout IP Filter itself (as of 3.3.16) uses
for i in					\
    /sbin/ipf					\
    /sbin/ipfstat				\
    /sbin/ipftest				\
    /sbin/ipnat					\
    /usr/include/netinet/ip_fil.h		\
    /usr/local/bin/ipftest			\
    /usr/local/bin/ipmon			\
    /usr/local/bin/ipresend			\
    /usr/local/bin/ipsend			\
    /usr/local/bin/iptest			\
    /usr/local/man/cat1/ipftest.1.gz		\
    /usr/local/man/cat1/ipnat.1.gz		\
    /usr/local/man/cat4/ipf.4.gz		\
    /usr/local/man/cat4/ipl.4.gz		\
    /usr/local/man/cat4/ipnat.4.gz		\
    /usr/local/man/cat5/ipf.5.gz		\
    /usr/local/man/cat5/ipnat.5.gz		\
    /usr/local/man/cat8/ipf.8.gz		\
    /usr/local/man/cat8/ipfstat.8.gz		\
    /usr/local/man/cat8/ipmon.8.gz		\
    /usr/local/man/man1/ipftest.1		\
    /usr/local/man/man1/ipnat.1			\
    /usr/local/man/man4/ipf.4			\
    /usr/local/man/man4/ipl.4			\
    /usr/local/man/man4/ipnat.4			\
    /usr/local/man/man5/ipf.5			\
    /usr/local/man/man5/ipnat.5			\
    /usr/local/man/man8/ipf.8			\
    /usr/local/man/man8/ipfstat.8		\
    /usr/local/man/man8/ipmon.8			\
    /usr/src/sys/netinet/fil.c			\
    /usr/src/sys/netinet/ip_auth.c		\
    /usr/src/sys/netinet/ip_auth.h		\
    /usr/src/sys/netinet/ip_compat.h		\
    /usr/src/sys/netinet/ip_fil.c		\
    /usr/src/sys/netinet/ip_fil.h		\
    /usr/src/sys/netinet/ip_frag.c		\
    /usr/src/sys/netinet/ip_frag.h		\
    /usr/src/sys/netinet/ip_ftp_pxy.c		\
    /usr/src/sys/netinet/ip_log.c		\
    /usr/src/sys/netinet/ip_nat.c		\
    /usr/src/sys/netinet/ip_nat.h		\
    /usr/src/sys/netinet/ip_proxy.c		\
    /usr/src/sys/netinet/ip_proxy.h		\
    /usr/src/sys/netinet/ip_raudio_pxy.c	\
    /usr/src/sys/netinet/ip_rcmd_pxy.c		\
    /usr/src/sys/netinet/ip_state.c		\
    /usr/src/sys/netinet/ip_state.h		\
    /usr/src/sys/netinet/ipl.h			\
    /usr/src/sys/netinet/mlf_ipl.c
do
    rm -f $i
done