]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
rules.pl: Add function to check if given firewall chain exists.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 4 Apr 2022 19:43:20 +0000 (21:43 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 7 Jul 2022 15:26:14 +0000 (17:26 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/firewall/rules.pl

index c12e8fa6e4d38f89f4b44482e646680482fd7acd..1bd2920591baa0cca7cb71f1bc78c9d9ecb5597e 100644 (file)
@@ -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;