Sync usage with man page.
[netbsd-mini2440.git] / etc / rc.d / pf
blob4ed9650b6663b71435af21c09ed9dbc4c70999cd
1 #!/bin/sh
3 # $NetBSD: pf,v 1.8 2008/11/12 12:35:52 ad Exp $
6 # PROVIDE: pf
7 # REQUIRE: root bootconf mountcritlocal tty network dhclient
8 # BEFORE: NETWORKING
10 $_rc_subr_loaded . /etc/rc.subr
12 name="pf"
13 rcvar=$name
14 start_precmd="pf_prestart"
15 start_cmd="pf_start"
16 stop_cmd="pf_stop"
17 reload_cmd="pf_reload"
18 status_cmd="pf_status"
19 extra_commands="reload status"
21 pf_prestart()
23 if [ ! -f ${pf_rules} ]; then
24 warn "${pf_rules} not readable; pf start aborted."
26 stop_boot
27 return 1
29 return 0
32 pf_start()
34 echo "Enabling pf firewall."
36 # The pf_boot script has enabled pf already.
37 if [ "$autoboot" != yes ]; then
38 /sbin/pfctl -q -e
41 if [ -f ${pf_rules} ]; then
42 /sbin/pfctl -q -f ${pf_rules}
43 else
44 warn "${pf_rules} not found; no pf rules loaded."
48 pf_stop()
50 echo "Disabling pf firewall."
51 /sbin/pfctl -q -Fa -d
54 pf_reload()
56 echo "Reloading pf rules."
57 if [ -f ${pf_rules} ]; then
58 /sbin/pfctl -q -f ${pf_rules}
59 else
60 warn "${pf_rules} not found; no pf rules loaded."
64 pf_status()
66 /sbin/pfctl -s info
69 load_rc_config $name
70 run_rc_command "$1"