From 35e6f80243dbe19dc9ab42dd9b2600644849267b Mon Sep 17 00:00:00 2001
From: hygienic-books <hygienic-books@tentic.net>
Date: Tue, 5 Jul 2022 04:47:04 +0200
Subject: [PATCH] feat(xml): Render XML rule content per section

---
 update-firewall-source.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/update-firewall-source.py b/update-firewall-source.py
index 2d57167..6e984c9 100644
--- a/update-firewall-source.py
+++ b/update-firewall-source.py
@@ -545,8 +545,14 @@ if __name__ == '__main__':
 
     log.debug(f"Iterating over config sections ...")
     for section in config.sections():
-        log.debug(f"Processing section '[{section}]' ...")
-        log.debug(config.getlist(section, "addr"))
+        log.info(f"Generating rules from section '[{section}]' ...")
+        arg_fwd_addr = config.getlist(section, "addr")
+        arg_allow_sources = {"ipv4": [], "ipv6": []}
+        if arg_fwd_addr:
+            arg_allow_sources = resolve_addresses(config, section, arg_fwd_addr)
+            log.debug(arg_allow_sources)
+        else:
+            log.info(f"No source address given. Rules will apply to all sources.")
 
 # arg_allow_sources = resolve_addresses(arg_allow_list)
 # gen_fw_rule_xml(arg_allow_sources)