c8bceb
From 9220b16807b4b22ff14072de9f85f8e0353e48a0 Mon Sep 17 00:00:00 2001
c8bceb
From: Eric Garver <eric@garver.life>
c8bceb
Date: Mon, 13 May 2019 13:52:56 -0400
c8bceb
Subject: [PATCH 46/73] test: add macro HOST_SUPPORTS_IP6TABLES
c8bceb
c8bceb
(cherry picked from commit 4d5c3f190dc309ab03543dc7a65e45ee52858bd9)
c8bceb
(cherry picked from commit ada120045f6a1d387edf02772e889717da68050b)
c8bceb
---
c8bceb
 src/tests/functions.at | 10 ++++++++++
c8bceb
 1 file changed, 10 insertions(+)
c8bceb
c8bceb
diff --git a/src/tests/functions.at b/src/tests/functions.at
c8bceb
index c246c08bc378..05f517b01369 100644
c8bceb
--- a/src/tests/functions.at
c8bceb
+++ b/src/tests/functions.at
c8bceb
@@ -238,8 +238,10 @@ m4_define([IPTABLES_LIST_RULES], [
c8bceb
 
c8bceb
 m4_define([IP6TABLES_LIST_RULES], [
c8bceb
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
c8bceb
+    m4_if(yes, HOST_SUPPORTS_IP6TABLES, [
c8bceb
         NS_CHECK([IP6TABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
c8bceb
     ])
c8bceb
+    ])
c8bceb
 ])
c8bceb
 
c8bceb
 m4_define([NFT_LIST_RULES], [
c8bceb
@@ -375,3 +377,11 @@ m4_ifnblank(
c8bceb
 )
c8bceb
 
c8bceb
 m4_define([NFT_NUMERIC_ARGS], m4_esyscmd([nft -h |grep "numeric-protocol" >/dev/null && echo -n "" || { echo -n "-" && echo -n "nn"; } ]))
c8bceb
+
c8bceb
+m4_define([HOST_SUPPORTS_IP6TABLES], [m4_esyscmd(
c8bceb
+    if IP6TABLES -L >/dev/null 2>&1; then
c8bceb
+        echo -n "yes"
c8bceb
+    else
c8bceb
+        echo -n "no"
c8bceb
+    fi
c8bceb
+)])
c8bceb
-- 
c8bceb
2.20.1
c8bceb