3 # $FreeBSD: src/etc/rc.d/ipfw,v 1.4 2003/03/30 15:52:18 mtm Exp $
4 # $DragonFly: src/etc/rc.d/ipfw,v 1.3 2005/11/19 21:47:32 swildner Exp $
14 rcvar
="firewall_enable"
15 start_cmd
="ipfw_start"
16 start_precmd
="ipfw_precmd"
21 if ! ${SYSCTL} net.inet.ip.fw.
enable > /dev
/null
2>&1; then
22 if ! kldload ipfw
; then
23 warn unable to load firewall module.
33 # set the firewall rules script if none was specified
34 [ -z "${firewall_script}" ] && firewall_script
=/etc
/rc.firewall
36 if [ -r "${firewall_script}" ]; then
37 .
"${firewall_script}"
38 echo -n 'Firewall rules loaded, starting divert daemons:'
40 # Network Address Translation daemon
42 if checkyesno natd_enable
; then
43 if [ -n "${natd_interface}" ]; then
44 if echo ${natd_interface} | \
45 grep -q -E '^[0-9]+(\.[0-9]+){0,3}$'; then
46 natd_flags
="$natd_flags -a ${natd_interface}"
48 natd_flags
="$natd_flags -n ${natd_interface}"
52 ${natd_program:-/sbin/natd} ${natd_flags} ${natd_ifarg}
54 elif [ "`ipfw l 65535`" = "65535 deny ip from any to any" ]; then
55 echo 'Warning: kernel has firewall functionality, but' \
56 ' firewall rules are not enabled.'
57 echo ' All ip services are disabled.'
63 if checkyesno firewall_logging
; then
64 echo 'Firewall logging enabled'
65 sysctl net.inet.ip.fw.verbose
=1 >/dev
/null
70 ${SYSCTL_W} net.inet.ip.fw.
enable=1
75 # Disable the firewall
77 ${SYSCTL_W} net.inet.ip.fw.
enable=0