|
|
bb602c |
From 5157b540532338184b3867bc0370a8a27cef56f9 Mon Sep 17 00:00:00 2001
|
|
|
bb602c |
From: Eric Garver <eric@garver.life>
|
|
|
bb602c |
Date: Thu, 31 Oct 2019 12:57:23 -0400
|
|
|
bb602c |
Subject: [PATCH 120/122] fix: tests: convert ip6tables checks to runtime
|
|
|
bb602c |
|
|
|
bb602c |
(cherry picked from commit 49d4021e6ebf74e82142ca4fa6e6715a80d9b547)
|
|
|
bb602c |
(cherry picked from commit 7328e687353fbba92e303a97cf5f2c25884e6dae)
|
|
|
bb602c |
---
|
|
|
bb602c |
src/tests/firewall-cmd.at | 2 +-
|
|
|
bb602c |
src/tests/functions.at | 14 ++++++++------
|
|
|
bb602c |
src/tests/regression/rhbz1594657.at | 2 +-
|
|
|
bb602c |
3 files changed, 10 insertions(+), 8 deletions(-)
|
|
|
bb602c |
|
|
|
bb602c |
diff --git a/src/tests/firewall-cmd.at b/src/tests/firewall-cmd.at
|
|
|
bb602c |
index 2977cd6b5332..e9d5b6d1abc0 100644
|
|
|
bb602c |
--- a/src/tests/firewall-cmd.at
|
|
|
bb602c |
+++ b/src/tests/firewall-cmd.at
|
|
|
bb602c |
@@ -831,7 +831,7 @@ FWD_START_TEST([direct passthrough])
|
|
|
bb602c |
FWD_CHECK([--direct --remove-passthrough ipv4 --table filter --append INPUT --in-interface dummy0 --protocol tcp --destination-port 67 --jump ACCEPT], 0, ignore)
|
|
|
bb602c |
FWD_CHECK([--direct --query-passthrough ipv4 --table filter --append INPUT --in-interface dummy0 --protocol tcp --destination-port 67 --jump ACCEPT], 1, ignore, ignore)
|
|
|
bb602c |
|
|
|
bb602c |
- m4_if(yes, HOST_SUPPORTS_IP6TABLES, [dnl
|
|
|
bb602c |
+ IF_HOST_SUPPORTS_IP6TABLES([
|
|
|
bb602c |
FWD_CHECK([--direct --add-passthrough ipv6 --table filter --append FORWARD --destination fd00:dead:beef:ff0::/64 --in-interface dummy0 --out-interface dummy0 --jump ACCEPT], 0, ignore)
|
|
|
bb602c |
FWD_CHECK([--direct --get-passthroughs ipv6 | grep "fd00:dead:beef:ff0::/64"], 0, ignore)
|
|
|
bb602c |
FWD_CHECK([--direct --get-all-passthroughs | grep "fd00:dead:beef:ff0::/64"], 0, ignore)
|
|
|
bb602c |
diff --git a/src/tests/functions.at b/src/tests/functions.at
|
|
|
bb602c |
index 97506cc1396f..97df8914444a 100644
|
|
|
bb602c |
--- a/src/tests/functions.at
|
|
|
bb602c |
+++ b/src/tests/functions.at
|
|
|
bb602c |
@@ -256,7 +256,7 @@ m4_define([IPTABLES_LIST_RULES], [
|
|
|
bb602c |
|
|
|
bb602c |
m4_define([IP6TABLES_LIST_RULES_ALWAYS], [
|
|
|
bb602c |
m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
|
|
|
bb602c |
- m4_if(yes, HOST_SUPPORTS_IP6TABLES, [
|
|
|
bb602c |
+ IF_HOST_SUPPORTS_IP6TABLES([
|
|
|
bb602c |
NS_CHECK([$IP6TABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
|
|
|
bb602c |
])
|
|
|
bb602c |
])
|
|
|
bb602c |
@@ -422,13 +422,15 @@ m4_define([IF_HOST_SUPPORTS_NFT_FIB], [
|
|
|
bb602c |
fi
|
|
|
bb602c |
])
|
|
|
bb602c |
|
|
|
bb602c |
-m4_define([HOST_SUPPORTS_IP6TABLES], m4_esyscmd(
|
|
|
bb602c |
+m4_define([IF_HOST_SUPPORTS_IP6TABLES], [
|
|
|
bb602c |
if $IP6TABLES -L >/dev/null 2>&1; then
|
|
|
bb602c |
- echo -n "yes"
|
|
|
bb602c |
+ :
|
|
|
bb602c |
+ $1
|
|
|
bb602c |
else
|
|
|
bb602c |
- echo -n "no"
|
|
|
bb602c |
+ :
|
|
|
bb602c |
+ $2
|
|
|
bb602c |
fi
|
|
|
bb602c |
-))
|
|
|
bb602c |
+])
|
|
|
bb602c |
|
|
|
bb602c |
m4_define([HOST_SUPPORTS_IPV6], m4_esyscmd(
|
|
|
bb602c |
if sysctl -a |grep -F "net.ipv6" >/dev/null 2>&1; then
|
|
|
bb602c |
@@ -441,6 +443,6 @@ m4_define([HOST_SUPPORTS_IPV6], m4_esyscmd(
|
|
|
bb602c |
m4_define([IF_IPV6_SUPPORTED], [
|
|
|
bb602c |
m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [$1], [
|
|
|
bb602c |
m4_if(nftables, FIREWALL_BACKEND, [$1], [
|
|
|
bb602c |
- m4_if(yes, HOST_SUPPORTS_IP6TABLES, [$1], [$2])
|
|
|
bb602c |
+ IF_HOST_SUPPORTS_IP6TABLES([$1], [$2])
|
|
|
bb602c |
])])
|
|
|
bb602c |
])
|
|
|
bb602c |
diff --git a/src/tests/regression/rhbz1594657.at b/src/tests/regression/rhbz1594657.at
|
|
|
bb602c |
index 33b7bafe6b08..93cc2c2ef5b8 100644
|
|
|
bb602c |
--- a/src/tests/regression/rhbz1594657.at
|
|
|
bb602c |
+++ b/src/tests/regression/rhbz1594657.at
|
|
|
bb602c |
@@ -6,7 +6,7 @@ FWD_CHECK([--direct --passthrough ipv4 -t filter -C dummy_chain -j ACCEPT], 13,
|
|
|
bb602c |
FWD_CHECK([--direct --passthrough ipv4 -t filter -L dummy_chain], 13, [ignore], [ignore])
|
|
|
bb602c |
FWD_CHECK([--direct --passthrough ipv4 -t filter -L INPUT], 0, [ignore])
|
|
|
bb602c |
|
|
|
bb602c |
-m4_if(yes, HOST_SUPPORTS_IP6TABLES, [dnl
|
|
|
bb602c |
+IF_HOST_SUPPORTS_IP6TABLES([
|
|
|
bb602c |
FWD_CHECK([--direct --passthrough ipv6 -t filter -C dummy_chain -j ACCEPT], 13, [ignore], [ignore])
|
|
|
bb602c |
FWD_CHECK([--direct --passthrough ipv6 -t filter -L dummy_chain], 13, [ignore], [ignore])
|
|
|
bb602c |
FWD_CHECK([--direct --passthrough ipv6 -t filter -L INPUT], 0, [ignore])
|
|
|
bb602c |
--
|
|
|
bb602c |
2.23.0
|
|
|
bb602c |
|