diff options
author | Jan Macku <jamacku@redhat.com> | 2022-01-12 13:39:53 +0100 |
---|---|---|
committer | Jan Macku <jamacku@redhat.com> | 2022-01-12 14:40:37 +0100 |
commit | 33d3b47bdf31afafcb805a312cd498570d77f913 (patch) | |
tree | ebf5bc0b90d11eec71d9fb1bd688a6a3a2a6775d /network-scripts/ifup-routes | |
parent | babc15492a84903810989c5b4d923c0ca443cf41 (diff) | |
download | initscripts-33d3b47bdf31afafcb805a312cd498570d77f913.tar initscripts-33d3b47bdf31afafcb805a312cd498570d77f913.tar.gz initscripts-33d3b47bdf31afafcb805a312cd498570d77f913.tar.bz2 initscripts-33d3b47bdf31afafcb805a312cd498570d77f913.tar.xz initscripts-33d3b47bdf31afafcb805a312cd498570d77f913.zip |
ifup-routes: Log when using `ip $type replace`
Follow-up to #401
Related: #2034799
(cherry picked from commit a31060817ef8b03814b240442811ea5caa082d1c)
Diffstat (limited to 'network-scripts/ifup-routes')
-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 } |