From 28f50e5582f3641afac795e0e009fd22875b8dbb Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Wed, 19 Jan 2022 14:39:24 +0100 Subject: ifup-routes: Use `ip replace` only on type `route` Since other types might fail due to `replace` to be undefined. Related: #2034799 --- network-scripts/ifup-routes | 10 ++++++---- 1 file 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 } -- cgit v1.2.1