From 28b6fd8033c3a1ddc199b3844ea56c5782abe527 Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 7 Apr 2009 18:15:51 +0000 Subject: [PATCH] Simplify hashlimit match code Signed-off-by: Tom Eastep git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9830 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/Perl/Shorewall/Chains.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index a266db3a8..bcb8fe148 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -1541,17 +1541,15 @@ sub do_ratelimit( $$ ) { $limit .= "--hashlimit-upto $3 --hashlimit-burst $6 --hashlimit-name "; $limit .= $2 ? $2 : 'shorewall'; $limit .= ' --hashlimit-mode '; - if ( $rate =~ /^s:/ ) { $limit .= "srcip "; } else { $limit .= "dstip "; } } elsif ( $rate =~ /^[sd]:((\w*):)?(\d+(\/(sec|min|hour|day))?)$/ ) { $limit .= "--hashlimit-upto $3 --hashlimit-name "; $limit .= $2 ? $2 : 'shorewall'; $limit .= ' --hashlimit-mode '; - if ( $rate =~ /^s:/ ) { $limit .= "srcip "; } else { $limit .= "dstip "; } } else { fatal_error "Invalid rate ($rate)"; } - $limit; + $limit .= $rate =~ /^s:/ ? 'srcip ' : 'dstip '; } elsif ( $rate =~ /^(\d+(\/(sec|min|hour|day))?):(\d+)$/ ) { "-m limit --limit $1 --limit-burst $4 "; } elsif ( $rate =~ /^(\d+)(\/(sec|min|hour|day))?$/ ) {