diff options
Diffstat (limited to 'sysconfig/network-scripts/ifdown-sit')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-sit | 77 |
1 files changed, 49 insertions, 28 deletions
diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit index a70d5169..a2a70c16 100755 --- a/sysconfig/network-scripts/ifdown-sit +++ b/sysconfig/network-scripts/ifdown-sit @@ -6,13 +6,24 @@ # Taken from: # (P) & (C) 2000-2001 by Peter Bieringer <pb@bieringer.de> # -# Version 2001-02-08 +# RHL integration assistance by Pekka Savola <pekkas@netcore.fi> +# +# Version 2001-05-22d +# +# 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": +# For static tunnels +# IPV6TUNNELIPV4="<ipv4 address of foreign tunnel endpoint>" +# IPV6ADDR=<ipv6address>/<prefixlength> [OPTIONAL: numbered tunnels] # -# Filter tags (for stripping, empty lines following if all is stripped) +# Get global network configuration . /etc/sysconfig/network +# Source IPv4 helper functions cd /etc/sysconfig/network-scripts . network-functions @@ -20,33 +31,43 @@ CONFIG=$1 [ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG source_config -# Test if IPv6 configuration is enabled for this interface -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 - - # Delete IPv6-in-IPv4 tunnel(s) - if [ "$DEVICE" = "sit0" ]; then - ifdown_ipv6_autotunnel - elif [ ! -z "$IPV6TUNNELIPV4" ]; then - # Delete static IPv6 tunnel routes on specified virtual interface - if [ -f /etc/sysconfig/static-routes-ipv6 ]; then - grep "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device ipv6route args; do - if [ "$device" = "$DEVICE" ]; then - ifdown_ipv6_tunnel $DEVICE $IPV6TUNNELIPV4 $ipv6route - fi - done +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 + # IPv6 setup isn't well + exit 1 +fi + +# Source IPv6 helper functions +. /etc/sysconfig/network-scripts/network-functions-ipv6 + +# IPv6 test, no module loaded, exit if system is not IPv6-ready +test_ipv6 testonly || exit 0 + +# Delete IPv6-in-IPv4 tunnel(s) +if [ "$DEVICE" = "sit0" ]; then + ifdown_ipv6_autotunnel +elif [ ! -z "$IPV6TUNNELIPV4" ]; then + if [ "$IPV6_TUNNELMODE" = "NBMA" ]; then + if [ ! -z "$IPV6ADDR" ]; then + # Numbered tunnel + ifdown_ipv6_real sit0 $IPV6ADDR fi - if [ ! -z "$IPV6ADDR" ]; then - # Numbered tunnel - ifdown_ipv6_real sit0 $IPV6ADDR + # Cleanup all IPv6 tunnel configuration on specified interface and shut down sit0, if no longer used + ifdown_ipv6_tunnel_all $DEVICE $IPV6TUNNELIPV4 + + elif [ -z "$IPV6_TUNNELMODE" -o "$IPV6_TUNNELMODE" = "IP" ]; then + # Delete all IPv6 routes and addresses + ifdown_ipv6_real_all $DEVICE + + # Shut down tunnel device + ifdown_ipv6_tunneldev $DEVICE + else + echo $"Tunnel creation mode '$IPV6_TUNNELMODE' not supported - skip!" fi - fi -fi +fi |