5ca51aad69
allow them to start after netif. There were too many problems reported with this change in the short period of time that it lived in HEAD, and we are too late in the release cycle to properly shake it out. IMO the issue of having the firewalls up before the network is still a valid concern, particularly for pf whose default state is wide open. However properly solving this issue is going to take some investment on the part of the people who actually use those tools. This is not a strict reversion of all the changes for r193198 since it also included some simplification of the BEFORE/REQUIRE logic which is still valid for ipfilter and ip6fw.
71 lines
1.2 KiB
Bash
Executable File
71 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: pf
|
|
# REQUIRE: FILESYSTEMS netif pflog pfsync
|
|
# BEFORE: routing
|
|
# KEYWORD: nojail
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="pf"
|
|
rcvar=`set_rcvar`
|
|
load_rc_config $name
|
|
start_cmd="pf_start"
|
|
stop_cmd="pf_stop"
|
|
check_cmd="pf_check"
|
|
reload_cmd="pf_reload"
|
|
resync_cmd="pf_resync"
|
|
status_cmd="pf_status"
|
|
extra_commands="check reload resync status"
|
|
required_files="$pf_rules"
|
|
required_modules="pf"
|
|
|
|
pf_start()
|
|
{
|
|
[ -z "${rc_quiet}" ] && echo "Enabling pf."
|
|
$pf_program -F all > /dev/null 2>&1
|
|
$pf_program -f "$pf_rules" $pf_flags
|
|
if ! $pf_program -s info | grep -q "Enabled" ; then
|
|
$pf_program -e
|
|
fi
|
|
}
|
|
|
|
pf_stop()
|
|
{
|
|
if $pf_program -s info | grep -q "Enabled" ; then
|
|
[ -z "${rc_quiet}" ] && echo "Disabling pf."
|
|
$pf_program -d
|
|
fi
|
|
}
|
|
|
|
pf_check()
|
|
{
|
|
echo "Checking pf rules."
|
|
$pf_program -n -f "$pf_rules"
|
|
}
|
|
|
|
pf_reload()
|
|
{
|
|
echo "Reloading pf rules."
|
|
$pf_program -n -f "$pf_rules" || return 1
|
|
# Flush everything but existing state entries that way when
|
|
# rules are read in, it doesn't break established connections.
|
|
$pf_program -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp > /dev/null 2>&1
|
|
$pf_program -f "$pf_rules" $pf_flags
|
|
}
|
|
|
|
pf_resync()
|
|
{
|
|
$pf_program -f "$pf_rules" $pf_flags
|
|
}
|
|
|
|
pf_status()
|
|
{
|
|
$pf_program -s info
|
|
}
|
|
|
|
run_rc_command "$1"
|