|
|
c8bceb |
From d9106cd887f111eb1f7fe40e8e2129d8e7652521 Mon Sep 17 00:00:00 2001
|
|
|
c8bceb |
From: Eric Garver <eric@garver.life>
|
|
|
c8bceb |
Date: Mon, 29 Apr 2019 13:19:47 -0400
|
|
|
c8bceb |
Subject: [PATCH 37/73] fix: tests/nftables: compatibility with numeric output
|
|
|
c8bceb |
changes
|
|
|
c8bceb |
|
|
|
c8bceb |
Newer versions (>0.9.0) of nft changed "-n" to mean _all_ numeric
|
|
|
c8bceb |
output. Newer versions also default to the older versions equivalent of
|
|
|
c8bceb |
"-nn", which is what we use. So key off the newer arguments and use the
|
|
|
c8bceb |
appropriate flags depending on nft version.
|
|
|
c8bceb |
|
|
|
c8bceb |
See nftables commit 505794f75f2a ("src: get rid of
|
|
|
c8bceb |
nft_ctx_output_{get,set}_numeric()") and other related commits.
|
|
|
c8bceb |
|
|
|
c8bceb |
(cherry picked from commit fa740a638e60265957f3ef1b86df6d3f99dd5010)
|
|
|
c8bceb |
(cherry picked from commit 612c5d9d281404aa8d0babbd66d115854a1822d1)
|
|
|
c8bceb |
---
|
|
|
c8bceb |
src/tests/functions.at | 7 +++++--
|
|
|
c8bceb |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
c8bceb |
|
|
|
c8bceb |
diff --git a/src/tests/functions.at b/src/tests/functions.at
|
|
|
c8bceb |
index 102004f678b3..ca9224476a56 100644
|
|
|
c8bceb |
--- a/src/tests/functions.at
|
|
|
c8bceb |
+++ b/src/tests/functions.at
|
|
|
c8bceb |
@@ -249,8 +249,9 @@ m4_define([NFT_LIST_RULES], [
|
|
|
c8bceb |
sed -e 's/meta mark/mark/g'dnl
|
|
|
c8bceb |
| sed -e '/type.*hook.*priority.*policy.*/d'dnl
|
|
|
c8bceb |
])
|
|
|
c8bceb |
+
|
|
|
c8bceb |
m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
|
|
|
c8bceb |
- NS_CHECK([nft -nn list chain $1 firewalld $2 | TRIM_WHITESPACE | NFT_LIST_RULES_NORMALIZE], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
|
|
|
c8bceb |
+ NS_CHECK([nft NFT_NUMERIC_ARGS list chain $1 firewalld $2 | TRIM_WHITESPACE | NFT_LIST_RULES_NORMALIZE], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
|
|
|
c8bceb |
])
|
|
|
c8bceb |
m4_undefine([NFT_LIST_RULES_NORMALIZE])
|
|
|
c8bceb |
])
|
|
|
c8bceb |
@@ -266,7 +267,7 @@ m4_define([IPSET_LIST_SET], [
|
|
|
c8bceb |
|
|
|
c8bceb |
m4_define([NFT_LIST_SET], [
|
|
|
c8bceb |
m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
|
|
|
c8bceb |
- NS_CHECK([nft -nn list set inet firewalld $1 | TRIM_WHITESPACE], [$2], [m4_strip([$3])], [m4_strip([$4])], [$5], [$6])
|
|
|
c8bceb |
+ NS_CHECK([nft NFT_NUMERIC_ARGS list set inet firewalld $1 | TRIM_WHITESPACE], [$2], [m4_strip([$3])], [m4_strip([$4])], [$5], [$6])
|
|
|
c8bceb |
])
|
|
|
c8bceb |
])
|
|
|
c8bceb |
|
|
|
c8bceb |
@@ -370,3 +371,5 @@ m4_ifnblank(
|
|
|
c8bceb |
[m4_define([HOST_SUPPORTS_NFT_FIB], [yes])],
|
|
|
c8bceb |
[m4_define([HOST_SUPPORTS_NFT_FIB], [no])]
|
|
|
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 |
2.20.1
|
|
|
c8bceb |
|