Add nice header generation for saved nftables rules
Some checks failed
webmin.dev: webmin/webmin / build (push) Has been cancelled

This commit is contained in:
Ilia Ross
2026-05-04 17:42:40 +02:00
parent 18a6fc3b53
commit 95fee0cc33

View File

@@ -2024,13 +2024,20 @@ foreach my $r (@{$table->{'rules'}}) {
return;
}
# nftables_save_header()
# Returns the generated-file header for saved rules
sub nftables_save_header
{
return "# This file was auto-generated by the module.\n".
"# Manual changes may be overwritten.\n\n";
}
# dump_nftables_save(@tables)
# Returns a string representation of the firewall rules
sub dump_nftables_save
{
my (@tables) = @_;
my $rv;
my $rv = nftables_save_header();
foreach my $t (@tables) {
if ($t->{'family'}) {
$rv .= "table $t->{'family'} $t->{'name'} {\n";