From 952ad68ef5daef6d7327384a8869c7e27a993dc9 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 a5b2a4fa5..a55e551c7 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -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); +} -- 2.39.5