summaryrefslogtreecommitdiff
path: root/templates/system/ipv6/disable-forwarding/node.def
blob: 2c8f4ac543694cad62ebbeb10156431de67fe6af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
help: Disable IPv6 forwarding on all interfaces

# Disable IPv6 forwarding for all interfaces we currently have,
# and set default such that it will be disabled on any new interfaces
# that come up after this.
create:
	sudo sh -c "echo 0 > /proc/sys/net/ipv6/conf/all/forwarding"
	sudo sh -c "echo 0 > /proc/sys/net/ipv6/conf/default/forwarding"

# Re-enable IPv6 forwarding globally.  But only enable it for those
# interfaces that do not have forwarding disabled on a per-interface
# basis.  A per-interface flag file under /var/run/vyatta/ tells us if
# it is disabled.  Restore default value so that any new interfaces
# that come up after this will have forwarding enabled.
delete: 
	cd /proc/sys/net/ipv6/conf
	for i in * ; do
	    if [ "$i" = "default" -o "$i" = "all" -o ! -d "$i" ]; then
		continue
	    fi
            if [ ! -e /var/run/vyatta/ipv6_no_fwd.$i ]; then
		sudo sh -c "echo 1 > $i/forwarding"
	    fi
	done
	sudo sh -c "echo 1 > /proc/sys/net/ipv6/conf/default/forwarding"