From 2f7cb2d449a85bfb5433e5e44830024c3ee2d862 Mon Sep 17 00:00:00 2001
From: Eric Garver <eric@garver.life>
Date: Fri, 26 Jul 2019 08:26:50 -0400
Subject: [PATCH 71/73] test: coverage for rhbz 1723610 and gh #385
(cherry picked from commit 75fc4876dbfbdb1de09a67c48630fa8503ed152d)
(cherry picked from commit 9657d72ece2631aaab1aa1030658babe77c7f921)
---
src/tests/regression.at | 1 +
src/tests/regression/rhbz1723610.at | 30 +++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 src/tests/regression/rhbz1723610.at
diff --git a/src/tests/regression.at b/src/tests/regression.at
index 3438c97f4633..919fc32f9bfb 100644
--- a/src/tests/regression.at
+++ b/src/tests/regression.at
@@ -21,3 +21,4 @@ m4_include([regression/gh478.at])
m4_include([regression/gh453.at])
m4_include([regression/gh258.at])
m4_include([regression/rhbz1715977.at])
+m4_include([regression/rhbz1723610.at])
diff --git a/src/tests/regression/rhbz1723610.at b/src/tests/regression/rhbz1723610.at
new file mode 100644
index 000000000000..f020141e1808
--- /dev/null
+++ b/src/tests/regression/rhbz1723610.at
@@ -0,0 +1,30 @@
+FWD_START_TEST([direct remove-rules per family])
+AT_KEYWORDS(direct rhbz1723610 gh385)
+
+FWD_CHECK([-q --permanent --direct --add-rule ipv4 filter OUTPUT 0 -d 127.0.0.1 -p tcp --dport 22 -j ACCEPT])
+FWD_CHECK([--permanent --direct --get-all-rules], 0, [dnl
+ipv4 filter OUTPUT 0 -d 127.0.0.1 -p tcp --dport 22 -j ACCEPT
+])
+FWD_RELOAD
+FWD_CHECK([--direct --get-all-rules], 0, [dnl
+ipv4 filter OUTPUT 0 -d 127.0.0.1 -p tcp --dport 22 -j ACCEPT
+])
+
+FWD_CHECK([-q --permanent --direct --remove-rules ipv6 filter input])
+FWD_CHECK([-q --permanent --direct --remove-rules ipv4 filter INPUT])
+FWD_CHECK([--permanent --direct --get-all-rules], 0, [dnl
+ipv4 filter OUTPUT 0 -d 127.0.0.1 -p tcp --dport 22 -j ACCEPT
+])
+FWD_RELOAD
+FWD_CHECK([--direct --get-all-rules], 0, [dnl
+ipv4 filter OUTPUT 0 -d 127.0.0.1 -p tcp --dport 22 -j ACCEPT
+])
+FWD_CHECK([-q --direct --add-rule ipv4 filter INPUT 0 -p tcp --dport 22 -j ACCEPT])
+FWD_CHECK([-q --direct --add-rule ipv6 filter INPUT 0 -p tcp --dport 22 -j ACCEPT])
+FWD_CHECK([-q --direct --remove-rules ipv4 filter OUTPUT])
+FWD_CHECK([--direct --get-all-rules], 0, [dnl
+ipv4 filter INPUT 0 -p tcp --dport 22 -j ACCEPT
+ipv6 filter INPUT 0 -p tcp --dport 22 -j ACCEPT
+])
+
+FWD_END_TEST
--
2.20.1