Blame SOURCES/0121-fix-tests-convert-host-ipv6-checks-to-runtime.patch

136e2c
From c17c51550281fa8f9db246b06197149d2714b82e Mon Sep 17 00:00:00 2001
136e2c
From: Eric Garver <eric@garver.life>
136e2c
Date: Thu, 31 Oct 2019 13:00:28 -0400
136e2c
Subject: [PATCH 121/122] fix: tests: convert host ipv6 checks to runtime
136e2c
136e2c
(cherry picked from commit dfbd62fe435ff621eec3b3e9c7bb5de0d5ae64ec)
136e2c
(cherry picked from commit a3bb1c5d4db860c82b65d4ac446cbe6d7fc5d9bf)
136e2c
---
136e2c
 src/tests/functions.at        | 10 ++++++----
136e2c
 src/tests/regression/gh335.at | 14 +++++++-------
136e2c
 2 files changed, 13 insertions(+), 11 deletions(-)
136e2c
136e2c
diff --git a/src/tests/functions.at b/src/tests/functions.at
136e2c
index 97df8914444a..a84a22c3da4b 100644
136e2c
--- a/src/tests/functions.at
136e2c
+++ b/src/tests/functions.at
136e2c
@@ -432,13 +432,15 @@ m4_define([IF_HOST_SUPPORTS_IP6TABLES], [
136e2c
     fi
136e2c
 ])
136e2c
 
136e2c
-m4_define([HOST_SUPPORTS_IPV6], m4_esyscmd(
136e2c
+m4_define([IF_HOST_SUPPORTS_IPV6], [
136e2c
     if sysctl -a |grep -F "net.ipv6" >/dev/null 2>&1; then
136e2c
-        echo -n "yes"
136e2c
+        :
136e2c
+        $1
136e2c
     else
136e2c
-        echo -n "no"
136e2c
+        :
136e2c
+        $2
136e2c
     fi
136e2c
-))
136e2c
+])
136e2c
 
136e2c
 m4_define([IF_IPV6_SUPPORTED], [
136e2c
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [$1], [
136e2c
diff --git a/src/tests/regression/gh335.at b/src/tests/regression/gh335.at
136e2c
index cf307ef35365..d3c2b225a2df 100644
136e2c
--- a/src/tests/regression/gh335.at
136e2c
+++ b/src/tests/regression/gh335.at
136e2c
@@ -1,7 +1,7 @@
136e2c
 FWD_START_TEST([forward-port toaddr enables IP forwarding])
136e2c
 
136e2c
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
-m4_if(yes, HOST_SUPPORTS_IPV6, [
136e2c
+IF_HOST_SUPPORTS_IPV6([
136e2c
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
 ])
136e2c
 FWD_CHECK([-q --add-forward-port=port=12345:proto=tcp:toaddr=10.10.10.10])
136e2c
@@ -11,19 +11,19 @@ FWD_RELOAD
136e2c
 
136e2c
 IF_IPV6_SUPPORTED([
136e2c
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
-m4_if(yes, HOST_SUPPORTS_IPV6, [
136e2c
+IF_HOST_SUPPORTS_IPV6([
136e2c
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
 ])
136e2c
 FWD_CHECK([-q --add-forward-port=port=12345:proto=tcp:toport=54321:toaddr="1234:5678::4321"])
136e2c
 NS_CHECK([[sysctl -a |grep "net.ipv4.conf.all.forwarding[ ]*=[ ]*1"]], 1, [ignore], [ignore])
136e2c
-m4_if(yes, HOST_SUPPORTS_IPV6, [
136e2c
+IF_HOST_SUPPORTS_IPV6([
136e2c
 NS_CHECK([[sysctl -a |grep "net.ipv6.conf.all.forwarding[ ]*=[ ]*1"]], 0, [ignore], [ignore])
136e2c
 ])
136e2c
 FWD_RELOAD
136e2c
 ])
136e2c
 
136e2c
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
-m4_if(yes, HOST_SUPPORTS_IPV6, [
136e2c
+IF_HOST_SUPPORTS_IPV6([
136e2c
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
 ])
136e2c
 FWD_CHECK([-q --add-rich-rule='rule family=ipv4 forward-port port="12345" protocol="tcp" to-port="54321" to-addr="10.10.10.10"'])
136e2c
@@ -33,12 +33,12 @@ FWD_RELOAD
136e2c
 
136e2c
 IF_IPV6_SUPPORTED([
136e2c
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
-m4_if(yes, HOST_SUPPORTS_IPV6, [
136e2c
+IF_HOST_SUPPORTS_IPV6([
136e2c
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
 ])
136e2c
 FWD_CHECK([-q --add-rich-rule='rule family=ipv6 forward-port port="12345" protocol="tcp" to-port="54321" to-addr="1234:5678::4321"'])
136e2c
 NS_CHECK([[sysctl -a |grep "net.ipv4.conf.all.forwarding[ ]*=[ ]*1"]], 1, [ignore], [ignore])
136e2c
-m4_if(yes, HOST_SUPPORTS_IPV6, [
136e2c
+IF_HOST_SUPPORTS_IPV6([
136e2c
 NS_CHECK([[sysctl -a |grep "net.ipv6.conf.all.forwarding[ ]*=[ ]*1"]], 0, [ignore], [ignore])
136e2c
 ])
136e2c
 FWD_RELOAD
136e2c
@@ -46,7 +46,7 @@ FWD_RELOAD
136e2c
 
136e2c
 dnl following tests should _not_ enable IP forwarding
136e2c
 NS_CHECK([sysctl -w net.ipv4.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
-m4_if(yes, HOST_SUPPORTS_IPV6, [
136e2c
+IF_HOST_SUPPORTS_IPV6([
136e2c
 NS_CHECK([sysctl -w net.ipv6.conf.all.forwarding=0], 0, [ignore], [ignore])
136e2c
 ])
136e2c
 
136e2c
-- 
136e2c
2.23.0
136e2c