diff options
author | Jan Macku <jamacku@redhat.com> | 2022-01-12 13:39:53 +0100 |
---|---|---|
committer | Jan Macku <jamacku@redhat.com> | 2022-01-12 14:34:15 +0100 |
commit | a31060817ef8b03814b240442811ea5caa082d1c (patch) | |
tree | 0f723f4f2e9d690d1433add9d29c9dce212be203 /network-scripts | |
parent | a71dcfd392cc1022c255208fdd94a0fc6c13ceb0 (diff) | |
download | initscripts-a31060817ef8b03814b240442811ea5caa082d1c.tar initscripts-a31060817ef8b03814b240442811ea5caa082d1c.tar.gz initscripts-a31060817ef8b03814b240442811ea5caa082d1c.tar.bz2 initscripts-a31060817ef8b03814b240442811ea5caa082d1c.tar.xz initscripts-a31060817ef8b03814b240442811ea5caa082d1c.zip |
ifup-routes: Log when using `ip $type replace`
Follow-up to #401
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 } |