]> 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, 3 Mar 2024 11:56:03 +0000 (12:56 +0100)
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 a5b2a4fa5a43ca6382414c67e700747877685f5d..a55e551c77dceb78fccd4a71bd5ca14ee69da657 100644 (file)
@@ -1046,3 +1046,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);
+}