From 960608c8b50e711a5409594529744c0705f2dd58 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 4 Apr 2022 21:43:20 +0200 Subject: [PATCH] rules.pl: Add function to check if given firewall chain exists. Signed-off-by: Stefan Schantl --- config/firewall/rules.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl index c12e8fa6e4..1bd2920591 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -976,6 +976,14 @@ sub firewall_is_in_subnet { return 0; } +sub firewall_chain_exists ($) { + my ($chain) = @_; + + my $ret = &General::system("iptables", "--wait", "-n", "-L", "$chain"); + + return $ret; +} + sub ipset_get_sets () { my @sets; -- 2.39.5