3 # $FreeBSD: src/etc/rc.d/pf,v 1.3 2004/06/23 01:42:06 mlaier Exp $
4 # $DragonFly: src/etc/rc.d/pf,v 1.3 2005/11/19 22:47:32 swildner Exp $
8 # REQUIRE: root mountcritlocal netif pflog
17 stop_precmd
="test -f ${pf_rules}"
18 start_precmd
="pf_prestart"
21 reload_precmd
="$stop_precmd"
22 reload_cmd
="pf_reload"
23 resync_precmd
="$stop_precmd"
24 resync_cmd
="pf_resync"
25 status_precmd
="$stop_precmd"
26 status_cmd
="pf_status"
27 extra_commands
="reload resync status"
31 # load pf kernel module if needed
32 if ! kldstat
-v |
grep -q pf\$
; then
34 info
'pf module loaded.'
36 err
1 'pf module failed to load.'
41 if [ ! -r "${pf_rules}" ]
43 warn
'pf: NO PF RULESET FOUND'
51 ${pf_program:-/sbin/pfctl} -Fa > /dev
/null
2>&1
52 if [ -r "${pf_rules}" ]; then
53 ${pf_program:-/sbin/pfctl} \
54 -f "${pf_rules}" ${pf_flags}
56 if ! ${pf_program:-/sbin/pfctl} -si |
grep -q "Enabled" ; then
57 ${pf_program:-/sbin/pfctl} -e
63 if ${pf_program:-/sbin/pfctl} -si |
grep -q "Enabled" ; then
65 ${pf_program:-/sbin/pfctl} -d
71 echo "Reloading pf rules."
73 ${pf_program:-/sbin/pfctl} -Fa > /dev
/null
2>&1
74 if [ -r "${pf_rules}" ]; then
75 ${pf_program:-/sbin/pfctl} \
76 -f "${pf_rules}" ${pf_flags}
82 # Don't resync if pf is not loaded
83 if ! kldstat
-v |
grep -q pf\$
; then
86 ${pf_program:-/sbin/pfctl} -f "${pf_rules}" ${pf_flags}
91 ${pf_program:-/sbin/pfctl} -si