diff options
author | Miloslav Trmac <mitr@volny.cz> | 2006-05-14 01:34:30 +0000 |
---|---|---|
committer | Miloslav Trmac <mitr@volny.cz> | 2006-05-14 01:34:30 +0000 |
commit | 599631bda00f650cdfc6e3f39d112efc0bb7c6bf (patch) | |
tree | f2139af6236f9fc2027276b8cf3994f0d9cb8aff /sysconfig/network-scripts/ifdown-ipv6 | |
parent | 906238c891d3f02b4c706457783694e3a01d91ce (diff) | |
download | initscripts-599631bda00f650cdfc6e3f39d112efc0bb7c6bf.tar initscripts-599631bda00f650cdfc6e3f39d112efc0bb7c6bf.tar.gz initscripts-599631bda00f650cdfc6e3f39d112efc0bb7c6bf.tar.bz2 initscripts-599631bda00f650cdfc6e3f39d112efc0bb7c6bf.tar.xz initscripts-599631bda00f650cdfc6e3f39d112efc0bb7c6bf.zip |
Modify IPV6TO4_ROUTING to also add addresses on the interfaces
Add RFC 3041 (IPv6 privacy) support
(patch for both by Peter Bieringer <pb@bieringer.de>)
Diffstat (limited to 'sysconfig/network-scripts/ifdown-ipv6')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-ipv6 | 84 |
1 files changed, 45 insertions, 39 deletions
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6 index b9120134..64ee246d 100755 --- a/sysconfig/network-scripts/ifdown-ipv6 +++ b/sysconfig/network-scripts/ifdown-ipv6 @@ -11,7 +11,7 @@ # # RHL integration assistance by Pekka Savola <pekkas@netcore.fi> # -# Version 2004-09-02 +# Version 2005-09-22 # # Note: if called as (like normally) by /etc/sysconfig/network-scripts/ifdown # exit codes aren't handled by "ifdown" @@ -25,7 +25,7 @@ # # Optional for 6to4 tunneling: # IPV6TO4_RELAY=<IPv4 address>: IPv4 address of the remote 6to4 relay [default: 192.88.99.1] -# IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup local subnetting +# IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup internal interfaces # # Optional for 6to4 tunneling links to trigger radvd: # IPV6_CONTROL_RADVD=yes|no: controls radvd triggering [optional] @@ -39,10 +39,10 @@ # -. /etc/sysconfig/network +. /etc/sysconfig/network cd /etc/sysconfig/network-scripts -. network-functions +. network-functions CONFIG=$1 [ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG @@ -74,45 +74,51 @@ ipv6_exec_sysctl -w net.ipv6.conf.$DEVICE.forwarding=0 >/dev/null 2>&1 ipv6_exec_sysctl -w net.ipv6.conf.$DEVICE.accept_ra=0 >/dev/null 2>&1 ipv6_exec_sysctl -w net.ipv6.conf.$DEVICE.accept_redirects=0 >/dev/null 2>&1 -# Shutdown of 6to4, if configured -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" +# Test status of tun6to4 device +ipv6_test_device_status tun6to4 +if [ $? = 0 -o $? = 11 ]; then + # Device exists + valid6to4config="yes" - # Get IPv4 address from interface first - ipv4addrlocal="`ipv6_get_ipv4addr_of_device $DEVICE`" - if [ -z "$ipv4addrlocal" ]; then - # Take configured from config file - ipv4addrlocal="$IPADDR" + if [ -z "$IPV6TO4_RELAY" ]; then + IPV6TO4_RELAY="192.88.99.1" 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" + + # 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 - ipv4addrlocal="$ipv4addr" -fi -# Get local IPv4 address of dedicated tunnel -ipv4addr6to4local="`ipv6_get_ipv4addr_of_tunnel tun6to4 local`" + # 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 + 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 @@ -121,16 +127,16 @@ if [ "$valid6to4config" = "yes" ]; then # Delete routes to local networks for devsuf in $IPV6TO4_ROUTING; do dev="`echo $devsuf | awk -F- '{ print $1 }'`" - ipv6_cleanup_routes $dev :: + ipv6_cleanup_6to4_device $dev done fi # Delete all configured 6to4 address - ipv6_cleanup_6to4_tunnels tun6to4 + 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 +# Delete all current configured IPv6 addresses on this interface ipv6_cleanup_device $DEVICE |