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/init.ipv6-global | |
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/init.ipv6-global')
-rwxr-xr-x | sysconfig/network-scripts/init.ipv6-global | 237 |
1 files changed, 117 insertions, 120 deletions
diff --git a/sysconfig/network-scripts/init.ipv6-global b/sysconfig/network-scripts/init.ipv6-global index fc916e87..8ec1d992 100755 --- a/sysconfig/network-scripts/init.ipv6-global +++ b/sysconfig/network-scripts/init.ipv6-global @@ -42,126 +42,123 @@ POSITION="$2" # Initialize IPv6, depending on caller option case $ACTION in - start) - case $POSITION in - pre) - # IPv6 test, module loaded, exit if system is not IPv6-ready - ipv6_test || exit 1 - - - if [ "$IPV6FORWARDING" = "yes" ]; then - ipv6_global_forwarding=1 - ipv6_global_auto=0 - else - ipv6_global_forwarding=0 - if [ "$IPV6_AUTOCONF" = "no" ]; then - ipv6_global_auto=0 - else - ipv6_global_auto=1 - fi - fi - - # Reset IPv6 sysctl switches for "all", "default" and still existing devices - if [ ! "$IPV6_SET_SYSCTLS" = "no" ]; then - for i in /proc/sys/net/ipv6/conf/* ; do - interface=${i##*/} - sinterface=${interface/.//} - # Host/Router behaviour for the interface - /sbin/sysctl -e -w net.ipv6.conf.$sinterface.forwarding=$ipv6_global_forwarding >/dev/null 2>&1 - - # Autoconfiguration and redirect handling for Hosts - /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_ra=$ipv6_global_auto >/dev/null 2>&1 - /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_redirects=$ipv6_global_auto >/dev/null 2>&1 - done - fi - ;; - - post) - # IPv6 test, module loaded, exit if system is not IPv6-ready - ipv6_test || exit 1 - - - if [ "$IPV6_AUTOTUNNEL" = "yes" ]; then - ipv6_enable_autotunnel - # autotunnel interface doesn't require a MTU setup - fi - - ## Add some routes which should never appear on the wire - # Unreachable IPv4-only addresses, normally blocked by source address selection - /sbin/ip route add unreach ::ffff:0.0.0.0/96 - # Unreachable IPv4-mapped addresses - /sbin/ip route add unreach ::0.0.0.0/96 - # Unreachable 6to4: IPv4 multicast, reserved, limited broadcast - /sbin/ip route add unreach 2002:e000::/19 - # Unreachable 6to4: IPv4 loopback - /sbin/ip route add unreach 2002:7f00::/24 - # Unreachable 6to4: IPv4 private (RFC 1918) - /sbin/ip route add unreach 2002:0a00::/24 - /sbin/ip route add unreach 2002:ac10::/28 - /sbin/ip route add unreach 2002:c0a8::/32 - # Unreachable 6to4: IPv4 private (APIPA / DHCP link-local) - /sbin/ip route add unreach 2002:a9fe::/32 - # Unreachable IPv6: 6bone test addresses - /sbin/ip route add unreach 3ffe:ffff::/32 - - # Set default route for autotunnel, if specified - if [ "$IPV6_DEFAULTDEV" = "sit0" -a "$IPV6_AUTOTUNNEL" = "yes" ]; then - if [ -n "$IPV6_DEFAULTGW" ]; then - ipv6_set_default_route $IPV6_DEFAULTGW $IPV6_DEFAULTDEV sit0 - elif [ -n "$IPV6_DEFAULTDEV" ]; then - ipv6_set_default_route "" $IPV6_DEFAULTDEV sit0 - fi - fi - ;; - - *) - echo "Usage: $0 $1 {pre|post}" - ;; - - esac - ;; - - stop) - case $POSITION in - pre) - ;; - - post) - # IPv6 test, no module loaded, exit if system is not IPv6-ready - ipv6_test testonly || exit 0 - - - if [ ! "$IPV6_SET_SYSCTLS" = "no" ]; then - for i in /proc/sys/net/ipv6/conf/* ; do - interface=${i##*/} - sinterface=${interface/.//} - # Assume Host behaviour - /sbin/sysctl -e -w net.ipv6.conf.$sinterface.forwarding=0 >/dev/null 2>&1 - - # Disable autoconfiguration and redirects - /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_ra=0 >/dev/null 2>&1 - /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_redirects=0 >/dev/null 2>&1 - done - fi - - # Cleanup still existing tunnel devices - ipv6_cleanup_tunnel_devices - - # Shut down generic tunnel interface now - if ipv6_test_device_status sit0 ; then - /sbin/ip link set sit0 down - fi - ;; - - *) - echo "Usage: $0 $1 {pre|post}" - ;; - - esac - ;; +start) + case $POSITION in + pre) + # IPv6 test, module loaded, exit if system is not IPv6-ready + ipv6_test || exit 1 + + if [ "$IPV6FORWARDING" = "yes" ]; then + ipv6_global_forwarding=1 + ipv6_global_auto=0 + else + ipv6_global_forwarding=0 + if [ "$IPV6_AUTOCONF" = "no" ]; then + ipv6_global_auto=0 + else + ipv6_global_auto=1 + fi + fi + + if [ ! "$IPV6_SET_SYSCTLS" = "no" ]; then + # Reset IPv6 sysctl switches for "all", "default" and still existing devices + for i in /proc/sys/net/ipv6/conf/* ; do + interface=${i##*/} + sinterface=${interface/.//} + # Host/Router behaviour for the interface + /sbin/sysctl -e -w net.ipv6.conf.$sinterface.forwarding=$ipv6_global_forwarding >/dev/null 2>&1 + + # Autoconfiguration and redirect handling for Hosts + /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_ra=$ipv6_global_auto >/dev/null 2>&1 + /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_redirects=$ipv6_global_auto >/dev/null 2>&1 + done + fi + ;; + + post) + # IPv6 test, module loaded, exit if system is not IPv6-ready + ipv6_test || exit 1 + + if [ "$IPV6_AUTOTUNNEL" = "yes" ]; then + ipv6_enable_autotunnel + # autotunnel interface doesn't require a MTU setup + fi + + ## Add some routes which should never appear on the wire + # Unreachable IPv4-only addresses, normally blocked by source address selection + /sbin/ip route add unreach ::ffff:0.0.0.0/96 + # Unreachable IPv4-mapped addresses + /sbin/ip route add unreach ::0.0.0.0/96 + # Unreachable 6to4: IPv4 multicast, reserved, limited broadcast + /sbin/ip route add unreach 2002:e000::/19 + # Unreachable 6to4: IPv4 loopback + /sbin/ip route add unreach 2002:7f00::/24 + # Unreachable 6to4: IPv4 private (RFC 1918) + /sbin/ip route add unreach 2002:0a00::/24 + /sbin/ip route add unreach 2002:ac10::/28 + /sbin/ip route add unreach 2002:c0a8::/32 + # Unreachable 6to4: IPv4 private (APIPA / DHCP link-local) + /sbin/ip route add unreach 2002:a9fe::/32 + # Unreachable IPv6: 6bone test addresses + /sbin/ip route add unreach 3ffe:ffff::/32 + + # Set default route for autotunnel, if specified + if [ "$IPV6_DEFAULTDEV" = "sit0" -a "$IPV6_AUTOTUNNEL" = "yes" ]; then + if [ -n "$IPV6_DEFAULTGW" ]; then + ipv6_set_default_route $IPV6_DEFAULTGW $IPV6_DEFAULTDEV sit0 + elif [ -n "$IPV6_DEFAULTDEV" ]; then + ipv6_set_default_route "" $IPV6_DEFAULTDEV sit0 + fi + fi + ;; *) - echo $"Usage: $0 {start|stop|reload|restart|showsysctl}" - exit 1 - ;; + echo "Usage: $0 $1 {pre|post}" + ;; + + esac + ;; + +stop) + case $POSITION in + pre) + ;; + + post) + # IPv6 test, no module loaded, exit if system is not IPv6-ready + ipv6_test testonly || exit 0 + + if [ ! "$IPV6_SET_SYSCTLS" = "no" ]; then + for i in /proc/sys/net/ipv6/conf/* ; do + interface=${i##*/} + sinterface=${interface/.//} + # Assume Host behaviour + /sbin/sysctl -e -w net.ipv6.conf.$sinterface.forwarding=0 >/dev/null 2>&1 + + # Disable autoconfiguration and redirects + /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_ra=0 >/dev/null 2>&1 + /sbin/sysctl -e -w net.ipv6.conf.$sinterface.accept_redirects=0 >/dev/null 2>&1 + done + fi + + # Cleanup still existing tunnel devices + ipv6_cleanup_tunnel_devices + + # Shut down generic tunnel interface now + if ipv6_test_device_status sit0 ; then + /sbin/ip link set sit0 down + fi + ;; + + *) + echo "Usage: $0 $1 {pre|post}" + ;; + + esac + ;; + +*) + echo $"Usage: $0 {start|stop|reload|restart|showsysctl}" + exit 1 + ;; esac |