aboutsummaryrefslogtreecommitdiffstats
path: root/network-scripts/ifup-routes
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2022-01-11 09:27:26 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-01-12 11:28:25 +0000
commita71dcfd392cc1022c255208fdd94a0fc6c13ceb0 (patch)
treeae7205e1762b84ae94bf72d0b740789552a08f65 /network-scripts/ifup-routes
parent50bcb8df83e97874583a54de562715db589905e2 (diff)
downloadinitscripts-a71dcfd392cc1022c255208fdd94a0fc6c13ceb0.tar
initscripts-a71dcfd392cc1022c255208fdd94a0fc6c13ceb0.tar.gz
initscripts-a71dcfd392cc1022c255208fdd94a0fc6c13ceb0.tar.bz2
initscripts-a71dcfd392cc1022c255208fdd94a0fc6c13ceb0.tar.xz
initscripts-a71dcfd392cc1022c255208fdd94a0fc6c13ceb0.zip
ifup-routes: Use `ip route repace` to avoid race
This should resolve the scenario when the link is brought up prior to disabling accept_ra. This only happens when both IPv4 and IPv6 address is on the interface, because network-scripts does IPv4 first and brings up the interface. Then it does IPv6 which disables the RA's, at that point the node has already learned the route from RA and setting a default route fails. Using `ip route replace` we ensure if the above scenario happens we end-up with the correct default ipv6 route. Huge thanks to Harald who debugged this issue and prepared a patch! Related: #2034799 Co-authored-by: hjensas <hjensas@redhat.com>
Diffstat (limited to 'network-scripts/ifup-routes')
-rwxr-xr-xnetwork-scripts/ifup-routes4
1 files changed, 2 insertions, 2 deletions
diff --git a/network-scripts/ifup-routes b/network-scripts/ifup-routes
index 517c2bbb..e88ea9d5 100755
--- a/network-scripts/ifup-routes
+++ b/network-scripts/ifup-routes
@@ -19,7 +19,7 @@ handle_file () {
line="$line via $(eval echo '$'GATEWAY$routenum)"
fi
line="$line dev $2"
- /sbin/ip route add $line
+ /sbin/ip route replace $line
routenum=$(($routenum+1))
done
}
@@ -34,7 +34,7 @@ handle_ip_file() {
fi
{ cat "$file" ; echo ; } | while read line; do
if [[ ! "$line" =~ $MATCH ]]; then
- /sbin/ip $proto $type add $line
+ /sbin/ip $proto $type replace $line
fi
done
}