Blame SOURCES/0095-fix-tests-regression-gh335-don-t-set-ipv6-sysctls-if.patch

c8bceb
From 83edef8b06cd78a5c0a0680db1d1bcd66d93d626 Mon Sep 17 00:00:00 2001
c8bceb
From: Eric Garver <eric@garver.life>
c8bceb
Date: Tue, 27 Aug 2019 12:07:16 -0400
c8bceb
Subject: [PATCH 95/99] fix: tests/regression/gh335: don't set ipv6 sysctls if
c8bceb
 ipv6 not usable
c8bceb
c8bceb
If ipv6.disable=1 these sysctls won't be available and the tests will
c8bceb
fail due to the sysctl -w failing.
c8bceb
c8bceb
(cherry picked from commit e9c171d3e1d919e2fe44fda9f3cd4b8a87d9aec3)
c8bceb
(cherry picked from commit db761aa40e8dd0a65d351ab3fec064470c9c7bb3)
c8bceb
---
c8bceb
 src/tests/regression/gh335.at | 14 ++++++++++++++
c8bceb
 1 file changed, 14 insertions(+)
c8bceb
c8bceb
diff --git a/src/tests/regression/gh335.at b/src/tests/regression/gh335.at
c8bceb
index 54cc4c66e163..97d8b88e493c 100644
c8bceb
--- a/src/tests/regression/gh335.at
c8bceb
+++ b/src/tests/regression/gh335.at
c8bceb
@@ -1,7 +1,9 @@
c8bceb
 FWD_START_TEST([forward-port toaddr enables IP forwarding])
c8bceb
 
c8bceb
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+m4_if(yes, HOST_SUPPORTS_IPV6, [
c8bceb
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+])
c8bceb
 FWD_CHECK([-q --add-forward-port=port=12345:proto=tcp:toaddr=10.10.10.10])
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv4.conf.all.forwarding[ ]*=[ ]*1"]], 0, [ignore], [ignore])
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv6.conf.all.forwarding[ ]*=[ ]*1"]], 1, [ignore], [ignore])
c8bceb
@@ -9,15 +11,21 @@ FWD_RELOAD
c8bceb
 
c8bceb
 IF_IPV6_SUPPORTED([
c8bceb
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+m4_if(yes, HOST_SUPPORTS_IPV6, [
c8bceb
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+])
c8bceb
 FWD_CHECK([-q --add-forward-port=port=12345:proto=tcp:toport=54321:toaddr="1234:5678::4321"])
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv4.conf.all.forwarding[ ]*=[ ]*1"]], 1, [ignore], [ignore])
c8bceb
+m4_if(yes, HOST_SUPPORTS_IPV6, [
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv6.conf.all.forwarding[ ]*=[ ]*1"]], 0, [ignore], [ignore])
c8bceb
+])
c8bceb
 FWD_RELOAD
c8bceb
 ])
c8bceb
 
c8bceb
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+m4_if(yes, HOST_SUPPORTS_IPV6, [
c8bceb
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+])
c8bceb
 FWD_CHECK([-q --add-rich-rule='rule family=ipv4 forward-port port="12345" protocol="tcp" to-port="54321" to-addr="10.10.10.10"'])
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv4.conf.all.forwarding[ ]*=[ ]*1"]], 0, [ignore], [ignore])
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv6.conf.all.forwarding[ ]*=[ ]*1"]], 1, [ignore], [ignore])
c8bceb
@@ -25,16 +33,22 @@ FWD_RELOAD
c8bceb
 
c8bceb
 IF_IPV6_SUPPORTED([
c8bceb
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+m4_if(yes, HOST_SUPPORTS_IPV6, [
c8bceb
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+])
c8bceb
 FWD_CHECK([-q --add-rich-rule='rule family=ipv6 forward-port port="12345" protocol="tcp" to-port="54321" to-addr="1234:5678::4321"'])
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv4.conf.all.forwarding[ ]*=[ ]*1"]], 1, [ignore], [ignore])
c8bceb
+m4_if(yes, HOST_SUPPORTS_IPV6, [
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv6.conf.all.forwarding[ ]*=[ ]*1"]], 0, [ignore], [ignore])
c8bceb
+])
c8bceb
 FWD_RELOAD
c8bceb
 ])
c8bceb
 
c8bceb
 dnl following tests should _not_ enable IP forwarding
c8bceb
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+m4_if(yes, HOST_SUPPORTS_IPV6, [
c8bceb
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
c8bceb
+])
c8bceb
 
c8bceb
 FWD_CHECK([-q --add-forward-port=port=12345:proto=tcp:toport=54321])
c8bceb
 NS_CHECK([[sysctl -a |grep "net.ipv4.conf.all.forwarding[ ]*=[ ]*1"]], 1, [ignore], [ignore])
c8bceb
-- 
c8bceb
2.20.1
c8bceb