diff options
author | Jan Macku <jamacku@redhat.com> | 2022-01-12 13:39:53 +0100 |
---|---|---|
committer | Jan Macku <jamacku@redhat.com> | 2022-01-14 18:52:17 +0100 |
commit | f03e9bcc8815d76a69d1eb87ff970e59eb0db8e5 (patch) | |
tree | a3922147d0415d3d8123cc9f418b8c51aa669e5c /network-scripts | |
parent | 66530245e2cc8b58b49b8de748423f2f88c5edae (diff) | |
download | initscripts-f03e9bcc8815d76a69d1eb87ff970e59eb0db8e5.tar initscripts-f03e9bcc8815d76a69d1eb87ff970e59eb0db8e5.tar.gz initscripts-f03e9bcc8815d76a69d1eb87ff970e59eb0db8e5.tar.bz2 initscripts-f03e9bcc8815d76a69d1eb87ff970e59eb0db8e5.tar.xz initscripts-f03e9bcc8815d76a69d1eb87ff970e59eb0db8e5.zip |
ifup-routes: Log when using `ip $type replace`
(cherry picked from commit a31060817ef8b03814b240442811ea5caa082d1c)
Resolves: #2040679
Diffstat (limited to 'network-scripts')
-rwxr-xr-x | network-scripts/ifup-routes | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/network-scripts/ifup-routes b/network-scripts/ifup-routes index e88ea9d5..5cc9187b 100755 --- a/network-scripts/ifup-routes +++ b/network-scripts/ifup-routes @@ -2,6 +2,8 @@ # # adds static routes which go through device $1 +. /etc/sysconfig/network-scripts/network-functions + if [ -z "$1" ]; then echo $"usage: ifup-routes <net-device> [<nickname>]" exit 1 @@ -19,7 +21,12 @@ handle_file () { line="$line via $(eval echo '$'GATEWAY$routenum)" fi line="$line dev $2" - /sbin/ip route replace $line + + /sbin/ip route add "$line" || { + net_log $"Failed to add route ${line}, using ip route replace instead." warning + /sbin/ip route replace "$line" + } + routenum=$(($routenum+1)) done } @@ -34,7 +41,10 @@ handle_ip_file() { fi { cat "$file" ; echo ; } | while read line; do if [[ ! "$line" =~ $MATCH ]]; then - /sbin/ip $proto $type replace $line + /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" + } fi done } |