소스 검색

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>
Jo-Philipp Wich 1 년 전
부모
커밋
c7201a3d24
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      root/usr/share/firewall4/main.uc

+ 6 - 1
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");