Skip to content

Commit

Permalink
ifup-routes: Use ip replace only on type route
Browse files Browse the repository at this point in the history
Since other types might fail due to `replace` to be undefined.

Related: #2034799
  • Loading branch information
jamacku authored and mergify[bot] committed Jan 21, 2022
1 parent 4e0a2fb commit 28f50e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions network-scripts/ifup-routes
Expand Up @@ -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
}
Expand Down

0 comments on commit 28f50e5

Please sign in to comment.