Last change
on this file since 13417 was 12922, checked in by huub, 10 years ago |
cleanup rc.d remove rcvar statements and named
|
-
Property svn:executable
set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # $FreeBSD: releng/9.0/etc/rc.d/pf 222007 2011-05-17 07:40:13Z hrs $
|
---|
4 | #
|
---|
5 |
|
---|
6 | # PROVIDE: pf
|
---|
7 | # REQUIRE: FILESYSTEMS netif pflog pfsync
|
---|
8 | # BEFORE: routing
|
---|
9 | # KEYWORD: nojail
|
---|
10 |
|
---|
11 | . /etc/rc.subr
|
---|
12 |
|
---|
13 | name="pf"
|
---|
14 | load_rc_config $name
|
---|
15 | start_cmd="pf_start"
|
---|
16 | stop_cmd="pf_stop"
|
---|
17 | check_cmd="pf_check"
|
---|
18 | reload_cmd="pf_reload"
|
---|
19 | resync_cmd="pf_resync"
|
---|
20 | status_cmd="pf_status"
|
---|
21 | extra_commands="check reload resync"
|
---|
22 | required_files="$pf_rules"
|
---|
23 | required_modules="pf"
|
---|
24 |
|
---|
25 | pf_start()
|
---|
26 | {
|
---|
27 | check_startmsgs && echo -n 'Enabling pf'
|
---|
28 | $pf_program -F all > /dev/null 2>&1
|
---|
29 | $pf_program -f "$pf_rules" $pf_flags
|
---|
30 | if ! $pf_program -s info | grep -q "Enabled" ; then
|
---|
31 | $pf_program -eq
|
---|
32 | fi
|
---|
33 | check_startmsgs && echo '.'
|
---|
34 | }
|
---|
35 |
|
---|
36 | pf_stop()
|
---|
37 | {
|
---|
38 | if $pf_program -s info | grep -q "Enabled" ; then
|
---|
39 | echo -n 'Disabling pf'
|
---|
40 | $pf_program -dq
|
---|
41 | echo '.'
|
---|
42 | fi
|
---|
43 | }
|
---|
44 |
|
---|
45 | pf_check()
|
---|
46 | {
|
---|
47 | echo "Checking pf rules."
|
---|
48 | $pf_program -n -f "$pf_rules" $pf_flags
|
---|
49 | }
|
---|
50 |
|
---|
51 | pf_reload()
|
---|
52 | {
|
---|
53 | echo "Reloading pf rules."
|
---|
54 | $pf_program -n -f "$pf_rules" $pf_flags || return 1
|
---|
55 | # Flush everything but existing state entries that way when
|
---|
56 | # rules are read in, it doesn't break established connections.
|
---|
57 | $pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1
|
---|
58 | $pf_program -f "$pf_rules" $pf_flags
|
---|
59 | }
|
---|
60 |
|
---|
61 | pf_resync()
|
---|
62 | {
|
---|
63 | $pf_program -f "$pf_rules" $pf_flags
|
---|
64 | }
|
---|
65 |
|
---|
66 | pf_status()
|
---|
67 | {
|
---|
68 | $pf_program -s info
|
---|
69 | }
|
---|
70 |
|
---|
71 | run_rc_command "$1"
|
---|
Note:
See
TracBrowser
for help on using the repository browser.