Blame SOURCES/0077-fix-nftables-fix-zone-dispatch-using-ipset-sources-i.patch

c8bceb
From ad3e325cc67120b3c159a17d7bba1b216251d30f Mon Sep 17 00:00:00 2001
c8bceb
From: Eric Garver <eric@garver.life>
c8bceb
Date: Thu, 8 Aug 2019 13:40:01 -0400
c8bceb
Subject: [PATCH 77/79] fix: nftables: fix zone dispatch using ipset sources in
c8bceb
 nat chains
c8bceb
c8bceb
If using an ipset as a zone source the rules for doing a goto to the
c8bceb
zone's rules were omitted. This means the zone's rules for nat
c8bceb
postrouting/prerouting were not having any effect. Affected features;
c8bceb
masquerade, forward-ports
c8bceb
c8bceb
(cherry picked from commit b363548f2ab0983d7b88dd82620c0c545e2cef39)
c8bceb
(cherry picked from commit 25ca77a113d895dabd0bc81463fff2db5c749f85)
c8bceb
---
c8bceb
 src/firewall/core/nftables.py | 9 +++++++--
c8bceb
 1 file changed, 7 insertions(+), 2 deletions(-)
c8bceb
c8bceb
diff --git a/src/firewall/core/nftables.py b/src/firewall/core/nftables.py
c8bceb
index 05376fdd68d8..e6a4ec3518a8 100644
c8bceb
--- a/src/firewall/core/nftables.py
c8bceb
+++ b/src/firewall/core/nftables.py
c8bceb
@@ -542,10 +542,15 @@ class nftables(object):
c8bceb
         # nat tables needs to use ip/ip6 family
c8bceb
         if table == "nat" and family == "inet":
c8bceb
             rules = []
c8bceb
-            if check_address("ipv4", address) or check_mac(address):
c8bceb
+            if address.startswith("ipset:"):
c8bceb
+                ipset_family = self._set_get_family(address[len("ipset:"):])
c8bceb
+            else:
c8bceb
+                ipset_family = None
c8bceb
+
c8bceb
+            if check_address("ipv4", address) or check_mac(address) or ipset_family == "ip":
c8bceb
                 rules.extend(self.build_zone_source_address_rules(enable, zone,
c8bceb
                                     address, table, chain, "ip"))
c8bceb
-            if check_address("ipv6", address) or check_mac(address):
c8bceb
+            if check_address("ipv6", address) or check_mac(address) or ipset_family == "ip6":
c8bceb
                 rules.extend(self.build_zone_source_address_rules(enable, zone,
c8bceb
                                     address, table, chain, "ip6"))
c8bceb
             return rules
c8bceb
-- 
c8bceb
2.20.1
c8bceb