From a1acc19df5ddefdf2c680c46e411175ae834a854 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sun, 16 Apr 2023 16:21:20 +0200 Subject: [PATCH] rules.pl: Add load_customgrp() function. This function is used to perfom as loader for custom host/newtworks groups. Signed-off-by: Stefan Schantl --- config/firewall/rules.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); +} -- 2.39.5