From c7201a3d24eb2a9ae122a0d6e4bb41146edebf10 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 14 Oct 2022 17:45:08 +0200 Subject: [PATCH] main.uc: reintroduce set reload restriction Only reload sets which either declare a file to load or a set of static entries in order to avoid clearing externally managed sets that might take a long time to repopulate. Also guard the entry file loading in order to avoid a stray warning message. Ref: https://forum.openwrt.org/t/x/138579/57 Signed-off-by: Jo-Philipp Wich --- root/usr/share/firewall4/main.uc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/root/usr/share/firewall4/main.uc b/root/usr/share/firewall4/main.uc index 1d8a405..36df85f 100644 --- a/root/usr/share/firewall4/main.uc +++ b/root/usr/share/firewall4/main.uc @@ -18,6 +18,9 @@ function reload_sets() { sets = fw4.check_set_types(); for (let set in state.ipsets) { + if (!set.loadfile && !length(set.entries)) + continue; + if (!exists(sets, set.name)) { warn(`Named set '${set.name}' does not exist - do you need to restart the firewall?\n`); continue; @@ -40,7 +43,9 @@ function reload_sets() { print(`flush set inet fw4 ${set.name}\n`); map(set.entries, printer); - fw4.parse_setfile(set, printer); + + if (set.loadfile) + fw4.parse_setfile(set, printer); if (!first) print("}\n\n"); -- 2.30.2