Blame SOURCES/0051-fix-rich-clamp-the-IP-families-to-those-actually-ena.patch

00cd46
From 0b69b4e464f02ea6fec50522b587a93092040b4d Mon Sep 17 00:00:00 2001
00cd46
From: Eric Garver <eric@garver.life>
00cd46
Date: Thu, 27 Aug 2020 15:59:13 -0400
00cd46
Subject: [PATCH 51/62] fix(rich): clamp the IP families to those actually
00cd46
 enabled
00cd46
00cd46
One scenario is if IPv6 is not available, but we specify an icmp-type
00cd46
that is ipv6 only, then we'll still attempt to call the IPv6 backend. We
00cd46
should not do that.
00cd46
00cd46
(cherry picked from commit 4fcb27bdcf8be30d91d490ba2c0286af1cf299de)
00cd46
(cherry picked from commit b8b0aeaaf853546f6990e8f635d7ea79233bbc79)
00cd46
---
00cd46
 src/firewall/core/fw_zone.py        | 5 ++++-
00cd46
 src/tests/regression/rhbz1855140.at | 2 --
00cd46
 2 files changed, 4 insertions(+), 3 deletions(-)
00cd46
00cd46
diff --git a/src/firewall/core/fw_zone.py b/src/firewall/core/fw_zone.py
00cd46
index 9d8bcf620251..bd026222dce5 100644
00cd46
--- a/src/firewall/core/fw_zone.py
00cd46
+++ b/src/firewall/core/fw_zone.py
00cd46
@@ -1542,7 +1542,10 @@ class FirewallZone(object):
00cd46
                 ipvs = [ source_ipv ]
00cd46
 
00cd46
         if not ipvs:
00cd46
-            ipvs = [ipv for ipv in ["ipv4", "ipv6"] if self._fw.is_ipv_enabled(ipv)]
00cd46
+            ipvs = ["ipv4", "ipv6"]
00cd46
+
00cd46
+        # clamp ipvs to those that are actually enabled.
00cd46
+        ipvs = [ipv for ipv in ipvs if self._fw.is_ipv_enabled(ipv)]
00cd46
 
00cd46
         # add an element to object to allow backends to know what ipvs this applies to
00cd46
         rule.ipvs = ipvs
00cd46
diff --git a/src/tests/regression/rhbz1855140.at b/src/tests/regression/rhbz1855140.at
00cd46
index cea943e0bf24..8059e29fe71a 100644
00cd46
--- a/src/tests/regression/rhbz1855140.at
00cd46
+++ b/src/tests/regression/rhbz1855140.at
00cd46
@@ -2,9 +2,7 @@ FWD_START_TEST([rich rule icmptypes with one family])
00cd46
 AT_KEYWORDS(rich icmp rhbz1855140)
00cd46
 
00cd46
 FWD_CHECK([--permanent --zone public --add-rich-rule='rule icmp-type name="echo-request" accept'], 0, ignore)
00cd46
-IF_HOST_SUPPORTS_IPV6_RULES([
00cd46
 FWD_CHECK([--permanent --zone public --add-rich-rule='rule icmp-type name="neighbour-advertisement" accept'], 0, ignore)
00cd46
-])
00cd46
 FWD_CHECK([--permanent --zone public --add-rich-rule='rule icmp-type name="timestamp-request" accept'], 0, ignore)
00cd46
 FWD_RELOAD
00cd46
 NFT_LIST_RULES([inet], [filter_IN_public_allow], 0, [dnl
00cd46
-- 
00cd46
2.28.0
00cd46