aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifup-ipv6
blob: e69262c81e72f47acc0d954a75e38928cc5cbf84 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
# ifup-ipv6
#
# Taken from:
#
# (P) & (C) 2000 Peter Bieringer <pb@bieringer.de>

. /etc/sysconfig/network 

cd /etc/sysconfig/network-scripts
. network-functions 

CONFIG=$1
[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
source_config  

# Test if IPv6 configuration is enabled for this interface
if [ ! "$IPV6INIT" = "yes" ]; then
	# not enabled, stop here
	exit 0
fi                                                  

# Test if IPv6 is up
if [ "${NETWORKING_IPV6}" = "yes" ]; then
	. /etc/sysconfig/network-scripts/network-functions-ipv6
		
	# Setup IPv6 address on specified interface
	if ! [ -z "$IPV6ADDR" -o -z "$IPV6PREFIXLENGTH" ]; then
		ifup_ipv6_real $DEVICE $IPV6ADDR $IPV6PREFIXLENGTH
	fi
		
	# Setup additional (1) IPv6 address on specified interface
	if ! [ -z "$IPV6ADDR_0" -o -z "$IPV6PREFIXLENGTH_0" ]; then
		ifup_ipv6_real $DEVICE $IPV6ADDR_0 $IPV6PREFIXLENGTH_0
	fi

	# Setup additional (2) IPv6 address on specified interface
	if ! [ -z "$IPV6ADDR_1" -o -z "$IPV6PREFIXLENGTH_1" ]; then
		ifup_ipv6_real $DEVICE $IPV6ADDR_1 $IPV6PREFIXLENGTH_1
	fi

	# Setup additional static IPv6 routes on specified interface
        if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
		grep "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device args; do
			if [ "$device" = "$DEVICE" ]; then
				ifup_ipv6_route $args $DEVICE
			fi
		done
	fi
		
	# Setup tunnel
	if ! [ -z "$IPV6TUNNELIPV4" -o -z "$IPV6TUNNELROUTE" ]; then
		ifup_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $IPV6TUNNELROUTE
	fi
fi