From: Stefan Schantl Date: Mon, 4 Apr 2022 19:43:20 +0000 (+0200) Subject: rules.pl: Add function to check if given firewall chain exists. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=960608c8b50e711a5409594529744c0705f2dd58;p=people%2Fstevee%2Fipfire-2.x.git rules.pl: Add function to check if given firewall chain exists. Signed-off-by: Stefan Schantl --- 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;