3 # Copyright (C) 2006 by Darren Reed.
5 # See the IPFILTER.LICENCE file for details on licencing.
11 # This script is an interface to the following rc.d scripts:
17 running=`ipf -V 2>/dev/null|sed -ne 's/Running: \(.*\)/\1/p'`
21 echo "$prog ipfilter <enable|disable|reload|resync|start|status|stop>"
22 echo "$prog ipfs <enable|disable|status|start|stop>"
23 echo "$prog ipmon <enable|disable|restart|start|status|stop>"
24 echo "$prog ipnat <enable|disable|reload|start|status|stop>"
32 if [ $? -eq 0 ] ; then
33 if [ -f ${RCD}/$1 ] ; then
34 cp ${RCD}/$1 ${RCD}/$1.old
35 sed -e "s/^${1} *\=.*/${1}\=YES/" ${old} > ${new}
38 echo "$1=YES" > ${RCD}/$1
49 if [ $? -eq 0 ] ; then
50 if [ -f ${RCD}/$1 ] ; then
51 cp ${RCD}/$1 ${RCD}/$1.old
52 sed -e "s/^${1} *\=.*/${1}\=NO/" ${old} > ${new}
55 echo "$1=NO" > ${RCD}/$1
63 active=`/etc/rc.d/$1 rcvar|sed -ne "s/^$""${1}\=\(.*\)$/\1/p"`
81 if [ -n "$pid" ] ; then
82 echo "disabled-but-running"
88 if [ -n "$pid" ] ; then
91 echo "enabled-not-running"
95 if [ -n "$pid" ] ; then
96 echo "unknown-state-running"
105 if [ -z "$running" ] ; then
107 emsg="-not-in-kernel"
114 rules=`ipfstat -io 2>/dev/null`
115 if [ -z "$rules" ] ; then
116 rules=`ipfstat -aio 2>/dev/null`
117 if [ -z "$rules" ] ; then
135 echo "disabled${dmsg}"
138 echo "enabled${emsg}"
141 if [ -n "$rules" ] ; then
142 echo "unknown${dmsg}"
151 if [ -z "$running" ] ; then
153 emsg="-not-in-kernel"
160 rules=`ipnat -l 2>/dev/null | egrep '^map|rdr' 2>/dev/null`
161 if [ -z "$rules" ] ; then
178 echo "disabled${dmsg}"
181 echo "enabled${dmsg}"
184 if [ -n "$rules" ] ; then
185 echo "unknown${dmsg}"
208 echo "unknown-status"
225 /etc/rc.d/ipfilter reload
228 /etc/rc.d/ipfilter resync
231 /etc/rc.d/ipfilter start
237 /etc/rc.d/ipfilter stop
277 /etc/rc.d/ipmon restart
280 /etc/rc.d/ipmon start
303 /etc/rc.d/ipnat reload
306 /etc/rc.d/ipnat restart
309 /etc/rc.d/ipnat start