From 60acddbb37b6ff54053d19911f08fdd5322aee2a Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 13 Aug 2015 14:37:13 -0700 Subject: [PATCH] Add conversion version and date to the converted files. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Misc.pm | 8 +++++++- Shorewall/Perl/Shorewall/Raw.pm | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Shorewall/Perl/Shorewall/Misc.pm b/Shorewall/Perl/Shorewall/Misc.pm index 6fdc69140..03db2f20b 100644 --- a/Shorewall/Perl/Shorewall/Misc.pm +++ b/Shorewall/Perl/Shorewall/Misc.pm @@ -696,7 +696,8 @@ sub convert_routestopped() { if ( my $fn = open_file 'routestopped' ) { my ( @allhosts, %source, %dest , %notrack, @rule ); - my $seq = 0; + my $seq = 0; + my $date = localtime; my ( $stoppedrules, $fn1 ); @@ -722,6 +723,11 @@ sub convert_routestopped() { EOF } + print( $stoppedrules + "#\n" , + "# Rules generated from routestopped file $fn by Shorewall $globals{VERSION} - $date\n" , + "#\n" ); + first_entry "$doing $fn..."; while ( read_a_line ( NORMAL_READ ) ) { diff --git a/Shorewall/Perl/Shorewall/Raw.pm b/Shorewall/Perl/Shorewall/Raw.pm index d99e37a5d..ac7864d24 100644 --- a/Shorewall/Perl/Shorewall/Raw.pm +++ b/Shorewall/Perl/Shorewall/Raw.pm @@ -363,6 +363,7 @@ sub setup_conntrack($) { if ( $convert ) { my $conntrack; my $empty = 1; + my $date = localtime; if ( $fn ) { open $conntrack, '>>', $fn or fatal_error "Unable to open $fn for notrack conversion: $!"; @@ -385,6 +386,11 @@ EOF EOF } + print( $conntrack + "#\n" , + "# Rules generated from notrack file $fn by Shorewall $globals{VERSION} - $date\n" , + "#\n" ); + $fn = open_file( 'notrack' , 3, 1 ) || fatal_error "Unable to open the notrack file for conversion: $!"; while ( read_a_line( PLAIN_READ ) ) {