diff options
Diffstat (limited to 'ppp/ip-down.ipv6to4')
-rw-r--r-- | ppp/ip-down.ipv6to4 | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/ppp/ip-down.ipv6to4 b/ppp/ip-down.ipv6to4 new file mode 100644 index 00000000..2f481708 --- /dev/null +++ b/ppp/ip-down.ipv6to4 @@ -0,0 +1,105 @@ +#!/bin/sh +# +# ip-down.ipv6to4 +# +# +# Taken from: +# (P) & (C) 2000-2001 by Peter Bieringer <pb@bieringer.de> +# +# Version 2001-05-07 +# +# Calling parameters: +# $1: interface name +# +# Called by (mostly) /etc/ppp/ip-down.local +# like: /etc/ppp/ip-down.ipv6to4 $1 >>/var/log/ppp-ipv6to4.log 2>&1 +# +# Uses following information from /etc/sysconfig/network: +# NETWORKING_IPV6=yes|no: controls IPv6 initialization (global setting) +# +# Uses following information from /etc/sysconfig/network-scripts/ifcfg-$1: +# IPV6TO4INIT=yes|no: controls configuration +# IPV6TO4_RELAY=IPv4addr: remote IPv6to4 relay address +# IPV6TO4_ROUTING="eth0-:f101::0/64 eth1-:f102::0/64": information to setup local subnetting +# IPV6TO4_CONTROL_RADVD=yes|no: controls radvd triggering +# IPV6TO4_RADVD_PIDFILE=file: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid" +# + + +if [ -z "$1" ]; then + echo $"Arg 1 is empty but should contain interface name - skip IPv6to4 initialization" >/dev/stderr + exit 1 +fi + +# Get global network configuration +. /etc/sysconfig/network + +# Source IPv4 helper functions +cd /etc/sysconfig/network-scripts +. network-functions + +CONFIG=$1 +[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG +source_config + +# Test if IPv6 is globally enabled +if [ ! "${NETWORKING_IPV6}" = "yes" ]; then + # Global IPv6 switch not enabled, end now + exit 0 +fi + +if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then + exit 1 +fi + +. /etc/sysconfig/network-scripts/network-functions-ipv6 + +# Run basic IPv6 test, if not ok, skip IPv6 initialization +test_ipv6 testonly || exit 0 + + +# Shutdown of 6to4, if configured +valid6to4config="yes" +if [ -z "$IPV6TO4_RELAY" ]; then + valid6to4config="no" +fi +if [ "$valid6to4config" = "yes" ]; then + # Beep + if [ -x /usr/bin/beep ]; then /usr/bin/beep -f 2666; else echo -en "\a" >/dev/console; fi + + if [ "$IPV6TO4_CONTROL_RADVD" = "yes" ]; then + # stop RADVD from distributing no longer usable 6to4 prefixes + if [ -z "$IPV6TO4_RADVD_PIDFILE" ]; then + # Take default + IPV6TO4_RADVD_PIDFILE="/var/run/radvd/radvd.pid" + fi + # Send SIGHUP to radvd + if [ -f "$IPV6TO4_RADVD_PIDFILE" ]; then + pid="`cat $IPV6TO4_RADVD_PIDFILE`" + if [ ! -z "$pid" ]; then + # still waiting for feature enabling: stopping distribution of prefixes in RADVD.... + # kill -SOMETHING $pid + false + else + false + fi + fi + fi + + # Delete all static IPv6to4 routes to relay + ifdown_ipv6_route_all sit0 ::$IPV6TO4_RELAY + + if [ ! -z "$IPV6TO4_ROUTING" ]; then + # Delete routes to local networks + for devsuf in $IPV6TO4_ROUTING; do + dev="`echo $devsuf | awk -F- '{ print $1 }'`" + ifdown_ipv6_route_all $dev :: + done + fi + + # Delete all configured 6to4 address + ifdown_ipv6to4_all sit0 + + # Beep + if [ -x /usr/bin/beep ]; then /usr/bin/beep -f 2000; else echo -en "\a" >/dev/console; fi +fi |