aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2011-03-11 12:06:09 -0500
committerLukas Nykryn <lnykryn@redhat.com>2012-02-09 14:03:31 +0100
commit3f8312adfda15f8c140e142ac95dee8b59555464 (patch)
treeeff41c13fdc0db4d36806174874cffca1287376e /sysconfig
parent18b6ec9737e9bdbbcea0a3b0f51eb68922102e53 (diff)
downloadinitscripts-3f8312adfda15f8c140e142ac95dee8b59555464.tar
initscripts-3f8312adfda15f8c140e142ac95dee8b59555464.tar.gz
initscripts-3f8312adfda15f8c140e142ac95dee8b59555464.tar.bz2
initscripts-3f8312adfda15f8c140e142ac95dee8b59555464.tar.xz
initscripts-3f8312adfda15f8c140e142ac95dee8b59555464.zip
Support ipv6 routing rules by merging IPv4/IPv6, and route/rule code. (#680872, <tobiasoed@hotmail.com>)
Conflicts: sysconfig/network-scripts/ifup-ipv6
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifdown-routes10
-rwxr-xr-xsysconfig/network-scripts/ifup-ipv67
-rwxr-xr-xsysconfig/network-scripts/ifup-routes39
3 files changed, 30 insertions, 26 deletions
diff --git a/sysconfig/network-scripts/ifdown-routes b/sysconfig/network-scripts/ifdown-routes
index 00e592f7..3c62498a 100755
--- a/sysconfig/network-scripts/ifdown-routes
+++ b/sysconfig/network-scripts/ifdown-routes
@@ -12,16 +12,20 @@ fi
MATCH='^[[:space:]]*(\#.*)?$'
# Routing rules
-FILES="/etc/sysconfig/network-scripts/rule-$1"
+FILES="/etc/sysconfig/network-scripts/rule-$1 /etc/sysconfig/network-scripts/rule6-$1"
if [ -n "$2" -a "$2" != "$1" ]; then
- FILES="$FILES /etc/sysconfig/network-scripts/rule-$2"
+ FILES="$FILES /etc/sysconfig/network-scripts/rule-$2 /etc/sysconfig/network-scripts/rule6-$2"
fi
for file in $FILES; do
if [ -f "$file" ]; then
+ proto=
+ if [ "$file" != "${file##*/rule6-}" ]; then
+ proto="-6"
+ fi
{ cat "$file" ; echo ; } | while read line; do
if [[ ! "$line" =~ $MATCH ]]; then
- /sbin/ip rule del $line
+ /sbin/ip $proto rule del $line
fi
done
fi
diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6
index 78f304bf..672d6734 100755
--- a/sysconfig/network-scripts/ifup-ipv6
+++ b/sysconfig/network-scripts/ifup-ipv6
@@ -159,13 +159,6 @@ if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
done
fi
-# Setup additional static IPv6 routes (newer config style)
-if [ -f "/etc/sysconfig/network-scripts/route6-$DEVICE" ]; then
- cat "/etc/sysconfig/network-scripts/route6-$DEVICE" | sed 's/#.*//g' | grep -v '^[[:space:]]*$' | while read line; do
- /sbin/ip -6 route add $line
- done
-fi
-
# Setup of 6to4, if configured
if [ "$IPV6TO4INIT" = "yes" ]; then
valid6to4config="yes"
diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes
index 1aa7f718..d79e35f7 100755
--- a/sysconfig/network-scripts/ifup-routes
+++ b/sysconfig/network-scripts/ifup-routes
@@ -6,6 +6,8 @@ if [ -z "$1" ]; then
exit 1
fi
+MATCH='^[[:space:]]*(\#.*)?$'
+
handle_file () {
. $1
routenum=0
@@ -21,13 +23,26 @@ handle_file () {
done
}
-FILES="/etc/sysconfig/network-scripts/route-$1"
+handle_ip_file() {
+ local f t type= file=$1 proto="-4"
+ f=${file##*/}
+ t=${f%%-*}
+ type=${t%%6}
+ if [ "$type" != "$t" ]; then
+ proto="-6"
+ fi
+ { cat "$file" ; echo ; } | while read line; do
+ if [[ ! "$line" =~ $MATCH ]]; then
+ /sbin/ip $proto $type add $line
+ fi
+ done
+}
+
+FILES="/etc/sysconfig/network-scripts/route-$1 /etc/sysconfig/network-scripts/route6-$1"
if [ -n "$2" -a "$2" != "$1" ]; then
- FILES="$FILES /etc/sysconfig/network-scripts/route-$2"
+ FILES="$FILES /etc/sysconfig/network-scripts/route-$2 /etc/sysconfig/network-scripts/route6-$2"
fi
-MATCH='^[[:space:]]*(\#.*)?$'
-
for file in $FILES; do
if [ -f "$file" ]; then
if egrep -q '^[[:space:]]*ADDRESS[0-9]+=' $file ; then
@@ -35,11 +50,7 @@ for file in $FILES; do
handle_file $file ${1%:*}
else
# older format
- { cat "$file" ; echo ; } | while read line; do
- if [[ ! "$line" =~ $MATCH ]]; then
- /sbin/ip route add $line
- fi
- done
+ handle_ip_file $file
fi
fi
done
@@ -52,17 +63,13 @@ CONFIG="/etc/sysconfig/network-scripts/$NICK.route"
# Routing rules
-FILES="/etc/sysconfig/network-scripts/rule-$1"
+FILES="/etc/sysconfig/network-scripts/rule-$1 /etc/sysconfig/network-scripts/rule6-$1"
if [ -n "$2" -a "$2" != "$1" ]; then
- FILES="$FILES /etc/sysconfig/network-scripts/rule-$2"
+ FILES="$FILES /etc/sysconfig/network-scripts/rule-$2 /etc/sysconfig/network-scripts/rule6-$2"
fi
for file in $FILES; do
if [ -f "$file" ]; then
- { cat "$file" ; echo ; } | while read line; do
- if [[ ! "$line" =~ $MATCH ]]; then
- /sbin/ip rule add $line
- fi
- done
+ handle_ip_file $file
fi
done