From 95fee0cc33077b9d7771d1a2f997091adb2cfafd Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Mon, 4 May 2026 17:42:40 +0200 Subject: [PATCH] Add nice header generation for saved nftables rules --- nftables/nftables-lib.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nftables/nftables-lib.pl b/nftables/nftables-lib.pl index 92ac64b5a..472d11e17 100644 --- a/nftables/nftables-lib.pl +++ b/nftables/nftables-lib.pl @@ -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";