commit:     626cfdad15f9740208807bc436cb3915056c87b4
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun May 31 05:42:22 2020 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun May 31 05:42:22 2020 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=626cfdad

net/iproute2: support containers without /proc/sys/net/ipv4/route/flush

Bug: https://bugs.gentoo.org/648600
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 net/iproute2.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/net/iproute2.sh b/net/iproute2.sh
index 5f65f1c..ca6c0f8 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -438,8 +438,18 @@ _iproute2_link_delete() {
        eend $?
 }
 
+_iproute2_route_flush_supported() {
+       case $FAMILY in
+               -6) p='/proc/sys/net/ipv6/route/flush' ;;
+               -4|*) p='/proc/sys/net/ipv4/route/flush' ;;
+       esac
+       test -f $p
+}
+
 _iproute2_route_flush() {
-       _cmd ip $FAMILY route flush table cache dev "${IFACE}"
+       if _iproute2_route_flush_supported; then
+               _cmd ip $FAMILY route flush table cache dev "${IFACE}"
+       fi
 }
 
 _iproute2_ipv6_tentative_output() {

Reply via email to