From 273158d726383293b4dba4ce95cd6e1f92e90c7d Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Fri, 11 Feb 2022 21:26:31 +0100 Subject: [PATCH] rules.pl: Add tiny ipset_restore function. This helper function is used to load a previously exported list of networks for a given country code into the ipset module, so it can be used for any kind of firewall rules. Signed-off-by: Stefan Schantl --- config/firewall/rules.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl index da01b87750..5b1153b08a 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -888,3 +888,10 @@ sub firewall_is_in_subnet { return 0; } + +sub ipset_restore ($) { + my ($ccode) = @_; + + # Run ipset and restore the list of the given country code. + run("$IPSET restore < $Location::Functions::ipset_db_directory/$ccode.ipset4"); +} -- 2.39.5