diff options
author | Phil Dibowitz <phil@ipom.com> | 2016-10-05 14:03:34 +0200 |
---|---|---|
committer | Lukáš Nykrýn <lnykryn@redhat.com> | 2016-10-12 14:29:30 +0200 |
commit | 13d11726c76577353e8b77d33d4f24555539f810 (patch) | |
tree | d1d5a49a3acce62e5521f312f6d70b30f1d67674 /sysconfig/network-scripts/ifdown-ipv6 | |
parent | f8476a8f02b4eaff13db1140162dec8a0d7336cd (diff) | |
download | initscripts-13d11726c76577353e8b77d33d4f24555539f810.tar initscripts-13d11726c76577353e8b77d33d4f24555539f810.tar.gz initscripts-13d11726c76577353e8b77d33d4f24555539f810.tar.bz2 initscripts-13d11726c76577353e8b77d33d4f24555539f810.tar.xz initscripts-13d11726c76577353e8b77d33d4f24555539f810.zip |
[1/3] Remove tabs and fix spacing: ipv6 scripts
The network-scripts are a mix of tabs and spaces (!!) as well as
completely inconsistent indentation (some 2, some 4).
This is a series of 3 patches to move the entire of network-scripts to
2-space indentation for consistency so I can develop on the codebase
without my brain bleeding. I don't feel strongly about 2 vs 4... 2 was
just most common in the first file I picked, so I used that.
This set is in 3 sets for easier reviewing and easier reverting if
necessary:
* 1/3 - ipv6 files
* 2/3 - network-functions - it needed it's own
* 3/3 - ifup/ifdown files
Diffstat (limited to 'sysconfig/network-scripts/ifdown-ipv6')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-ipv6 | 123 |
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 |