diff options
author | Jan Macku <jamacku@redhat.com> | 2022-01-19 14:39:24 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-01-21 13:17:50 +0000 |
commit | 28f50e5582f3641afac795e0e009fd22875b8dbb (patch) | |
tree | c7056162b218209499336cbfed68bb6132c4664f | |
parent | 4e0a2fb2e457c7e7f660ec5e612df46640b148f5 (diff) | |
download | initscripts-28f50e5582f3641afac795e0e009fd22875b8dbb.tar initscripts-28f50e5582f3641afac795e0e009fd22875b8dbb.tar.gz initscripts-28f50e5582f3641afac795e0e009fd22875b8dbb.tar.bz2 initscripts-28f50e5582f3641afac795e0e009fd22875b8dbb.tar.xz initscripts-28f50e5582f3641afac795e0e009fd22875b8dbb.zip |
ifup-routes: Use `ip replace` only on type `route`
Since other types might fail due to `replace` to be undefined.
Related: #2034799
-rwxr-xr-x | network-scripts/ifup-routes | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/network-scripts/ifup-routes b/network-scripts/ifup-routes index 5cc9187b..4a90ad07 100755 --- a/network-scripts/ifup-routes +++ b/network-scripts/ifup-routes @@ -41,10 +41,12 @@ handle_ip_file() { fi { cat "$file" ; echo ; } | while read line; do if [[ ! "$line" =~ $MATCH ]]; then - /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" - } + /sbin/ip $proto "$type" add "$line" + + if [ $? != 0 ] && [ "$type" == "route" ] ; then + net_log $"Failed to add route ${line}, using ip route replace instead." warning + /sbin/ip $proto route replace "$line" + fi fi done } |