]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/firewall/rules.pl
ipblocklist: Add "v4" as extension to the ipset set names.
[ipfire-2.x.git] / config / firewall / rules.pl
index 9198fec1d50d61b3b10e9dc6bde91ed58417947f..799b2667d87dc36f5f72961b00dd7e8a983141de 100644 (file)
@@ -1060,11 +1060,23 @@ sub ipset_restore ($) {
 
        # Check if the given set name is a blocklist.
        } elsif ($set ~~ @blocklists) {
+               # IPblocklist sets contains v4 as setname extension.
+               my $set_name = "$set" . "v4";
+
                # Get the database file for the given blocklist.
                my $db_file = &IPblocklist::get_ipset_db_file($set);
 
                # Call function to restore/load the set.
                &ipset_call_restore($db_file);
+
+               # Check if the set is already loaded (has been used before).
+               if ($set ~~ @ipset_used_sets) {
+                       # Swap the sets.
+                       run("$IPSET swap $set_name $set");
+               } else {
+                       # Rename the set to proper use it.
+                       run("$IPSET rename $set_name $set");
+               }
        }
 
        # Store the restored set to the hash to prevent from loading it again.