mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
82e9dc59ce
is enabled dummynet(4) is added to the list of required modules. Discussed on: #freebsd-bugbusters (rwatson, trhodes) PR: conf/79196 MFC after: 1 week
69 lines
1.3 KiB
Bash
69 lines
1.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: ipfw
|
|
# REQUIRE: ppp
|
|
# BEFORE: NETWORKING
|
|
# KEYWORD: nojail
|
|
|
|
. /etc/rc.subr
|
|
. /etc/network.subr
|
|
|
|
name="ipfw"
|
|
rcvar="firewall_enable"
|
|
start_cmd="ipfw_start"
|
|
start_precmd="ipfw_prestart"
|
|
stop_cmd="ipfw_stop"
|
|
required_modules="ipfw"
|
|
|
|
ipfw_prestart()
|
|
{
|
|
if checkyesno dummynet_enable; then
|
|
required_modules="$required_modules dummynet"
|
|
fi
|
|
}
|
|
|
|
ipfw_start()
|
|
{
|
|
# set the firewall rules script if none was specified
|
|
[ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall
|
|
|
|
if [ -r "${firewall_script}" ]; then
|
|
if [ -f /etc/rc.d/natd ] ; then
|
|
/etc/rc.d/natd quietstart
|
|
fi
|
|
/bin/sh "${firewall_script}"
|
|
echo 'Firewall rules loaded.'
|
|
elif [ "`ipfw list 65535`" = "65535 deny ip from any to any" ]; then
|
|
echo 'Warning: kernel has firewall functionality, but' \
|
|
' firewall rules are not enabled.'
|
|
echo ' All ip services are disabled.'
|
|
fi
|
|
|
|
# Firewall logging
|
|
#
|
|
if checkyesno firewall_logging; then
|
|
echo 'Firewall logging enabled.'
|
|
sysctl net.inet.ip.fw.verbose=1 >/dev/null
|
|
fi
|
|
|
|
# Enable the firewall
|
|
#
|
|
${SYSCTL_W} net.inet.ip.fw.enable=1
|
|
}
|
|
|
|
ipfw_stop()
|
|
{
|
|
# Disable the firewall
|
|
#
|
|
${SYSCTL_W} net.inet.ip.fw.enable=0
|
|
if [ -f /etc/rc.d/natd ] ; then
|
|
/etc/rc.d/natd quietstop
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|