]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
rules.pl: Add tiny ipset_restore function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 14 Feb 2022 18:42:49 +0000 (19:42 +0100)
committerPeter Müller <peter.mueller@ipfire.org>
Tue, 15 Feb 2022 18:07:03 +0000 (18:07 +0000)
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 <stefan.schantl@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
config/firewall/rules.pl

index da01b87750d0d72b0195c3c1713771d0e30113f6..5b1153b08a50e28c6c789266ada620c68a3f99af 100644 (file)
@@ -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");
+}