]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
rules.pl: Add load_customgrp() function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 16 Apr 2023 14:21:20 +0000 (16:21 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 16 Apr 2023 14:21:20 +0000 (16:21 +0200)
This function is used to perfom as loader for custom
host/newtworks groups.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/firewall/rules.pl

index 8e2e7e898639565b14b0754fcf2d895fcce2b783..475effeff51908c31431ed19f7162e4aaa72e3d2 100644 (file)
@@ -1045,3 +1045,19 @@ sub get_set_loader ($) {
 
        return $set_loader{$element};
 }
+
+sub load_customgrp ($) {
+       my ($group) = @_;
+
+       # Get the assigned host/network addresses for the given group.
+       my @data = &fwlib::get_custom_group_addresses($group);
+
+       # Abort if there is not data.
+       return "No data" unless(@data);
+
+       # Call the ipset_load_set function to load the set.
+       my $error = &IPSet::Functions::ipset_load_set($group, @data);
+
+       # Return the error message if there was one.
+       return $error if($error);
+}