192 |
- |
1 |
#!/bin/bash
|
|
|
2 |
#
|
|
|
3 |
# ipv6-up
|
|
|
4 |
#
|
|
|
5 |
# Called by pppd after IPV6CP/up was finished
|
|
|
6 |
#
|
|
|
7 |
# This file should not be modified -- make local changes to
|
|
|
8 |
# /etc/ppp/ipv6-up.local instead
|
|
|
9 |
#
|
|
|
10 |
# Taken from:
|
|
|
11 |
# (P) & (C) 2001-2006 by Peter Bieringer <pb@bieringer.de>
|
|
|
12 |
#
|
|
|
13 |
# You will find more information on the initscripts-ipv6 homepage at
|
|
|
14 |
# http://www.deepspace6.net/projects/initscripts-ipv6.html
|
|
|
15 |
#
|
|
|
16 |
# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
|
|
|
17 |
#
|
|
|
18 |
# Calling parameters:
|
|
|
19 |
# $1: interface name
|
|
|
20 |
# $6: logical interface name (set by pppd option ipparam)
|
|
|
21 |
#
|
|
|
22 |
#
|
|
|
23 |
# Version: 2006-08-02
|
|
|
24 |
#
|
|
|
25 |
# Uses following information from "/etc/sysconfig/network":
|
|
|
26 |
# IPV6_DEFAULTDEV=<device>: controls default route (optional)
|
|
|
27 |
#
|
|
|
28 |
# Uses following information from "/etc/sysconfig/network-scripts/ifcfg-$1":
|
|
|
29 |
# IPV6INIT=yes|no: controls IPv6 configuration for this interface
|
|
|
30 |
# IPV6ADDR=<IPv6 address>[/<prefix length>]: specify primary static IPv6 address
|
|
|
31 |
# IPV6ADDR_SECONDARIES="<IPv6 address>[/<prefix length>] ..." (optional)
|
|
|
32 |
# IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link (optional)
|
|
|
33 |
#
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
|
|
37 |
export PATH
|
|
|
38 |
|
|
|
39 |
LOGDEVICE=$6
|
|
|
40 |
REALDEVICE=$1
|
|
|
41 |
|
|
|
42 |
[ -f /etc/sysconfig/network ] || exit 0
|
|
|
43 |
. /etc/sysconfig/network
|
|
|
44 |
|
|
|
45 |
cd /etc/sysconfig/network-scripts
|
|
|
46 |
. ./network-functions
|
|
|
47 |
. ./network-functions-ipv6
|
|
|
48 |
|
|
|
49 |
CONFIG=$LOGDEVICE
|
|
|
50 |
[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
|
|
|
51 |
source_config
|
|
|
52 |
|
|
|
53 |
# Test whether IPv6 configuration is disabled for this interface
|
|
|
54 |
[[ "$IPV6INIT" = [nN0]* ]] && exit 0
|
|
|
55 |
|
|
|
56 |
[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
|
|
|
57 |
. /etc/sysconfig/network-scripts/network-functions-ipv6
|
|
|
58 |
|
|
|
59 |
# IPv6 test, module loaded, exit if system is not IPv6-ready
|
|
|
60 |
ipv6_test || exit 1
|
|
|
61 |
|
|
|
62 |
# Test device status
|
|
|
63 |
ipv6_test_device_status $REALDEVICE
|
|
|
64 |
if [ $? != 0 -a $? != 11 ]; then
|
|
|
65 |
# device doesn't exist or other problem occurs
|
|
|
66 |
exit 1
|
|
|
67 |
fi
|
|
|
68 |
|
|
|
69 |
# Setup IPv6 address on specified interface
|
|
|
70 |
if [ -n "$IPV6ADDR" ]; then
|
|
|
71 |
ipv6_add_addr_on_device $REALDEVICE $IPV6ADDR || exit 1
|
|
|
72 |
fi
|
|
|
73 |
|
|
|
74 |
# Set IPv6 MTU, if given
|
|
|
75 |
if [ -n "$IPV6_MTU" ]; then
|
|
|
76 |
ipv6_set_mtu $REALDEVICE $IPV6_MTU
|
|
|
77 |
fi
|
|
|
78 |
|
|
|
79 |
# Setup additional IPv6 addresses from list, if given
|
|
|
80 |
if [ -n "$IPV6ADDR_SECONDARIES" ]; then
|
|
|
81 |
for ipv6addr in $IPV6ADDR_SECONDARIES; do
|
|
|
82 |
ipv6_add_addr_on_device $REALDEVICE $ipv6addr
|
|
|
83 |
done
|
|
|
84 |
fi
|
|
|
85 |
|
|
|
86 |
# Setup default IPv6 route through device
|
|
|
87 |
if [ "$IPV6_DEFAULTDEV" = "$LOGDEVICE" ]; then
|
|
|
88 |
ipv6_set_default_route "" "$REALDEVICE" "$REALDEVICE"
|
|
|
89 |
fi
|
|
|
90 |
|
|
|
91 |
# Setup additional static IPv6 routes on specified interface, if given
|
|
|
92 |
if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
|
|
|
93 |
LC_ALL=C grep -w "^$LOGDEVICE" /etc/sysconfig/static-routes-ipv6 | while read device args; do
|
|
|
94 |
ipv6_add_route $args $REALDEVICE
|
|
|
95 |
done
|
|
|
96 |
fi
|
|
|
97 |
|
|
|
98 |
# Setup additional static IPv6 routes (newer config style)
|
|
|
99 |
if [ -f "/etc/sysconfig/network-scripts/route6-$DEVICE" ]; then
|
|
|
100 |
sed -ne 's/#.*//' -e '/[^[:space:]]/p' "/etc/sysconfig/network-scripts/route6-$DEVICE" | while read line; do
|
|
|
101 |
/sbin/ip -6 route add $line
|
|
|
102 |
done
|
|
|
103 |
fi
|
|
|
104 |
|
|
|
105 |
if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
|
|
|
106 |
# Control running radvd
|
|
|
107 |
ipv6_trigger_radvd up "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
|
|
|
108 |
fi
|
|
|
109 |
|
|
|
110 |
[ -x /etc/ppp/ipv6-up.local ] && /etc/ppp/ipv6-up.local "$@"
|
|
|
111 |
|
|
|
112 |
exit 0
|