Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / etc / rc.d / ip6fw
blobbfca5ef388a8f27767c155e31dff020ec11e0f47
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/ip6fw,v 1.3 2003/06/29 05:15:57 mtm Exp $
4 # $DragonFly: src/etc/rc.d/ip6fw,v 1.3 2005/11/19 21:47:32 swildner Exp $
7 # PROVIDE: ip6fw
8 # REQUIRE: routing
9 # BEFORE: network_ipv6
11 . /etc/rc.subr
13 name="ip6fw"
14 rcvar=`set_rcvar ipv6_firewall`
15 start_cmd="ip6fw_start"
16 start_precmd="ip6fw_prestart"
17 stop_cmd="${SYSCTL_W} net.inet6.ip6.fw.enable=0"
19 ip6fw_prestart()
21 # Load IPv6 firewall module, if not already loaded
22 if ! ${SYSCTL} net.inet6.ip6.fw.enable > /dev/null 2>&1; then
23 kldload ip6fw && {
24 debug 'Kernel IPv6 firewall module loaded.'
25 return 0
27 warn 'IPv6 firewall kernel module failed to load.'
28 return 1
32 ip6fw_start()
34 # Specify default rules file if none provided
35 if [ -z "${ipv6_firewall_script}" ]; then
36 ipv6_firewall_script=/etc/rc.firewall6
39 # Load rules
41 if [ -r "${ipv6_firewall_script}" ]; then
42 . "${ipv6_firewall_script}"
43 echo 'IPv6 Firewall rules loaded.'
44 elif [ "`ip6fw l 65535`" = "65535 deny ipv6 from any to any" ]; then
45 warn 'IPv6 firewall rules have not been loaded. Default' \
46 ' to DENY all access.'
49 # Enable firewall logging
51 if checkyesno ipv6_firewall_logging; then
52 echo 'IPv6 Firewall logging=YES'
53 sysctl net.inet6.ip6.fw.verbose=1 >/dev/null
57 load_rc_config $name
58 run_rc_command "$1"