diff options
-rwxr-xr-x | sysconfig/network-scripts/ifdown-ipv6 | 6 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifdown-sit | 4 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-ipv6 | 6 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-sit | 4 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions-ipv6 | 54 |
5 files changed, 33 insertions, 41 deletions
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6 index a4396aa7..45c7f24d 100755 --- a/sysconfig/network-scripts/ifdown-ipv6 +++ b/sysconfig/network-scripts/ifdown-ipv6 @@ -6,7 +6,7 @@ # Taken from: # (P) & (C) 2000-2001 by Peter Bieringer <pb@bieringer.de> # -# Version 2001-02-02 +# Version 2001-02-08 # . /etc/sysconfig/network @@ -45,13 +45,13 @@ if [ "${NETWORKING_IPV6}" = "yes" ]; then # Delete additional IPv6 addresses from list if [ ! -z "$IPV6ADDR_SECONDARIES" ]; then for ipv6addr in $IPV6ADDR_SECONDARIES; do - ifdown_ipv6_real $DEVICE $ipv6addr $IPV6PREFIXLENGTH + ifdown_ipv6_real $DEVICE $ipv6addr done fi # Shutdown basic configured IPv6 address on specified interface if ! [ -z "$IPV6ADDR" ]; then - ifdown_ipv6_real $DEVICE $IPV6ADDR $IPV6PREFIXLENGTH + ifdown_ipv6_real $DEVICE $IPV6ADDR fi # Cleanup all IPv6 configuration on specified interface (prevents from kernel crashing) diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit index c2323362..a70d5169 100755 --- a/sysconfig/network-scripts/ifdown-sit +++ b/sysconfig/network-scripts/ifdown-sit @@ -6,7 +6,7 @@ # Taken from: # (P) & (C) 2000-2001 by Peter Bieringer <pb@bieringer.de> # -# Version 2001-02-03 +# Version 2001-02-08 # # Filter tags (for stripping, empty lines following if all is stripped) @@ -46,7 +46,7 @@ if [ "${NETWORKING_IPV6}" = "yes" ]; then if [ ! -z "$IPV6ADDR" ]; then # Numbered tunnel - ifdown_ipv6_real sit0 $IPV6ADDR $IPV6PREFIXLENGTH + ifdown_ipv6_real sit0 $IPV6ADDR fi fi fi diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6 index 4ef124ae..ce3fec5e 100755 --- a/sysconfig/network-scripts/ifup-ipv6 +++ b/sysconfig/network-scripts/ifup-ipv6 @@ -6,7 +6,7 @@ # Taken from: # (P) & (C) 2000-2001 by Peter Bieringer <pb@bieringer.de> # -# Version 2001-02-02 +# Version 2001-02-08 # # Filter tags (for stripping, empty lines following if all is stripped) @@ -33,7 +33,7 @@ if [ "${NETWORKING_IPV6}" = "yes" ]; then # Setup IPv6 address on specified interface if ! [ -z "$IPV6ADDR" ]; then - ifup_ipv6_real $DEVICE $IPV6ADDR $IPV6PREFIXLENGTH + ifup_ipv6_real $DEVICE $IPV6ADDR fi # Switch forwarding per device like defined @@ -51,7 +51,7 @@ if [ "${NETWORKING_IPV6}" = "yes" ]; then # Setup additional IPv6 addresses from list if [ ! -z "$IPV6ADDR_SECONDARIES" ]; then for ipv6addr in $IPV6ADDR_SECONDARIES; do - ifup_ipv6_real $DEVICE $ipv6addr $IPV6PREFIXLENGTH + ifup_ipv6_real $DEVICE $ipv6addr done fi diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit index 8a1daa56..5e13ae3c 100755 --- a/sysconfig/network-scripts/ifup-sit +++ b/sysconfig/network-scripts/ifup-sit @@ -6,7 +6,7 @@ # Taken from: # (P) & (C) 2000-2001 by Peter Bieringer <pb@bieringer.de> # -# Version 2001-02-06 +# Version 2001-02-08 # # Filter tags (for stripping, empty lines following if all is stripped) @@ -37,7 +37,7 @@ if [ "${NETWORKING_IPV6}" = "yes" ]; then elif [ ! -z "$IPV6TUNNELIPV4" ]; then if [ ! -z "$IPV6ADDR" ]; then # Numbered tunnel - ifup_ipv6_real sit0 $IPV6ADDR $IPV6PREFIXLENGTH + ifup_ipv6_real sit0 $IPV6ADDR fi # Add static IPv6 tunnel routes on specified virtual interface diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6 index aa6bb35e..be4ce3ff 100644 --- a/sysconfig/network-scripts/network-functions-ipv6 +++ b/sysconfig/network-scripts/network-functions-ipv6 @@ -5,10 +5,9 @@ # Taken from: # (P) & (C) 1997-2001 by Peter Bieringer <pb@bieringer.de> # -# Version: 2001-02-05 +# Version: 2001-02-08 # - # Filter tags (for stripping, empty lines following if all is stripped) @@ -32,12 +31,12 @@ function test_ipv6() modprobe ipv6 if ! [ -f /proc/net/if_inet6 ]; then - echo $"Kernel is not compiled with IPv6 support" + echo $"Kernel is not compiled with IPv6 support" return 2 fi fi - # Test for IPv6 enabled needed binaries + return 0 } @@ -119,7 +118,7 @@ function ifup_ipv6_route() { fi if [ -z $gatewayipv6 ]; then - echo "Missing parameter 'IPv6-gateway'" + echo $"Missing parameter 'IPv6-gateway'" ifupdown_ipv6_route_usage return 1 fi @@ -315,17 +314,15 @@ function ifdown_ipv6_tunnel() { ##### Interface configuration function ifupdown_ipv6_usage() { - echo $"Usage: $0 interfacename IPv6-address [IPv6-prefixlength]" + echo $"Usage: $0 interfacename IPv6-address/IPv6-prefixlength" } ## Add an IPv6 address for given interface # $1: Interface # $2: IPv6 address -# $3: IPv6 prefix length (optional) function ifup_ipv6_real() { device=$1 address=$2 - prefixlength=$3 if [ -z $device ]; then echo $"Missing parameter 'device'" @@ -357,16 +354,17 @@ function ifup_ipv6_real() { prefixlength_implicit="`echo $address | awk -F/ '{ print $2 }'`" address_implicit="`echo $address | awk -F/ '{ print $1 }'`" - # Overwrite optional given one - if [ ! -z $prefixlength_implicit ]; then - prefixlength=$prefixlength_implicit - elif [ -z $prefixlength ]; then - prefixlength=128 + # Test for prefix length + if [ -z $prefixlength_implicit ]; then + echo $"Missing 'prefix length' for given address" + ifupdown_ipv6_usage + return 1 + elif [ $prefixlength_implicit -lt 0 -o $prefixlength_implicit -gt 128 ]; then + echo $"'prefix length' on given address is out of range (0-128)" + ifupdown_ipv6_usage + return 1 fi - # Build IPv6 address - address="$address_implicit/$prefixlength" - # Run IPv6 test test_ipv6 || return @@ -381,8 +379,6 @@ function ifup_ipv6_real() { ifconfig $device add $address || return 2 fi -# route -A inet6 add $address/$prefixlength dev $device || return 2 - } @@ -417,11 +413,9 @@ function ifdown_ipv6_real_all() { ## Remove an IPv6 address on given interface # $1: Interface # $2: IPv6 address -# $3: IPv6 prefix length (optional) function ifdown_ipv6_real() { device=$1 address=$2 - prefixlength=$3 if [ -z $device ]; then echo $"Missing parameter 'device'" @@ -444,23 +438,21 @@ function ifdown_ipv6_real() { prefixlength_implicit="`echo $address | awk -F/ '{ print $2 }'`" address_implicit="`echo $address | awk -F/ '{ print $1 }'`" - # Overwrite optional given one - if [ ! -z $prefixlength_implicit ]; then - prefixlength=$prefixlength_implicit - elif [ -z $prefixlength ]; then - prefixlength=128 + # Test for prefix length + if [ -z $prefixlength_implicit ]; then + echo $"Missing 'prefix length' for given address" + ifupdown_ipv6_usage + return 1 + elif [ $prefixlength_implicit -lt 0 -o $prefixlength_implicit -gt 128 ]; then + echo $"'prefix length' on given address is out of range (0-128)" + ifupdown_ipv6_usage + return 1 fi - # Build IPv6 address - address="$address_implicit/$prefixlength" - # Run IPv6 test test_ipv6 || return -# -# route -A inet6 del $address/$prefixlength dev $device || return 2 - # Only remove, if address exists and is not link-local (prevents from kernel crashing) address_configured="`ifconfig $device | grep "inet6 addr:" | grep "$address" | awk '{ print $3 }'`" address_configured_type="`ifconfig $device | grep "inet6 addr:" | grep "$address" | awk '{ print $4 }'`" |