Blame SOURCES/0037-fix-cli-add-ipset-type-hash-mac-is-incompatible-with.patch

1ae9b3
From 09b9f5a18dbe01d0d3ab9b0db721eadab5e38b35 Mon Sep 17 00:00:00 2001
1ae9b3
From: Vrinda Punj <vpunj@redhat.com>
1ae9b3
Date: Mon, 29 Jun 2020 17:34:46 -0400
1ae9b3
Subject: [PATCH 37/45] fix(cli): add ipset type hash:mac is incompatible with
1ae9b3
 the family parameter Fixes: rhbz1541077
1ae9b3
1ae9b3
(cherry picked from commit dddba7b9c276e9c58f6c2bc554c82252fa084eaf)
1ae9b3
(cherry picked from commit 15f5691f0dbffcc1d4c1f42e77e79c6600db0d77)
1ae9b3
---
1ae9b3
 src/firewall-cmd.in                 | 3 +++
1ae9b3
 src/firewall-offline-cmd.in         | 3 +++
1ae9b3
 src/tests/regression/regression.at  | 1 +
1ae9b3
 src/tests/regression/rhbz1541077.at | 9 +++++++++
1ae9b3
 4 files changed, 16 insertions(+)
1ae9b3
 create mode 100644 src/tests/regression/rhbz1541077.at
1ae9b3
1ae9b3
diff --git a/src/firewall-cmd.in b/src/firewall-cmd.in
1ae9b3
index 014f3884d64b..b6c2f84f5a9e 100755
1ae9b3
--- a/src/firewall-cmd.in
1ae9b3
+++ b/src/firewall-cmd.in
1ae9b3
@@ -1074,6 +1074,9 @@ if a.permanent:
1ae9b3
         if not a.type:
1ae9b3
             cmd.fail(parser.format_usage() + "No type specified.")
1ae9b3
 
1ae9b3
+        if a.type=='hash:mac' and a.family:
1ae9b3
+            cmd.fail(parser.format_usage()+ "--family is not compatible with the hash:mac type")
1ae9b3
+
1ae9b3
         settings = FirewallClientIPSetSettings()
1ae9b3
         settings.setType(a.type)
1ae9b3
         if a.option:
1ae9b3
diff --git a/src/firewall-offline-cmd.in b/src/firewall-offline-cmd.in
1ae9b3
index c0ad9ec8f64e..98c00548e3e5 100755
1ae9b3
--- a/src/firewall-offline-cmd.in
1ae9b3
+++ b/src/firewall-offline-cmd.in
1ae9b3
@@ -1577,6 +1577,9 @@ try:
1ae9b3
         if not a.type:
1ae9b3
             cmd.fail(parser.format_usage() + "No type specified.")
1ae9b3
 
1ae9b3
+        if a.type=='hash:mac' and a.family:
1ae9b3
+            cmd.fail(parser.format_usage() + "--family is not compatible with the hash:mac type")
1ae9b3
+        
1ae9b3
         settings = FirewallClientIPSetSettings()
1ae9b3
         settings.setType(a.type)
1ae9b3
         if a.option:
1ae9b3
diff --git a/src/tests/regression/regression.at b/src/tests/regression/regression.at
1ae9b3
index 5241a11a830d..5c8aae7e64d3 100644
1ae9b3
--- a/src/tests/regression/regression.at
1ae9b3
+++ b/src/tests/regression/regression.at
1ae9b3
@@ -32,3 +32,4 @@ m4_include([regression/rhbz1829104.at])
1ae9b3
 m4_include([regression/rhbz1843398.at])
1ae9b3
 m4_include([regression/rhbz1689429.at])
1ae9b3
 m4_include([regression/rhbz1483921.at])
1ae9b3
+m4_include([regression/rhbz1541077.at])
1ae9b3
diff --git a/src/tests/regression/rhbz1541077.at b/src/tests/regression/rhbz1541077.at
1ae9b3
new file mode 100644
1ae9b3
index 000000000000..765ab0c6290b
1ae9b3
--- /dev/null
1ae9b3
+++ b/src/tests/regression/rhbz1541077.at
1ae9b3
@@ -0,0 +1,9 @@
1ae9b3
+FWD_START_TEST([hash:mac and family mutually exclusive])
1ae9b3
+    AT_KEYWORDS(ipset rhbz1541077)
1ae9b3
+
1ae9b3
+    FWD_CHECK([firewall-cmd --permanent --new-ipset hashmacv6 --type hash:mac --family inet6], 2, ignore,ignore)
1ae9b3
+    
1ae9b3
+    FWD_CHECK([firewall-cmd --new-ipset hashmacv6 --type hash:mac --family inet6], 2, ignore,ignore)
1ae9b3
+
1ae9b3
+    FWD_CHECK([firewall-offline-cmd --new-ipset hashmacv6 --type hash:mac --family inet6], 2, ignore,ignore)
1ae9b3
+FWD_END_TEST
1ae9b3
-- 
1ae9b3
2.27.0
1ae9b3