From: Stefan Schantl Date: Sun, 16 Apr 2023 14:21:20 +0000 (+0200) Subject: rules.pl: Add load_customgrp() function. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a1acc19df5ddefdf2c680c46e411175ae834a854;p=people%2Fstevee%2Fipfire-2.x.git rules.pl: Add load_customgrp() function. This function is used to perfom as loader for custom host/newtworks groups. Signed-off-by: Stefan Schantl --- diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl index 8e2e7e8986..475effeff5 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -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); +}