aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2022-01-19 14:39:24 +0100
committerJan Macku <jamacku@redhat.com>2022-01-24 13:58:18 +0100
commitfad68e06990907340d33f4915f8d84a84ceb0aea (patch)
treee6e55bf1f97622ea3dbe4ae0af6440835cf520c6
parentf03e9bcc8815d76a69d1eb87ff970e59eb0db8e5 (diff)
downloadinitscripts-fad68e06990907340d33f4915f8d84a84ceb0aea.tar
initscripts-fad68e06990907340d33f4915f8d84a84ceb0aea.tar.gz
initscripts-fad68e06990907340d33f4915f8d84a84ceb0aea.tar.bz2
initscripts-fad68e06990907340d33f4915f8d84a84ceb0aea.tar.xz
initscripts-fad68e06990907340d33f4915f8d84a84ceb0aea.zip
ifup-routes: Use `ip replace` only on type `route`
Since other types might fail due to `replace` to be undefined. (cherry picked from commit 28f50e5582f3641afac795e0e009fd22875b8dbb) Related: #2040679
-rwxr-xr-xnetwork-scripts/ifup-routes10
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
}