From 64fe18391b02a6aa723025712fce4c396d15642a Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 21 Mar 2002 03:17:09 +0000 Subject: IPv6 updates. --- ppp/ip-down.ipv6to4 | 11 +++--- sysconfig.txt | 4 +-- sysconfig/network-scripts/ifup-ipv6 | 2 +- sysconfig/network-scripts/network-functions-ipv6 | 43 +++++++++++++----------- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/ppp/ip-down.ipv6to4 b/ppp/ip-down.ipv6to4 index de2c6085..268ff5d0 100644 --- a/ppp/ip-down.ipv6to4 +++ b/ppp/ip-down.ipv6to4 @@ -87,10 +87,13 @@ fi # Get local IPv4 address of dedicated tunnel ipv4addr6to4local="`ipv6_get_ipv4addr_of_tunnel tun6to4 local`" -# Check against configured 6to4 tunnel to see if this interface was used before -if [ "$ipv4addr" != "$ipv4addr6to4local" ]; then - # IPv4 address of interface does't match local tunnel address, interface was not used for current 6to4 setup - valid6to4config="no" +# IPv6to4 not enabled on this interface? +if [ $IPV6TO4INIT != "yes" ]; then + # Check against configured 6to4 tunnel to see if this interface was regardless used before + if [ "$ipv4addr" != "$ipv4addr6to4local" ]; then + # IPv4 address of interface does't match local tunnel address, interface was not used for current 6to4 setup + valid6to4config="no" + fi fi if [ "$valid6to4config" = "yes" ]; then diff --git a/sysconfig.txt b/sysconfig.txt index be7ac832..5840f8ba 100644 --- a/sysconfig.txt +++ b/sysconfig.txt @@ -207,7 +207,7 @@ Files in /etc/sysconfig Examples: IPV6_DEFAULTDEV="eth0" INVALID example! IPV6_DEFAULTDEV="ppp0" - IPV6_DEFAULTDEV="sit0" + IPV6_DEFAULTDEV="sit1" Examples for 6to4 IPV6_DEFAULTDEV="tun6to4" Add default route through dedicated 6to4 tunnel device "tun6to4", if configured @@ -546,7 +546,7 @@ Files in /etc/sysconfig/network-scripts/ IPV6ADDR="3ffe:ffff:0:5::1" IPV6ADDR="3ffe:ffff:0:1::1/128" IPV6ADDR_SECONDARIES="[/] ..." (optional) - A list of secondary IPv6 addresses (perhaps useful for virtual hosting) + A list of secondary IPv6 addresses (e.g. useful for virtual hosting) Example: IPV6ADDR_SECONDARIES="3ffe:ffff:0:1::10 3ffe:ffff:0:2::11/128" IPV6_MTU= (optional) diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6 index dc628341..ff45d683 100755 --- a/sysconfig/network-scripts/ifup-ipv6 +++ b/sysconfig/network-scripts/ifup-ipv6 @@ -202,7 +202,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then # Setup 6to4 tunnel (hardwired name is "tun6to4"), if config is valid if [ "$valid6to4config" = "yes" ]; then - ipv6_add_6to4_tunnel tun6to4 $ipv4addr + ipv6_add_6to4_tunnel tun6to4 $ipv4addr || exit 1 # Add default route, if device matches if [ "$IPV6_DEFAULTDEV" = "tun6to4" ]; then diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6 index dd1bd823..5c71b6ea 100644 --- a/sysconfig/network-scripts/network-functions-ipv6 +++ b/sysconfig/network-scripts/network-functions-ipv6 @@ -162,10 +162,10 @@ ipv6_log() { ##### Test for "ipv6calc" (used for better existing address detection) EXISTS_ipv6calc=no - if which ipv6calc >/dev/null 2>&1; then - if ipv6calc --if_inet62addr 3ffe04000100f1010000000000000001 40 | LC_ALL=C grep -q -v '3ffe:400:100:f101::1/64'; then + if [ -x /bin/ipv6calc ]; then + if /bin/ipv6calc --if_inet62addr 3ffeffff0100f1010000000000000001 40 | LC_ALL=C grep -q -v '3ffe:ffff:100:f101::1/64'; then false - elif ipv6calc --addr2if_inet6 3ffe:400:100::1/64 | LC_ALL=C grep -q -v '3ffe0400010000000000000000000001 00 40'; then + elif /bin/ipv6calc --addr2if_inet6 3ffe:ffff:100::1/64 | LC_ALL=C grep -q -v '3ffeffff010000000000000000000001 00 40'; then false else EXISTS_ipv6calc=yes @@ -204,8 +204,13 @@ ipv6_test() { return 2 fi - if ! which ip 2>&1 >/dev/null; then - ipv6_log $"Utility 'ip' (from iproute-package) doesn't exist or isn't executable - stop" crit $fn + if [ ! -x /sbin/ip ]; then + ipv6_log $"Utility 'ip' (package: iproute) doesn't exist or isn't executable - stop" crit $fn + return 2 + fi + + if [ ! -x /sbin/sysctl ]; then + ipv6_log $"Utility 'sysctl' (package: procps) doesn't exist or isn't executable - stop" crit $fn return 2 fi @@ -213,7 +218,7 @@ ipv6_test() { } -##### Get version of this function libary +##### Get version of this function library # stdout: getversion_ipv6_functions() { local version_ipv6_functions="`cat /etc/sysconfig/network-scripts/network-functions-ipv6 | LC_ALL=C grep "^# Version:" | awk '{ print $3 }' | sed 's/-//g' | sed 's/[A-Za-z]*$//g'`" @@ -228,7 +233,7 @@ getversion_ipv6_functions() { ipv6_exec_ifconfig() { local options=$* - LC_ALL=C ifconfig $options 2>&1 + LC_ALL=C /sbin/ifconfig $options 2>&1 return $? } @@ -240,7 +245,7 @@ ipv6_exec_ifconfig() { ipv6_exec_route() { local options=$* - LC_ALL=C route $options 2>&1 + LC_ALL=C /sbin/route $options 2>&1 return $? } @@ -252,7 +257,7 @@ ipv6_exec_route() { ipv6_exec_ip() { local options=$* - LC_ALL=C ip $options 2>&1 + LC_ALL=C /sbin/ip $options 2>&1 return $? } @@ -264,7 +269,7 @@ ipv6_exec_ip() { ipv6_exec_sysctl() { local options=$* - LC_ALL=C sysctl $options 2>&1 + LC_ALL=C /sbin/sysctl $options 2>&1 return $? } @@ -557,7 +562,7 @@ ipv6_test_addr_exists_on_device() { if [ "$EXISTS_ipv6calc" = "yes" ]; then # Using ipv6calc and compare against /proc/net/if_inet6 - local convertresult="`ipv6calc --addr2if_inet6 $testaddr/$testprefix`" + local convertresult="`/bin/ipv6calc --addr2if_inet6 $testaddr/$testprefix`" # Split in address, scope and prefix length local test_addr="`echo $convertresult | awk '{ print $1 }'`" @@ -806,7 +811,7 @@ ipv6_test_ipv6_addr_valid() { local address_implicit="`echo $testipv6addr_valid | awk -F/ '{ print $1 }'`" if [ "$EXISTS_ipv6calc" = "yes" ]; then - if ! ipv6calc --addr2uncompaddr $testipv6addr_valid >/dev/null 2>&1; then + if ! /bin/ipv6calc --addr2uncompaddr $testipv6addr_valid >/dev/null 2>&1; then if [ "$modequiet" != "quiet" ]; then ipv6_log $"Given IPv6 address '$testipv6addr_valid' is not valid" err $fn fi @@ -907,19 +912,19 @@ ipv6_test_ipv4_addr_global_usable() { # Test for a globally usable IPv4 address now # test 0.0.0.0/8 - ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=0\.0\.0\.0" && return 10 + /bin/ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=0\.0\.0\.0" && return 10 # test 10.0.0.0/8 (RFC 1918 / private) - ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=10\.0\.0\.0" && return 10 + /bin/ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=10\.0\.0\.0" && return 10 # test 127.0.0.0/8 (loopback) - ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=127\.0\.0\.0" && return 10 + /bin/ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=127\.0\.0\.0" && return 10 # test 169.254.0.0/16 (APIPA / DHCP link local) - ipcalc --network $testipv4addr_globalusable 255.255.0.0 | LC_ALL=C grep -q "NETWORK=169\.254\.0\.0" && return 10 + /bin/ipcalc --network $testipv4addr_globalusable 255.255.0.0 | LC_ALL=C grep -q "NETWORK=169\.254\.0\.0" && return 10 # test 172.16.0.0/12 (RFC 1918 / private) - ipcalc --network $testipv4addr_globalusable 255.240.0.0 | LC_ALL=C grep -q "NETWORK=172\.16\.0\.0" && return 10 + /bin/ipcalc --network $testipv4addr_globalusable 255.240.0.0 | LC_ALL=C grep -q "NETWORK=172\.16\.0\.0" && return 10 # test 192.168.0.0/16 (RFC 1918 / private) - ipcalc --network $testipv4addr_globalusable 255.255.0.0 | LC_ALL=C grep -q "NETWORK=192\.168\.0\.0" && return 10 + /bin/ipcalc --network $testipv4addr_globalusable 255.255.0.0 | LC_ALL=C grep -q "NETWORK=192\.168\.0\.0" && return 10 # test 224.0.0.0/3 (multicast and reserved, broadcast) - ipcalc --network $testipv4addr_globalusable 224.0.0.0 | LC_ALL=C grep -q "NETWORK=224\.0\.0\.0" && return 10 + /bin/ipcalc --network $testipv4addr_globalusable 224.0.0.0 | LC_ALL=C grep -q "NETWORK=224\.0\.0\.0" && return 10 return 0 } -- cgit v1.2.1