[PATCH firewall3] ipsets: allow commented lines with loadfile

Daniel Harding dharding at living180.net
Sun Oct 25 04:11:37 EDT 2020


When loading ipset files using the loadfile option, skip lines that
start with '#'.

Signed-off-by: Daniel Harding <dharding at living180.net>
---
 ipsets.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ipsets.c b/ipsets.c
index 280845b..720f8c8 100644
--- a/ipsets.c
+++ b/ipsets.c
@@ -351,7 +351,8 @@ load_file(struct fw3_ipset *ipset)
 	}
 
 	while (fgets(line, sizeof(line), f))
-		fw3_pr("add %s %s", ipset->name, line);
+		if (line[0] != '#')
+			fw3_pr("add %s %s", ipset->name, line);
 
 	fclose(f);
 }
-- 
2.28.0




More information about the openwrt-devel mailing list