aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppp/ip-down.ipv6to46
-rw-r--r--ppp/ip-up.ipv6to428
-rw-r--r--ppp/ipv6-down8
-rw-r--r--ppp/ipv6-up43
-rwxr-xr-xsysconfig/network-scripts/ifdown-ipv68
-rwxr-xr-xsysconfig/network-scripts/ifdown-sit10
-rwxr-xr-xsysconfig/network-scripts/ifup-ipv648
-rwxr-xr-xsysconfig/network-scripts/ifup-sit8
-rwxr-xr-xsysconfig/network-scripts/init.ipv6-global4
-rw-r--r--sysconfig/network-scripts/network-functions-ipv665
10 files changed, 108 insertions, 120 deletions
diff --git a/ppp/ip-down.ipv6to4 b/ppp/ip-down.ipv6to4
index 268ff5d0..fa640d7a 100644
--- a/ppp/ip-down.ipv6to4
+++ b/ppp/ip-down.ipv6to4
@@ -9,7 +9,7 @@
# You will find more information in the IPv6-HowTo for Linux at
# http://www.bieringer.de/linux/IPv6/
#
-# Version 2002-01-25
+# Version 2002-10-30
#
# Calling parameters:
# $1: interface name
@@ -30,7 +30,7 @@
#
# IPV6_CONTROL_RADVD=yes|no: controls radvd triggering
# IPV6_RADVD_PIDFILE=<file>: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid"
-# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd [optional, default is SIGHUP]
+# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd (optional, default is SIGHUP)
#
@@ -105,7 +105,7 @@ if [ "$valid6to4config" = "yes" ]; then
ipv6_trigger_radvd down "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
fi
- if [ ! -z "$IPV6TO4_ROUTING" ]; then
+ if [ -n "$IPV6TO4_ROUTING" ]; then
# Delete routes to local networks
for devsuf in $IPV6TO4_ROUTING; do
dev="`echo $devsuf | awk -F- '{ print $1 }'`"
diff --git a/ppp/ip-up.ipv6to4 b/ppp/ip-up.ipv6to4
index 79d99c03..da0ba48e 100644
--- a/ppp/ip-up.ipv6to4
+++ b/ppp/ip-up.ipv6to4
@@ -9,7 +9,7 @@
# You will find more information in the IPv6-HowTo for Linux at
# http://www.bieringer.de/linux/IPv6/
#
-# Version 2002-01-25
+# Version 2002-11-02
#
# Calling parameters:
# $1: interface name
@@ -26,13 +26,13 @@
# Uses following information from /etc/sysconfig/network-scripts/ifcfg-$1:
# IPV6TO4INIT=yes|no: controls configuration
# IPV6TO4_IPV4ADDR=<IPv4 address>: special local address for 6to4 tunneling (only needed behind a NAT gateway)
-# IPV6TO4_RELAY=<IPv4 address>: remote 6to4 relay router address [default: 192.88.99.1]
+# IPV6TO4_RELAY=<IPv4 address>: remote 6to4 relay router address (default: 192.88.99.1)
# IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup local subnetting
# Example: IPV6TO4_ROUTING="eth0-:f101::0/64 eth1-:f102::0/64"
#
# IPV6_CONTROL_RADVD=yes|no: controls radvd triggering
# IPV6_RADVD_PIDFILE=<file>: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid"
-# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd [optional, default is SIGHUP]
+# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd (optional, default is SIGHUP)
#
# Requirements
# radvd-0.6.2p3 or newer supporting option "Base6to4Interface"
@@ -75,25 +75,25 @@ ipv6_test || exit 1
# Setup of 6to4, if configured
valid6to4config="yes"
if [ "$IPV6TO4INIT" = "yes" ]; then
- if [ ! -z "$IPV6TO4_IPV4ADDR" ]; then
- # Take special configured from config file (precedence 1)
+ if [ -n "$IPV6TO4_IPV4ADDR" ]; then
+ # Take 6to4-dedicated configured IPv4 address from config file (precedence 1)
ipv4addr="$IPV6TO4_IPV4ADDR"
else
- # Get IPv4 address from interface first (has precedence 2)
- ipv4addr="`LC_ALL=C ifconfig $DEVICE |grep "inet addr:" | tr : " " | awk '{ print $3 }'`"
+ # Get IPv4 address from interface (precedence 2)
+ ipv4addr="`ipv6_get_ipv4addr_of_device $DEVICE`"
if [ -z "$ipv4addr" ]; then
- # Take configured from config file (precedence 3)
+ # Take configured IPv4 address of interface from config file (precedence 3)
ipv4addr="$IPADDR"
fi
fi
- if [ ! -z "$ipv4addr" ]; then
+ if [ -n "$ipv4addr" ]; then
# Test for non-global IPv4 address
if ! ipv6_test_ipv4_addr_global_usable $ipv4addr; then
- echo $"Given IPv4 address '$ipv4addr' is not globally usable, 6to4 configuration is not valid"
+ echo $"Given IPv4 address '$ipv4addr' is not globally usable"
valid6to4config="no"
fi
else
- echo $"IPv6to4 configuration needs an IPv4 address on related interface or otherwise specified, 6to4 configuration is not valid"
+ echo $"IPv6to4 configuration needs an IPv4 address on related interface or otherwise specified"
valid6to4config="no"
fi
if [ -z "$IPV6TO4_RELAY" ]; then
@@ -124,7 +124,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
# Add default route, if device matches
if [ "$IPV6_DEFAULTDEV" = "tun6to4" ]; then
- if [ ! -z "$IPV6_DEFAULTGW" ]; then
+ if [ -n "$IPV6_DEFAULTGW" ]; then
echo $"Warning: interface 'tun6to4' does not support 'IPV6_DEFAULTGW', ignored"
fi
ipv6_set_default_route $ipv6to4_relay tun6to4
@@ -151,10 +151,10 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
# Control running radvd
ipv6_trigger_radvd up "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
- if [ ! -z "$IPV6TO4_ROUTING" ]; then
+ if [ -n "$IPV6TO4_ROUTING" ]; then
# Generate 6to4 address
ipv6to4prefix="`ipv6_create_6to4_prefix $ipv4addr`"
- if [ ! -z "$ipv6to4prefix" ]; then
+ if [ -n "$ipv6to4prefix" ]; then
# Add route to local networks
for devsuf in $IPV6TO4_ROUTING; do
dev="`echo $devsuf | awk -F- '{ print $1 }'`"
diff --git a/ppp/ipv6-down b/ppp/ipv6-down
index 1261537b..1798a3d7 100644
--- a/ppp/ipv6-down
+++ b/ppp/ipv6-down
@@ -2,14 +2,14 @@
# This file should not be modified -- make local changes to
# /etc/ppp/ipv6-down.local instead
+# Version: 2002-10-30
+
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
LOGDEVICE=$6
REALDEVICE=$1
-[ -x /etc/ppp/ipv6-up.local ] && /etc/ppp/ipv6-up.local "$@"
-
[ -x /etc/sysconfig/network-scripts/ifdown-ipv6 ] || exit 0
[ -f /etc/sysconfig/network ] || exit 0
. /etc/sysconfig/network
@@ -17,12 +17,14 @@ REALDEVICE=$1
cd /etc/sysconfig/network-scripts
. network-functions
-. /etc/sysconfig/network-scripts/network-functions-ipv6
+. network-functions-ipv6
CONFIG=$1
[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
source_config
+[ -x /etc/ppp/ipv6-down.local ] && /etc/ppp/ipv6-down.local "$@"
+
/etc/sysconfig/network-scripts/ifdown-ipv6 $REALDEVICE
if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
diff --git a/ppp/ipv6-up b/ppp/ipv6-up
index ebc454c9..6f1f0463 100644
--- a/ppp/ipv6-up
+++ b/ppp/ipv6-up
@@ -2,35 +2,32 @@
# This file should not be modified -- make local changes to
# /etc/ppp/ipv6-up.local instead
+# Version: 2002-10-30
+
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
LOGDEVICE=$6
REALDEVICE=$1
-# Setup IPv6
-if [ -f /etc/sysconfig/network ]; then
- . /etc/sysconfig/network
-
- if [ "${NETWORKING_IPV6}" = "yes" -a -x /etc/sysconfig/network-scripts/ifup-ipv6 ]; then
- # Source IPv4 helper functions
- cd /etc/sysconfig/network-scripts
- . network-functions
-
- # Source IPv6 helper functions
- . /etc/sysconfig/network-scripts/network-functions-ipv6
-
- CONFIG=$1
- [ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
- source_config
-
- /etc/sysconfig/network-scripts/ifup-ipv6 $REALDEVICE
-
- if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
- # Control running radvd
- ipv6_trigger_radvd up "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
- fi
- fi
+[ -x /etc/sysconfig/network-scripts/ifup-ipv6 ] || exit 0
+[ -f /etc/sysconfig/network ] || exit 0
+. /etc/sysconfig/network
+[ "${NETWORKING_IPV6}" = "yes" ] || exit 0
+
+cd /etc/sysconfig/network-scripts
+. network-functions
+. network-functions-ipv6
+
+CONFIG=$1
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
+source_config
+
+/etc/sysconfig/network-scripts/ifup-ipv6 $REALDEVICE
+
+if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
+ # Control running radvd
+ ipv6_trigger_radvd up "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
fi
[ -x /etc/ppp/ipv6-up.local ] && /etc/ppp/ipv6-up.local "$@"
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6
index f40d6b21..375ee78e 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 2002-04-12
+# Version 2002-10-30
#
# Note: if called as (like normally) by /etc/sysconfig/network-scripts/ifdown
# exit codes aren't handled by "ifdown"
@@ -56,8 +56,6 @@ REALDEVICE=`echo ${DEVICE} | sed 's/:.*//g'`
[ "${NETWORKING_IPV6}" = "yes" ] || exit 0
[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
-
-# Source IPv6 helper functions
. /etc/sysconfig/network-scripts/network-functions-ipv6
@@ -83,7 +81,7 @@ if [ -z "$IPV6TO4_RELAY" ]; then
fi
# Get IPv4 address from interface
-if [ ! -z "$IPV6TO4_IPV4ADDR" ]; then
+if [ -n "$IPV6TO4_IPV4ADDR" ]; then
# Take special configured from config file (precedence 1)
ipv4addr="$IPV6TO4_IPV4ADDR"
else
@@ -111,7 +109,7 @@ fi
# Shutdown of 6to4, if configured
if [ "$valid6to4config" = "yes" ]; then
- if [ ! -z "$IPV6TO4_ROUTING" ]; then
+ if [ -n "$IPV6TO4_ROUTING" ]; then
# Delete routes to local networks
for devsuf in $IPV6TO4_ROUTING; do
dev="`echo $devsuf | awk -F- '{ print $1 }'`"
diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit
index 521217ce..2059f96a 100755
--- a/sysconfig/network-scripts/ifdown-sit
+++ b/sysconfig/network-scripts/ifdown-sit
@@ -11,7 +11,7 @@
#
# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
#
-# Version 2002-01-25
+# Version 2002-11-01
#
# Uses following information from /etc/sysconfig/network:
# NETWORKING_IPV6=yes|no: controls IPv6 initialization (global setting)
@@ -21,10 +21,8 @@
#
-# Get global network configuration
. /etc/sysconfig/network
-# Source IPv4 helper functions
cd /etc/sysconfig/network-scripts
. network-functions
@@ -39,11 +37,7 @@ REALDEVICE=`echo ${DEVICE} | sed 's/:.*//g'`
# Test whether IPv6 should be configured, else stop
[ "$NETWORKING_IPV6" = "yes" ] || exit 0
-if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then
- exit 1
-fi
-
-# Source IPv6 helper functions
+[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
. /etc/sysconfig/network-scripts/network-functions-ipv6
diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6
index ff45d683..e8960553 100755
--- a/sysconfig/network-scripts/ifup-ipv6
+++ b/sysconfig/network-scripts/ifup-ipv6
@@ -11,13 +11,15 @@
#
# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
#
-# Version 2002-01-25
+# Version 2002-11-02
#
# Note: if called (like normally) by /etc/sysconfig/network-scripts/ifup
# exit codes aren't handled by "ifup"
#
# Uses following information from "/etc/sysconfig/network":
# NETWORKING_IPV6=yes|no: controls IPv6 initialization (global setting)
+# IPV6_DEFAULTDEV=<device>: controls default route (optional)
+# IPV6_DEFAULTGW=<address>: controls default route (optional)
#
# Uses following information from "/etc/sysconfig/network-scripts/ifcfg-$1":
# IPV6INIT=yes|no: controls IPv6 configuration for this interface
@@ -28,19 +30,19 @@
# defaults:
# IPV6FORWARDING=yes: IPV6_AUTOCONF=no, IPV6_ROUTER=yes
# IPV6FORWARDING=no: IPV6_AUTOCONF=yes
-# IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link [optional]
+# IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link (optional)
#
# Optional for 6to4 tunneling (hardwired name of tunnel device is "tun6to4"):
# IPV6TO4INIT=yes|no: controls 6to4 tunneling setup
-# IPV6TO4_RELAY=<IPv4 address>: IPv4 address of the remote 6to4 relay [default: 192.88.99.1]
-# IPV6TO4_IPV4ADDR=<IPv4 address>: overwrite local IPv4 address [optional]
+# IPV6TO4_RELAY=<IPv4 address>: IPv4 address of the remote 6to4 relay (default: 192.88.99.1)
+# IPV6TO4_IPV4ADDR=<IPv4 address>: overwrite local IPv4 address (optional)
# IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup local subnetting
# Example: IPV6TO4_ROUTING="eth0-:f101::0/64 eth1-:f102::0/64"
#
# Optional for 6to4 tunneling to trigger radvd:
-# IPV6_CONTROL_RADVD=yes|no: controls radvd triggering [optional]
-# IPV6_RADVD_PIDFILE=<file>: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid" [optional]
-# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd [optional, default is SIGHUP]
+# IPV6_CONTROL_RADVD=yes|no: controls radvd triggering (optional)
+# IPV6_RADVD_PIDFILE=<file>: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid" (optional)
+# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd (optional, default is SIGHUP)
#
# Required version of radvd to use 6to4 prefix recalculation
# 0.6.2p3 or newer supporting option "Base6to4Interface"
@@ -49,10 +51,8 @@
#
-# Get global network configuration
. /etc/sysconfig/network
-# Source IPv4 helper functions
cd /etc/sysconfig/network-scripts
. network-functions
@@ -70,11 +70,7 @@ REALDEVICE=`echo ${DEVICE} | sed 's/:.*//g'`
# Test whether IPv6 should be configured, else stop
[ "${NETWORKING_IPV6}" = "yes" ] || exit 0
-if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then
- exit 1
-fi
-
-# Source IPv6 helper functions
+[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
. /etc/sysconfig/network-scripts/network-functions-ipv6
@@ -134,19 +130,19 @@ ipv6_exec_sysctl -w net.ipv6.conf.$DEVICE.accept_ra=$ipv6_local_auto >/dev/null
ipv6_exec_sysctl -w net.ipv6.conf.$DEVICE.accept_redirects=$ipv6_local_auto >/dev/null
# Set IPv6 MTU, if given
-if [ ! -z "$IPV6_MTU" ]; then
+if [ -n "$IPV6_MTU" ]; then
ipv6_set_mtu $DEVICE $IPV6_MTU
fi
# Setup additional IPv6 addresses from list, if given
-if [ ! -z "$IPV6ADDR_SECONDARIES" ]; then
+if [ -n "$IPV6ADDR_SECONDARIES" ]; then
for ipv6addr in $IPV6ADDR_SECONDARIES; do
ipv6_add_addr_on_device $DEVICE $ipv6addr
done
fi
# Setup default IPv6 route, check are done by function
-if [ ! -z "$IPV6_DEFAULTDEV" -o ! -z "$IPV6_DEFAULTGW" ]; then
+if [ -n "$IPV6_DEFAULTDEV" -o -n "$IPV6_DEFAULTGW" ]; then
ipv6_set_default_route "$IPV6_DEFAULTGW" "$IPV6_DEFAULTDEV" "$DEVICE"
fi
@@ -170,7 +166,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
fi
# Get IPv4 address for local 6to4 prefix calculation
- if [ ! -z "$IPV6TO4_IPV4ADDR" ]; then
+ if [ -n "$IPV6TO4_IPV4ADDR" ]; then
# Take special configured from config file (precedence 1)
ipv4addr="$IPV6TO4_IPV4ADDR"
else
@@ -181,9 +177,9 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
ipv4addr="$IPADDR"
fi
fi
- if [ ! -z "$ipv4addr" ]; then
+ if [ -n "$ipv4addr" ]; then
if ! ipv6_test_ipv4_addr_global_usable $ipv4addr; then
- echo $"Given IPv4 address '$ipv4addr' is not globally usable, 6to4 configuration is not valid"
+ echo $"Given IPv4 address '$ipv4addr' is not globally usable"
valid6to4config="no"
fi
if [ -z "$IPV6TO4_RELAY" ]; then
@@ -196,7 +192,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
valid6to4config="no"
fi
else
- echo $"IPv6to4 configuration needs an IPv4 address on related interface or otherwise specified, 6to4 configuration is not valid"
+ echo $"IPv6to4 configuration needs an IPv4 address on related interface or otherwise specified"
valid6to4config="no"
fi
@@ -206,9 +202,9 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
# Add default route, if device matches
if [ "$IPV6_DEFAULTDEV" = "tun6to4" ]; then
- if [ ! -z "$IPV6_DEFAULTGW" ]; then
- echo $"Warning: interface 'tun6to4' does not support 'IPV6_DEFAULTGW', ignored"
- fi
+ if [ -n "$IPV6_DEFAULTGW" ]; then
+ echo $"Warning: interface 'tun6to4' does not support 'IPV6_DEFAULTGW', ignored"
+ fi
ipv6_set_default_route $ipv6to4_relay tun6to4
fi
@@ -235,9 +231,9 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
echo $"Using 6to4 and RADVD IPv6 forwarding usually should be enabled, but it isn't"
fi
- if [ ! -z "$IPV6TO4_ROUTING" ]; then
+ if [ -n "$IPV6TO4_ROUTING" ]; then
ipv6to4prefix="`ipv6_create_6to4_prefix $ipv4addr`"
- if [ ! -z "$ipv6to4prefix" ]; then
+ if [ -n "$ipv6to4prefix" ]; then
# Add route to local networks
for devsuf in $IPV6TO4_ROUTING; do
dev="`echo $devsuf | awk -F- '{ print $1 }'`"
diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit
index b26432c2..ada8b086 100755
--- a/sysconfig/network-scripts/ifup-sit
+++ b/sysconfig/network-scripts/ifup-sit
@@ -8,15 +8,17 @@
#
# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
#
-# Version 2002-01-25
+# Version 2002-11-01
#
# Uses following information from /etc/sysconfig/network:
# NETWORKING_IPV6=yes|no: controls IPv6 initialization (global setting)
+# IPV6_DEFAULTDEV=<device>: controls default route (optional)
+# IPV6_DEFAULTGW=<address>: controls default route (optional)
#
# Uses following information from /etc/sysconfig/network-scripts/ifcfg-$1:
# DEVICE=<device>
# IPV6INIT=yes|no: controls IPv6 configuration for this interface
-# IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link [optional]
+# IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link (optional)
#
# For static tunnels
# IPV6TUNNELIPV4=<IPv4 address>: IPv4 address of remote tunnel endpoint
@@ -25,10 +27,8 @@
#
-# Get global network configuration
. /etc/sysconfig/network
-# Source IPv4 helper functions
cd /etc/sysconfig/network-scripts
. network-functions
diff --git a/sysconfig/network-scripts/init.ipv6-global b/sysconfig/network-scripts/init.ipv6-global
index 262bc2f7..407e6d07 100755
--- a/sysconfig/network-scripts/init.ipv6-global
+++ b/sysconfig/network-scripts/init.ipv6-global
@@ -11,7 +11,7 @@
#
# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
#
-# Version 2002-01-25
+# Version 2002-10-30
#
# Calling parameters:
# $1: action (currently supported: start|stop|showsysctl)
@@ -31,10 +31,8 @@
-# Get global network configuration
. /etc/sysconfig/network
-# Source IPv4 helper functions
cd /etc/sysconfig/network-scripts
. network-functions
diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6
index 70a6d9f3..f6f83476 100644
--- a/sysconfig/network-scripts/network-functions-ipv6
+++ b/sysconfig/network-scripts/network-functions-ipv6
@@ -5,10 +5,10 @@
# Taken from: network-functions-ipv6
# (P) & (C) 1997-2002 by Peter Bieringer <pb@bieringer.de>
#
-# Version: 2002-01-25
+# Version: 2002-11-02
#
# Extended address detection is enabled, if 'ipv6calc' is installed
-# Available here: http://www.bieringer.de/linux/IPv6/tools/index.html#ipv6calc
+# Available here: http://www.bieringer.de/linux/IPv6/ipv6calc/
#
#
@@ -269,7 +269,7 @@ ipv6_exec_ip() {
ipv6_exec_sysctl() {
local options=$*
- LC_ALL=C /sbin/sysctl $options 2>&1
+ LC_ALL=C /sbin/sysctl -e $options 2>&1
return $?
}
@@ -307,7 +307,7 @@ ipv6_control_forwarding() {
# Global control? (if no device is given)
if [ -z "$fw_device" ]; then
- ipv6_exec_sysctl -w -e net.ipv6.conf.all.forwarding=$status >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.all.forwarding=$status >/dev/null
fi
# Per device control (not implemented in kernel)
@@ -487,9 +487,9 @@ ipv6_enable_autotunnel() {
fi
# Set sysctls proper (regardless "default")
- ipv6_exec_sysctl -w -e net.ipv6.conf.sit0.forwarding=1 >/dev/null
- ipv6_exec_sysctl -w -e net.ipv6.conf.sit0.accept_ra=0 >/dev/null
- ipv6_exec_sysctl -w -e net.ipv6.conf.sit0.accept_redirects=0 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.sit0.forwarding=1 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.sit0.accept_ra=0 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.sit0.accept_redirects=0 >/dev/null
fi
return 0
@@ -514,9 +514,9 @@ ipv6_disable_autotunnel() {
true
else
# take down basic tunnel device
- ipv6_exec_sysctl -w -e net.ipv6.conf.sit0.forwarding=0 >/dev/null
- ipv6_exec_sysctl -w -e net.ipv6.conf.sit0.accept_ra=0 >/dev/null
- ipv6_exec_sysctl -w -e net.ipv6.conf.sit0.accept_redirects=0 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.sit0.forwarding=0 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.sit0.accept_ra=0 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.sit0.accept_redirects=0 >/dev/null
ipv6_exec_ifconfig sit0 down
@@ -671,7 +671,7 @@ ipv6_add_addr_on_device() {
else
ipv6_exec_ifconfig $device up
- if ! test_interface_status $device; then
+ if ! ipv6_test_device_status $device; then
ipv6_log $"Device '$device' enabling didn't work" err $fn
return 3
fi
@@ -1145,18 +1145,6 @@ ipv6_del_6to4_tunnel() {
ipv6_test || return 2
- # generate 6to4 address
- local prefix6to4="`ipv6_create_6to4_prefix $localipv4`"
- if [ $? -ne 0 -o -z "$prefix6to4" ]; then
- return 3
- fi
-
- if [ -z "$localipv6to4suffix" ]; then
- local address6to4="$prefix6to4::1/16"
- else
- local address6to4="${prefix6to4}::${localipv6to4suffix}/16"
- fi
-
ipv6_del_tunnel_device tun6to4
local retval=$?
@@ -1235,9 +1223,9 @@ ipv6_add_tunnel_device() {
fi
# Set sysctls proper (regardless "default")
- ipv6_exec_sysctl -w -e net.ipv6.conf.$device.forwarding=1 >/dev/null
- ipv6_exec_sysctl -w -e net.ipv6.conf.$device.accept_ra=0 >/dev/null
- ipv6_exec_sysctl -w -e net.ipv6.conf.$device.accept_redirects=0 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.$device.forwarding=1 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.$device.accept_ra=0 >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.$device.accept_redirects=0 >/dev/null
if [ -n "$addressipv6local" ]; then
# Setup P-t-P address
@@ -1437,7 +1425,7 @@ ipv6_set_mtu() {
fi
# Set value
- ipv6_exec_sysctl -w -e net.ipv6.conf.$device.mtu=$ipv6_mtu >/dev/null
+ ipv6_exec_sysctl -w net.ipv6.conf.$device.mtu=$ipv6_mtu >/dev/null
return 0
}
@@ -1472,7 +1460,7 @@ ipv6_set_default_route() {
fi
# Scope device has precedence
- if [ -n "$device_scope" -a ! -z "$device" -a "$device_scope" != "$device" ]; then
+ if [ -n "$device_scope" -a -n "$device" -a "$device_scope" != "$device" ]; then
ipv6_log $"Given IPv6 default gateway '$address' has scope '$device_scope' defined, given default gateway device '$device' will be not used" inf $fn
local device=""
fi
@@ -1579,7 +1567,7 @@ ipv6_test_route_requires_next_hop() {
# $2: [startstop|restart|reload|SIGHUP] : triger mechanism (default is "SIGHUP")
# "startstop" : reason=up -> start, reason=down -> stop
# $3: [<filename>] : alternative pid file [optional]
-# return code: 0=ok 1=argument error 2=IPv6 test fails 3=major problem 10=need no explicit hop
+# return code: 0=ok 1=argument error 2=IPv6 test fails 3=major problem
ipv6_trigger_radvd() {
local fn="ipv6_trigger_radvd"
@@ -1630,7 +1618,12 @@ ipv6_trigger_radvd() {
# PID file needed?
if [ "$action" = "SIGHUP" ]; then
if ! [ -f "$pidfile" ]; then
- ipv6_log $"Given pidfile '$pidfile' doesn't exist, cannot send trigger to radvd" err $fn
+ if [ "$reason" = "down" ]; then
+ # be quiet because triggering may have been disabled
+ true
+ else
+ ipv6_log $"Given pidfile '$pidfile' doesn't exist, cannot send trigger to radvd" err $fn
+ fi
return 3
fi
@@ -1650,7 +1643,17 @@ ipv6_trigger_radvd() {
kill -HUP $pid
;;
'reload'|'restart'|'stop'|'start')
- service radvd $action >/dev/null 2>&1
+ if ! /sbin/chkconfig --list radvd >/dev/null 2>&1; then
+ if [ "$reason" = "down" ]; then
+ # be quiet because triggering may have been disabled
+ true
+ else
+ ipv6_log $"radvd not (properly) installed, triggering failed" err $fn
+ fi
+ return 3
+ else
+ /sbin/service radvd $action >/dev/null 2>&1
+ fi
;;
*)
# Normally not reached, "action" is set above to proper value