disabled
  )   Z٫{-i[D<o_I|Mjq؂  $          sIU/QH/K +!     "   l4(TmJq@q4oh      4:64
  #   la?Jƚ*bѿd ?     # network-functions-ipv6
#
# Taken from: network-functions-ipv6
# (P) & (C) 1997-2005 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
#
# Version: 2006-08-03
#
#


##### Test for IPv6 capabilites
# $1: (optional) testflag: currently supported: "testonly" (do not load a module)
# return code: 0=ok 2=IPv6 test fails
ipv6_test() {
    local fn="ipv6_test"

    local testflag=$1

    if ! [ -f /proc/net/if_inet6 ]; then
        if [ "$testflag" = "testonly" ]; then
            return 2
        else
            modprobe ipv6

            if ! [ -f /proc/net/if_inet6 ]; then
                return 2
            fi
        fi
    fi

    if ! [ -d /proc/sys/net/ipv6/conf/ ]; then
        return 2
    fi

    return 0
}

##### Static IPv6 route configuration

# Set static IPv6 route
#  $1: <IPv6 network> : to route
#  $2: <IPv6 gateway> : over which $1 should be routed (if "::", gw will be skipped)
#  $3: [<Interface>] : (optional)
# return code: 0=ok 1=argument error 2=IPv6 test fails 3=major problem adding route
ipv6_add_route() {
    local fn="ipv6_add_route"

    local networkipv6=$1
    local gatewayipv6=$2
    local device=$3        # maybe empty

    if [ -z "$networkipv6" ]; then
        net_log $"Missing parameter 'IPv6-network' (arg 1)" err $fn
        return 1
    fi

    if [ -z "$gatewayipv6" ]; then
        net_log $"Missing parameter 'IPv6-gateway' (arg 2)" err $fn
        return 1
    fi

    ipv6_test || return 2

    ipv6_test_ipv6_addr_valid $networkipv6 || return 2
    ipv6_test_ipv6_addr_valid $gatewayipv6 || return 2

    if [ -z "$device" ]; then
        local returntxt="$(/sbin/ip -6 route add $networkipv6 via $gatewayipv6 metric 1 2>&1)"
    else
        if [ "$gatewayipv6" = "::" ]; then
            local returntxt="$(/sbin/ip -6 route add $networkipv6 dev $device metric 1 2>&1)"
        else
            local returntxt="$(/sbin/ip -6 route add $networkipv6 via $gatewayipv6 dev $device metric 1 2>&1)"
        fi
    fi

    if [ -n "$returntxt" ]; then
        if echo $returntxt | LC_ALL=C grep -q "File exists"; then
            # Netlink: "File exists"
            true
        elif echo $returntxt | LC_ALL=C grep -q "No route to host"; then
            # Netlink: "No route to host"
            net_log $"'No route to host' adding route '$networkipv6' via gateway '$gatewayipv6' through device '$device'" err $fn
            return 3
        else
            net_log $"Unknown error" err $fn
            return 3
        fi
    fi

    return 0
}

##### automatic tunneling configuration

## Configure automatic tunneling up
# return code: 0=ok 2=IPv6 test fails 3=major problem
ipv6_enable_autotunnel() {
    local fn="ipv6_enable_autotunnel"

    ipv6_test || return 2

    # enable IPv6-over-IPv4 tunnels
    if ipv6_test_device_status sit0; then
        true
    else
        # bring up basic tunnel device
        /sbin/ip link set sit0 up

            if ! ipv6_test_device_status sit0; then
                net_log $"Tunnel device 'sit0' enabling didn't work" err $fn
                return 3
            fi

        # Set sysctls proper (regardless "default")
        /sbin/sysctl -e -w net.ipv6.conf.sit0.forwarding=1 >/dev/null 2>&1
        /sbin/sysctl -e -w net.ipv6.conf.sit0.accept_ra=0 >/dev/null 2>&1
        /sbin/sysctl -e -w net.ipv6.conf.sit0.accept_redirects=0 >/dev/null 2>&1
    fi

    return 0
}

##### Interface configuration

## Add an IPv6 address for given interface
#  $1: <Interface>
#  $2: <IPv6 address[/prefix]>
# return code: 0=ok 1=argument error 2=IPv6 test fails 3=major problem
ipv6_add_addr_on_device() {
    local fn="ipv6_add_addr_on_device"

    local device=$1
    local address=$2

    if [ -z "$device" ]; then
        net_log $"Missing parameter 'device' (