diff options
Diffstat (limited to 'network-scripts')
-rwxr-xr-x | network-scripts/ifup-routes | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/network-scripts/ifup-routes b/network-scripts/ifup-routes index e88ea9d5..5cc9187b 100755 --- a/network-scripts/ifup-routes +++ b/network-scripts/ifup-routes @@ -2,6 +2,8 @@ # # adds static routes which go through device $1 +. /etc/sysconfig/network-scripts/network-functions + if [ -z "$1" ]; then echo $"usage: ifup-routes <net-device> [<nickname>]" exit 1 @@ -19,7 +21,12 @@ handle_file () { line="$line via $(eval echo '$'GATEWAY$routenum)" fi line="$line dev $2" - /sbin/ip route replace $line + + /sbin/ip route add "$line" || { + net_log $"Failed to add route ${line}, using ip route replace instead." warning + /sbin/ip route replace "$line" + } + routenum=$(($routenum+1)) done } @@ -34,7 +41,10 @@ handle_ip_file() { fi { cat "$file" ; echo ; } | while read line; do if [[ ! "$line" =~ $MATCH ]]; then - /sbin/ip $proto $type replace $line + /sbin/ip $proto "$type" add "$line" || { + net_log $"Failed to add ${type} ${line}, using ip ${type} replace instead." warning + /sbin/ip $proto "$type" replace "$line" + } fi done } |