]> git.ipfire.org Git - people/stevee/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>
Sat, 7 May 2022 09:38:58 +0000 (11:38 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/firewall/rules.pl

index 1f3b3f1a078a22144d587138d5fe428135084da1..ff9b1a689942dcd64d7bd008816beb98111edfe3 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 () {
        # Get all currently used ipset lists and store them in an array.
        my @output = `$IPSET -n list`;