diff options
author | Bill Nottingham <notting@redhat.com> | 2002-08-21 21:20:13 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2002-08-21 21:20:13 +0000 |
commit | 3471bd66f89a36e1638f59500876f3810b7425d3 (patch) | |
tree | db24ea42b4106e5f9a92443d43d15af4c5c93f5b /sysconfig/network-scripts/ifup-routes | |
parent | 8350e01996a8faa927c3ae8e60b494dfb237a3a2 (diff) | |
download | initscripts-3471bd66f89a36e1638f59500876f3810b7425d3.tar initscripts-3471bd66f89a36e1638f59500876f3810b7425d3.tar.gz initscripts-3471bd66f89a36e1638f59500876f3810b7425d3.tar.bz2 initscripts-3471bd66f89a36e1638f59500876f3810b7425d3.tar.xz initscripts-3471bd66f89a36e1638f59500876f3810b7425d3.zip |
use the other file redhat-config-network writes by default; leave
route-<foo> for user customization (<pbrown@redhat.com>, others)
Diffstat (limited to 'sysconfig/network-scripts/ifup-routes')
-rwxr-xr-x | sysconfig/network-scripts/ifup-routes | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes index 657aa661..f6734375 100755 --- a/sysconfig/network-scripts/ifup-routes +++ b/sysconfig/network-scripts/ifup-routes @@ -1,22 +1,31 @@ #! /bin/bash # # adds static routes which go through device $1 - if [ -z "$1" ]; then echo $"usage: ifup-routes <net-device>" exit 1 fi -[ -f "/etc/sysconfig/network-scripts/route-$1" ] || exit 0 +CONFIG="/etc/sysconfig/networking/devices/$1.route" +[ -f $CONFIG ] || exit 0 + +. $CONFIG + +# Red Hat network configuration format +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 + +# Older format while read line; do /sbin/ip route add $line done < "/etc/sysconfig/network-scripts/route-$1" - -# XXX old version: -#grep "^$1[[:space:]]" /etc/sysconfig/static-routes | while read device args; do -# /sbin/route add -$args $device -#done -#grep "^any[[:space:]]" /etc/sysconfig/static-routes | while read ignore args ; do -# /sbin/route add -$args -#done |