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