3 # $FreeBSD: src/etc/rc.d/pf,v 1.3 2004/06/23 01:42:06 mlaier Exp $
7 # REQUIRE: root mountcritlocal netif pflog
16 stop_precmd
="test -f ${pf_rules}"
17 start_precmd
="pf_prestart"
20 reload_precmd
="$stop_precmd"
21 reload_cmd
="pf_reload"
22 resync_precmd
="$stop_precmd"
23 resync_cmd
="pf_resync"
24 status_precmd
="$stop_precmd"
25 status_cmd
="pf_status"
26 extra_commands
="reload resync status"
30 # load pf kernel module if needed
31 kldstat
-qm pf || kldload
-n pf ||
exit 1
34 if [ ! -r "${pf_rules}" ]
36 warn
'pf: NO PF RULESET FOUND'
44 ${pf_program:-/sbin/pfctl} -Fa > /dev
/null
2>&1
45 if [ -r "${pf_rules}" ]; then
46 ${pf_program:-/sbin/pfctl} \
47 -f "${pf_rules}" ${pf_flags}
49 if ! ${pf_program:-/sbin/pfctl} -si |
grep -q "Enabled" ; then
50 ${pf_program:-/sbin/pfctl} -e
56 if ${pf_program:-/sbin/pfctl} -si |
grep -q "Enabled" ; then
58 ${pf_program:-/sbin/pfctl} -d
64 echo "Reloading pf rules."
66 ${pf_program:-/sbin/pfctl} -Fa > /dev
/null
2>&1
67 if [ -r "${pf_rules}" ]; then
68 ${pf_program:-/sbin/pfctl} \
69 -f "${pf_rules}" ${pf_flags}
75 # Don't resync if pf is not loaded
76 if ! kldstat
-q -m "pf"; then
79 ${pf_program:-/sbin/pfctl} -f "${pf_rules}" ${pf_flags}
84 ${pf_program:-/sbin/pfctl} -si