From: Stefan Schantl Date: Mon, 14 Feb 2022 18:42:49 +0000 (+0100) Subject: rules.pl: Add tiny ipset_restore function. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6babb404cc63d6f5c25d64be8e4370b7cb009c2c;p=people%2Fms%2Fipfire-2.x.git 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 Reviewed-by: Peter Müller Reviewed-by: Michael Tremer --- 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"); +}