Blame SOURCES/0042-fix-rich-rule-destination-with-services.patch

c7c3fd
From 0dc5116a02ca03a3b78f5e5c653ebc783d2cdf2e Mon Sep 17 00:00:00 2001
c7c3fd
From: Eric Garver <eric@garver.life>
c7c3fd
Date: Thu, 6 Jun 2019 12:25:08 -0400
c7c3fd
Subject: [PATCH 42/43] fix: rich rule destination with services
c7c3fd
c7c3fd
Fixes: rhbz 1715977
c7c3fd
(cherry picked from commit d3bd517c7deb44d42129017b3c471ccdf1c32b57)
c7c3fd
(cherry picked from commit 9cd642933d41a983c4cbdef6aa936151e89a05ef)
c7c3fd
---
c7c3fd
 src/firewall/core/fw_zone.py | 7 ++++---
c7c3fd
 1 file changed, 4 insertions(+), 3 deletions(-)
c7c3fd
c7c3fd
diff --git a/src/firewall/core/fw_zone.py b/src/firewall/core/fw_zone.py
c7c3fd
index 31d7d6a168a8..e6eb299dec71 100644
c7c3fd
--- a/src/firewall/core/fw_zone.py
c7c3fd
+++ b/src/firewall/core/fw_zone.py
c7c3fd
@@ -1575,17 +1575,18 @@ class FirewallZone(object):
c7c3fd
             if type(rule.element) == Rich_Service:
c7c3fd
                 svc = self._fw.service.get_service(rule.element.name)
c7c3fd
 
c7c3fd
-                destinations = [rule.destination] if rule.destination else [None]
c7c3fd
-
c7c3fd
+                destinations = []
c7c3fd
                 if len(svc.destination) > 0:
c7c3fd
                     if rule.destination:
c7c3fd
                         # we can not use two destinations at the same time
c7c3fd
                         raise FirewallError(errors.INVALID_RULE,
c7c3fd
                                             "Destination conflict with service.")
c7c3fd
-                    destinations = []
c7c3fd
                     for ipv in ipvs:
c7c3fd
                         if ipv in svc.destination and backend.is_ipv_supported(ipv):
c7c3fd
                             destinations.append(svc.destination[ipv])
c7c3fd
+                else:
c7c3fd
+                    # dummy for the following for loop
c7c3fd
+                    destinations.append(None)
c7c3fd
 
c7c3fd
                 for destination in destinations:
c7c3fd
                     if enable:
c7c3fd
-- 
c7c3fd
2.23.0
c7c3fd