aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifup-ipv6
blob: 4ee50e1ecb9139c97087db311d9af433b87a64eb (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
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# ifup-ipv6
#
#
# Taken from:
# (P) & (C) 2000-2001 by Peter Bieringer <pb@bieringer.de>
#
# Version 2001-03-03
#

# Filter tags (for stripping, empty lines following if all is stripped)

. /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
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

	# Run basic IPv6 test (and make sure the ipv6 module will be loaded)
	test_ipv6 || exit 0
		
	# Setup IPv6 address on specified interface
	if ! [ -z "$IPV6ADDR" ]; then
		ifup_ipv6_real $DEVICE $IPV6ADDR
	fi
	
	# Switch forwarding per device like defined
	#  Packets received on selected interface are forwarded
	if ! [ -z "$IPV6FORWARDING" ]; then
		if [ "$IPV6FORWARDING" = "yes" ]; then
			forwarding_ipv6 yes $DEVICE
			# also for all (otherwise, nothing is forwarded)
			forwarding_ipv6 yes
		else
			forwarding_ipv6 no $DEVICE
		fi
	fi
		
	# Setup additional IPv6 addresses from list
	if [ ! -z "$IPV6ADDR_SECONDARIES" ]; then
		for ipv6addr in $IPV6ADDR_SECONDARIES; do
			ifup_ipv6_real $DEVICE $ipv6addr
		done
	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
fi