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-21 14:44:50 +0100
commit1151f3ee6dc1f1f890f78b5ea8eedfa7edab3190 (patch)
tree5232450476515f49b383834c8d70826d56163045
parent6c7ed5a546cdf31b237236129f9cd9491955a9b6 (diff)
downloadinitscripts-1151f3ee6dc1f1f890f78b5ea8eedfa7edab3190.tar
initscripts-1151f3ee6dc1f1f890f78b5ea8eedfa7edab3190.tar.gz
initscripts-1151f3ee6dc1f1f890f78b5ea8eedfa7edab3190.tar.bz2
initscripts-1151f3ee6dc1f1f890f78b5ea8eedfa7edab3190.tar.xz
initscripts-1151f3ee6dc1f1f890f78b5ea8eedfa7edab3190.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) Resolves: #2034799
-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
}