From 5b049d7e9e1f45a1dda05dcda3746e99a9ed6e60 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 20 Nov 2012 06:59:13 -0800 Subject: [PATCH] Improve readability in Rules module Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Rules.pm | 62 ++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index f5c2d055a..d18edb8ca 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -562,27 +562,33 @@ sub policy_rules( $$$$$ ) { if ( $default && $default ne 'none' ) { if ( $default =~ s/^macro\.// ) { - process_macro( $default, #Macro - $chainref, #Chain - $default, #Target - '', #Param - '-', #Source - '-', #Dest - '-', #Proto - '-', #Ports - '-', #Sports - '-', #Original Dest - '-', #Rate - '-', #User - '-', #Mark - '-', #ConnLimit - '-', #Time - '-', #Headers - '-', #Condition - '-', #Helper - 0, #Wildcard + # + # Default action is a macro -- expand it in-line + # + process_macro( $default, #Macro + $chainref, #Chain + $default, #Target + '', #Param + '-', #Source + '-', #Dest + '-', #Proto + '-', #Ports + '-', #Sports + '-', #Original Dest + '-', #Rate + '-', #User + '-', #Mark + '-', #ConnLimit + '-', #Time + '-', #Headers + '-', #Condition + '-', #Helper + 0, #Wildcard ); } else { + # + # Default action is an action -- jump to the action chain + # add_ijump $chainref, j => $default; } } @@ -596,7 +602,7 @@ sub policy_rules( $$$$$ ) { } sub report_syn_flood_protection() { - progress_message_nocompress ' Enabled SYN flood protection'; + progress_message_nocompress ' Enabled SYN flood Protection'; } # @@ -1597,7 +1603,21 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$) { ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser ) = split_line1 'macro file', \%rulecolumns, $rule_commands; ( $morigdest, $mmark, $mconnlimit, $mtime, $mheaders, $mcondition, $mhelper ) = qw/- - - - - - -/; } else { - ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser, $mmark, $mconnlimit, $mtime, $mheaders, $mcondition, $mhelper ) = split_line1 'macro file', \%rulecolumns, $rule_commands; + ( $mtarget, + $msource, + $mdest, + $mproto, + $mports, + $msports, + $morigdest, + $mrate, + $muser, + $mmark, + $mconnlimit, + $mtime, + $mheaders, + $mcondition, + $mhelper ) = split_line1 'macro file', \%rulecolumns, $rule_commands; } fatal_error 'TARGET must be specified' if $mtarget eq '-';