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>
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;
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");