File 0007-firewall-cmd-Allow-passing-extra-interfaces-to-print.patch of Package firewalld.9185

From cb009330617a6f99b9e1f7e76b3853b0494273a8 Mon Sep 17 00:00:00 2001
From: Eric Garver <e@erig.me>
Date: Wed, 18 Jul 2018 11:47:21 -0400
Subject: [PATCH 7/8] firewall-cmd: Allow passing extra interfaces to
 print_zone_info()

This is used with --permanent --list-all-* to show interfaces controlled
by NetworkManager.

(cherry picked from commit e4c37a184fb7c2c4f67d04cf3e274326fb30a777)
---
 src/firewall-cmd        | 6 ++++--
 src/firewall/command.py | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/firewall-cmd b/src/firewall-cmd
index a58536d9..85677fe7 100755
--- a/src/firewall-cmd
+++ b/src/firewall-cmd
@@ -2005,15 +2005,17 @@ if a.permanent:
 
         # list all zone settings
         elif a.list_all:
-            cmd.print_zone_info(zone, fw_zone.getSettings())
+            interfaces = try_nm_get_interfaces_in_zone(zone)
+            cmd.print_zone_info(zone, fw_zone.getSettings(), extra_interfaces=interfaces)
             sys.exit(0)
 
         # list everything
         elif a.list_all_zones:
             names = fw.config().getZoneNames()
             for zone in sorted(names):
+                interfaces = try_nm_get_interfaces_in_zone(zone)
                 settings = fw.config().getZoneByName(zone).getSettings()
-                cmd.print_zone_info(zone, settings)
+                cmd.print_zone_info(zone, settings, extra_interfaces=interfaces)
                 cmd.print_msg("")
             sys.exit(0)
 
diff --git a/src/firewall/command.py b/src/firewall/command.py
index 50bd4bd0..662b1834 100644
--- a/src/firewall/command.py
+++ b/src/firewall/command.py
@@ -377,10 +377,10 @@ class FirewallCommand(object):
                                 "Module name '%s' too short" % value)
         return value
 
-    def print_zone_info(self, zone, settings, default_zone=None): # pylint: disable=R0914
+    def print_zone_info(self, zone, settings, default_zone=None, extra_interfaces=[]): # pylint: disable=R0914
         target = settings.getTarget()
         icmp_block_inversion = settings.getIcmpBlockInversion()
-        interfaces = settings.getInterfaces()
+        interfaces = sorted(set(settings.getInterfaces() + extra_interfaces))
         sources = settings.getSources()
         services = settings.getServices()
         ports = settings.getPorts()
-- 
2.19.0
openSUSE Build Service is sponsored by