diff options
| author | Jo-Philipp Wich | 2022-10-14 15:45:08 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich | 2022-10-14 15:45:08 +0000 |
| commit | c7201a3d24eb2a9ae122a0d6e4bb41146edebf10 (patch) | |
| tree | 5ffeee51a78c789134a9c795a72028c223cf85b3 | |
| parent | 756f1e21ed77f2c0b3fc2c8128c808704f2cf61b (diff) | |
| download | firewall4-c7201a3d24eb2a9ae122a0d6e4bb41146edebf10.tar.gz | |
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 <jo@mein.io>
| -rw-r--r-- | root/usr/share/firewall4/main.uc | 7 |
1 files changed, 6 insertions, 1 deletions
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"); |