aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifdown-ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/ifdown-ipv6')
-rwxr-xr-xsysconfig/network-scripts/ifdown-ipv6123
1 files changed, 62 insertions, 61 deletions
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6
index f06f56dd..1452da0e 100755
--- a/sysconfig/network-scripts/ifdown-ipv6
+++ b/sysconfig/network-scripts/ifdown-ipv6
@@ -58,80 +58,81 @@ ipv6_test testonly || exit 0
# Test device status
ipv6_test_device_status $DEVICE
if [ $? != 0 -a $? != 11 ]; then
- # device doesn't exist or other problem occurs
- exit 1
+ # device doesn't exist or other problem occurs
+ exit 1
fi
if [ ! "$IPV6_SET_SYCTL" = "no" ]; then
- # Switch some sysctls to secure mode
- /sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.forwarding=0 >/dev/null 2>&1
- /sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_ra=0 >/dev/null 2>&1
- /sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_redirects=0 >/dev/null 2>&1
+ # Switch some sysctls to secure mode
+ /sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.forwarding=0 >/dev/null 2>&1
+ /sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_ra=0 >/dev/null 2>&1
+ /sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_redirects=0 >/dev/null 2>&1
fi
/sbin/ip link set $DEVICE addrgenmode eui64 >/dev/null 2>&1
# Test status of tun6to4 device
ipv6_test_device_status tun6to4
if [ $? = 0 -o $? = 11 ]; then
- # Device exists
- valid6to4config="yes"
-
- if [ -z "$IPV6TO4_RELAY" ]; then
- IPV6TO4_RELAY="192.88.99.1"
- fi
-
- # Get IPv4 address from interface
- if [ -n "$IPV6TO4_IPV4ADDR" ]; then
- # Take special configured from config file (precedence 1)
- ipv4addr="$IPV6TO4_IPV4ADDR"
-
- # Get IPv4 address from interface first
- ipv4addrlocal="$(ipv6_get_ipv4addr_of_device $DEVICE)"
- if [ -z "$ipv4addrlocal" ]; then
- # Take configured from config file
- ipv4addrlocal="$IPADDR"
- fi
- else
- # Get IPv4 address from interface first (has precedence 2)
- ipv4addr="$(ipv6_get_ipv4addr_of_device $DEVICE)"
- if [ -z "$ipv4addr" ]; then
- # Take configured from config file (precedence 3)
- ipv4addr="$IPADDR"
- fi
- ipv4addrlocal="$ipv4addr"
- fi
-
- # Get local IPv4 address of dedicated tunnel
- ipv4addr6to4local="$(ipv6_get_ipv4addr_of_tunnel tun6to4 local)"
-
- if [ -z "$ipv4addrlocal" -o -z "$ipv4addr6to4local" ]; then
- # no IPv4 addresses given, 6to4 sure not configured
- valid6to4config="no"
- else
- # Check against configured 6to4 tunnel to see if this interface was used before
- if [ "$ipv4addrlocal" != "$ipv4addr6to4local" ]; then
- # IPv4 address of interface does't match local tunnel address, interface was not used for current 6to4 setup
- valid6to4config="no"
- fi
- fi
-
+ # Device exists
+ valid6to4config="yes"
+
+ if [ -z "$IPV6TO4_RELAY" ]; then
+ IPV6TO4_RELAY="192.88.99.1"
+ fi
+
+ # Get IPv4 address from interface
+ if [ -n "$IPV6TO4_IPV4ADDR" ]; then
+ # Take special configured from config file (precedence 1)
+ ipv4addr="$IPV6TO4_IPV4ADDR"
+
+ # Get IPv4 address from interface first
+ ipv4addrlocal="$(ipv6_get_ipv4addr_of_device $DEVICE)"
+ if [ -z "$ipv4addrlocal" ]; then
+ # Take configured from config file
+ ipv4addrlocal="$IPADDR"
+ fi
+ else
+ # Get IPv4 address from interface first (has precedence 2)
+ ipv4addr="$(ipv6_get_ipv4addr_of_device $DEVICE)"
+ if [ -z "$ipv4addr" ]; then
+ # Take configured from config file (precedence 3)
+ ipv4addr="$IPADDR"
+ fi
+ ipv4addrlocal="$ipv4addr"
+ fi
+
+ # Get local IPv4 address of dedicated tunnel
+ ipv4addr6to4local="$(ipv6_get_ipv4addr_of_tunnel tun6to4 local)"
+
+ if [ -z "$ipv4addrlocal" -o -z "$ipv4addr6to4local" ]; then
+ # no IPv4 addresses given, 6to4 sure not configured
+ valid6to4config="no"
+ else
+ # Check against configured 6to4 tunnel to see if this interface was
+ # used before
+ if [ "$ipv4addrlocal" != "$ipv4addr6to4local" ]; then
+ # IPv4 address of interface does't match local tunnel address,
+ # interface was not used for current 6to4 setup
+ valid6to4config="no"
+ fi
+ fi
fi
# Shutdown of 6to4, if configured
if [ "$valid6to4config" = "yes" ]; then
- if [ -n "$IPV6TO4_ROUTING" ]; then
- # Delete routes to local networks
- for devsuf in $IPV6TO4_ROUTING; do
- dev="${devsuf%%-*}"
- ipv6_cleanup_6to4_device $dev
- done
- fi
-
- # Delete all configured 6to4 address
- ipv6_cleanup_6to4_tunnels tun6to4
-
- # Control running radvd
- ipv6_trigger_radvd down "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
+ if [ -n "$IPV6TO4_ROUTING" ]; then
+ # Delete routes to local networks
+ for devsuf in $IPV6TO4_ROUTING; do
+ dev="${devsuf%%-*}"
+ ipv6_cleanup_6to4_device $dev
+ done
+ fi
+
+ # Delete all configured 6to4 address
+ ipv6_cleanup_6to4_tunnels tun6to4
+
+ # Control running radvd
+ ipv6_trigger_radvd down "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
fi
# Delete all current configured IPv6 addresses on this interface