7 # REQUIRE: root mountcritlocal netif pflog
16 stop_precmd="test -f ${pf_rules}"
17 start_precmd="pf_prestart"
20 check_precmd="$stop_precmd"
22 reload_precmd="$stop_precmd"
23 reload_cmd="pf_reload"
24 resync_precmd="$stop_precmd"
25 resync_cmd="pf_resync"
26 status_precmd="$stop_precmd"
27 status_cmd="pf_status"
28 extra_commands="check reload resync status"
32 # load pf kernel module if needed
33 if ! kldstat -v | grep -q pf\$; then
35 info 'pf module loaded.'
37 err 1 'pf module failed to load.'
42 if [ ! -r "${pf_rules}" ]; then
43 warn 'pf: NO PF RULESET FOUND'
51 ${pf_program:-/sbin/pfctl} -Fa > /dev/null 2>&1
52 ${pf_program:-/sbin/pfctl} -f "${pf_rules}" ${pf_flags}
53 if ! ${pf_program:-/sbin/pfctl} -si | grep -q "Enabled" ; then
54 ${pf_program:-/sbin/pfctl} -e
60 if ${pf_program:-/sbin/pfctl} -si | grep -q "Enabled" ; then
62 ${pf_program:-/sbin/pfctl} -d
68 echo "Checking pf rules."
70 ${pf_program:-/sbin/pfctl} -n -f "${pf_rules}"
75 echo "Reloading pf rules."
77 ${pf_program:-/sbin/pfctl} -n -f "${pf_rules}" || return 1
78 ${pf_program:-/sbin/pfctl} -Fa > /dev/null 2>&1
79 ${pf_program:-/sbin/pfctl} -f "${pf_rules}" ${pf_flags}
84 # Don't resync if pf is not loaded
85 if ! kldstat -v | grep -q pf\$ ; then
88 ${pf_program:-/sbin/pfctl} -f "${pf_rules}" ${pf_flags}
93 ${pf_program:-/sbin/pfctl} -si