aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifup-routes
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2003-05-28 18:53:50 +0000
committerBill Nottingham <notting@redhat.com>2003-05-28 18:53:50 +0000
commite956fb172d00dc564cc50f2a33a0feb9ddd53839 (patch)
tree8316038834ff51a4d745dd867b4535ca94ea94b5 /sysconfig/network-scripts/ifup-routes
parent515094b273406277de12adc648846435e27ce389 (diff)
downloadinitscripts-e956fb172d00dc564cc50f2a33a0feb9ddd53839.tar
initscripts-e956fb172d00dc564cc50f2a33a0feb9ddd53839.tar.gz
initscripts-e956fb172d00dc564cc50f2a33a0feb9ddd53839.tar.bz2
initscripts-e956fb172d00dc564cc50f2a33a0feb9ddd53839.tar.xz
initscripts-e956fb172d00dc564cc50f2a33a0feb9ddd53839.zip
- make usernetctl use the nickname instead of the device name
- don't look in /etc/sysconfig/networking - fix calling of nameif before the device was loaded - clean up route handling (<harald@redhat.com>)
Diffstat (limited to 'sysconfig/network-scripts/ifup-routes')
-rwxr-xr-xsysconfig/network-scripts/ifup-routes37
1 files changed, 17 insertions, 20 deletions
diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes
index a1d1ae3b..5a11f4a7 100755
--- a/sysconfig/network-scripts/ifup-routes
+++ b/sysconfig/network-scripts/ifup-routes
@@ -2,7 +2,7 @@
#
# adds static routes which go through device $1
if [ -z "$1" ]; then
- echo $"usage: ifup-routes <net-device>"
+ echo $"usage: ifup-routes <net-device> [<nickname>]"
exit 1
fi
@@ -22,22 +22,19 @@ if [ -n "$2" -a "$2" != "$1" ]; then
fi
# Red Hat network configuration format
-
-CONFIG="/etc/sysconfig/networking/devices/$1.route"
-[ -f $CONFIG ] || CONFIG="/etc/sysconfig/networking/devices/$2.route"
-[ -f $CONFIG ] || exit 0
-
-. $CONFIG
-
-routenum=0
-while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
- eval `ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum)`
- line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
- if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
- line="$line via $(eval echo '$'GATEWAY$routenum)"
- fi
- line="$line dev $1"
- /sbin/ip route add $line
- routenum=$(($routenum+1))
-done
-
+NICK=${2:-$1}
+CONFIG="/etc/sysconfig/network-scripts/$NICK.route"
+if [ -f $CONFIG ]; then
+ . $CONFIG
+ routenum=0
+ while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
+ eval `ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum)`
+ line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
+ if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
+ line="$line via $(eval echo '$'GATEWAY$routenum)"
+ fi
+ line="$line dev $1"
+ /sbin/ip route add $line
+ routenum=$(($routenum+1))
+ done
+fi