rc.d - Use kldstat -m to test existance before kldload
[dragonfly.git] / etc / rc.d / ip6fw
bloba7e8cec88afb8baffbbd7cdf90a885f092103286
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/ip6fw,v 1.3 2003/06/29 05:15:57 mtm Exp $
6 # PROVIDE: ip6fw
7 # REQUIRE: routing
8 # BEFORE: network_ipv6
10 . /etc/rc.subr
12 name="ip6fw"
13 rcvar=`set_rcvar ipv6_firewall`
14 start_cmd="ip6fw_start"
15 start_precmd="ip6fw_prestart"
16 stop_cmd="${SYSCTL_W} net.inet6.ip6.fw.enable=0"
18 ip6fw_prestart()
20 # Load IPv6 firewall module, if not already loaded
21 if ! ${SYSCTL} net.inet6.ip6.fw.enable > /dev/null 2>&1; then
22 kldstat -m ip6fw || kldload -n ip6fw || return 1
24 return 0
27 ip6fw_start()
29 # Specify default rules file if none provided
30 if [ -z "${ipv6_firewall_script}" ]; then
31 ipv6_firewall_script=/etc/rc.firewall6
34 # Load rules
36 if [ -r "${ipv6_firewall_script}" ]; then
37 . "${ipv6_firewall_script}"
38 echo 'IPv6 Firewall rules loaded.'
39 elif [ "`ip6fw l 65535`" = "65535 deny ipv6 from any to any" ]; then
40 warn 'IPv6 firewall rules have not been loaded. Default' \
41 ' to DENY all access.'
44 # Enable firewall logging
46 if checkyesno ipv6_firewall_logging; then
47 echo 'IPv6 Firewall logging=YES'
48 sysctl net.inet6.ip6.fw.verbose=1 >/dev/null
52 load_rc_config $name
53 run_rc_command "$1"