|
|
1ac3f6 |
From a79321b79b0543cff0c99702c1ab9eeaab8bfe06 Mon Sep 17 00:00:00 2001
|
|
|
1ac3f6 |
From: Eric Garver <eric@garver.life>
|
|
|
1ac3f6 |
Date: Thu, 3 Jun 2021 11:42:58 -0400
|
|
|
1ac3f6 |
Subject: [PATCH 33/36] fix(policy): warn instead of error for overlapping
|
|
|
1ac3f6 |
ports
|
|
|
1ac3f6 |
|
|
|
1ac3f6 |
Fixes: rhbz 1914935
|
|
|
1ac3f6 |
(cherry picked from commit b71e532bc21fb6a06345b5ecfeb60683c7a194e9)
|
|
|
1ac3f6 |
(cherry picked from commit 66ca4b0fd9588d60d31998ad792f04962053aaab)
|
|
|
1ac3f6 |
---
|
|
|
1ac3f6 |
src/firewall/core/fw_policy.py | 16 ++++++++++++++--
|
|
|
1ac3f6 |
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
1ac3f6 |
|
|
|
1ac3f6 |
diff --git a/src/firewall/core/fw_policy.py b/src/firewall/core/fw_policy.py
|
|
|
1ac3f6 |
index 3f5dab808ff0..79a52d8d97c0 100644
|
|
|
1ac3f6 |
--- a/src/firewall/core/fw_policy.py
|
|
|
1ac3f6 |
+++ b/src/firewall/core/fw_policy.py
|
|
|
1ac3f6 |
@@ -98,11 +98,23 @@ class FirewallPolicy(object):
|
|
|
1ac3f6 |
for args in obj.services:
|
|
|
1ac3f6 |
self.add_service(policy, args)
|
|
|
1ac3f6 |
for args in obj.ports:
|
|
|
1ac3f6 |
- self.add_port(policy, *args)
|
|
|
1ac3f6 |
+ try:
|
|
|
1ac3f6 |
+ self.add_port(policy, *args)
|
|
|
1ac3f6 |
+ except FirewallError as error:
|
|
|
1ac3f6 |
+ if error.code in [errors.ALREADY_ENABLED]:
|
|
|
1ac3f6 |
+ log.warning(error)
|
|
|
1ac3f6 |
+ else:
|
|
|
1ac3f6 |
+ raise error
|
|
|
1ac3f6 |
for args in obj.protocols:
|
|
|
1ac3f6 |
self.add_protocol(policy, args)
|
|
|
1ac3f6 |
for args in obj.source_ports:
|
|
|
1ac3f6 |
- self.add_source_port(policy, *args)
|
|
|
1ac3f6 |
+ try:
|
|
|
1ac3f6 |
+ self.add_source_port(policy, *args)
|
|
|
1ac3f6 |
+ except FirewallError as error:
|
|
|
1ac3f6 |
+ if error.code in [errors.ALREADY_ENABLED]:
|
|
|
1ac3f6 |
+ log.warning(error)
|
|
|
1ac3f6 |
+ else:
|
|
|
1ac3f6 |
+ raise error
|
|
|
1ac3f6 |
for args in obj.rules:
|
|
|
1ac3f6 |
self.add_rule(policy, args)
|
|
|
1ac3f6 |
if obj.masquerade:
|
|
|
1ac3f6 |
--
|
|
|
1ac3f6 |
2.27.0
|
|
|
1ac3f6 |
|