
  #   ˆl–ßi~”*n-jm@=pNÜeµ1hßÁ„^|?À¿ .s    #!/bin/bash
#
# ifup-ipv6
#
#
# Taken from:
# (P) & (C) 2000-2006 by Peter Bieringer <pb@bieringer.de>
#
#  You will find more information on the initscripts-ipv6 homepage at
#   http://www.deepspace6.net/projects/initscripts-ipv6.html
#
# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
#
# Version: 2006-07-20
#
# Note: if called (like normally) by /etc/sysconfig/network-scripts/ifup
#        exit codes aren't handled by "ifup"
#
# Uses following information from "/etc/sysconfig/network":
#  IPV6_DEFAULTDEV=<device>: controls default route (optional)
#  IPV6_DEFAULTGW=<address>: controls default route (optional)
#
# Uses following information from "/etc/sysconfig/network-scripts/ifcfg-$1":
#  IPV6INIT=yes|no: controls IPv6 configuration for this interface
#  IPV6ADDR=<IPv6 address>[/<prefix length>]: specify primary static IPv6 address
#  IPV6ADDR_SECONDARIES="<IPv6 address>[/<prefix length>] ..." (optional)
#  IPV6_ROUTER=yes|no: controls IPv6 autoconfiguration (no: multi-homed interface without routing)
#  IPV6_AUTOCONF=yes|no: controls IPv6 autoconfiguration
#   defaults:
#    IPV6FORWARDING=yes: IPV6_AUTOCONF=no, IPV6_ROUTER=yes
#    IPV6FORWARDING=no: IPV6_AUTOCONF=yes
#  IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link (optional)
#  IPV6_PRIVACY="rfc3041": control IPv6 privacy (optional)
#    This script only supports "rfc3041" (if kernel supports it)
#
# Optional for 6to4 tunneling (hardwired name of tunnel device is "tun6to4"):
#  IPV6TO4INIT=yes|no: controls 6to4 tunneling setup
#  IPV6TO4_RELAY=<IPv4 address>: IPv4 address of the remote 6to4 relay (default: 192.88.99.1)
#  IPV6TO4_MTU=<MTU for IPv6>: controls IPv6 MTU for the 6to4 link (optional, default is MTU of interface - 20)
#  IPV6TO4_IPV4ADDR=<IPv4 address>: overwrite local IPv4 address (optional)
#  IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup additional interfaces
#    Example: IPV6TO4_ROUTING="eth0-:f101::1/64 eth1-:f102::1/64"
#
# Optional for 6to4 tunneling to trigger radvd:
#  IPV6_CONTROL_RADVD=yes|no: controls radvd triggering (optional)
#  IPV6_RADVD_PIDFILE=<file>: PID file of radvd for sending signals, default is "/run/radvd/radvd.pid" (optional)
#  IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd (optional, default is SIGHUP)
#
#  Required version of radvd to use 6to4 prefix recalculation
#   0.6.2p3 or newer supporting option "Base6to4Interface"
#  Required version of radvd to use dynamic ppp links
#   0.7.0 + fixes or newer
#


. /etc/sysconfig/network

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

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

REALDEVICE=${DEVICE%%:*}
DEVICE=$REALDEVICE

# Test whether IPv6 configuration is disabled for this interface
is_false "$IPV6INIT" && exit 0

[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
. /etc/sysconfig/network-scripts/network-functions-ipv6


# IPv6 test, module loaded, exit if system is not IPv6-ready
ipv6_test || exit 1

# Test device status
ipv6_test_device_status $DEVICE
if [ $? != 0 -a $? != 11 ]; then
    # device doesn't exist or other problem occurs
    exit 1
fi

# Setup IPv6 address on specified interface
if [ -n "$IPV6ADDR" ]; then
    ipv6_add_addr_on_device $DEVICE $IPV6ADDR || exit 1
fi

# Get current global IPv6 forwarding
ipv6_global_forwarding_current="$(/sbin/sysctl -e -n net.ipv6.conf.all.forwarding)"

# Set some proc switches depending on defines
if [ "$IPV6FORWARDING" = "yes" ]; then
    # Global forwarding should be enabled

    # Check, if global IPv6 forwarding was already set by global script
    if [ $ipv6_global_forwarding_current -ne 1 ]; then
        net_log $"Global IPv6 forwarding is enabled in configuration, but not currently enabled in kernel"
        net_log $"Please restart network with '/sbin/service network restart'"
    fi

    ipv6_local_forwarding=1
    ipv6_local_auto=0
    ipv6_local_accept_ra=0
    if [ "$IPV6_ROUTER" = "no" ]; then
        ipv6_local_forwarding=