source: hybrid/branches/releng-10/nanobsd/files/etc/rc.d/pf

Last change on this file 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
13name="pf"
14load_rc_config $name
15start_cmd="pf_start"
16stop_cmd="pf_stop"
17check_cmd="pf_check"
18reload_cmd="pf_reload"
19resync_cmd="pf_resync"
20status_cmd="pf_status"
21extra_commands="check reload resync"
22required_files="$pf_rules"
23required_modules="pf"
24
25pf_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
36pf_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
45pf_check()
46{
47 echo "Checking pf rules."
48 $pf_program -n -f "$pf_rules" $pf_flags
49}
50
51pf_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
61pf_resync()
62{
63 $pf_program -f "$pf_rules" $pf_flags
64}
65
66pf_status()
67{
68 $pf_program -s info
69}
70
71run_rc_command "$1"
Note: See TracBrowser for help on using the repository browser.