From 83d7df107d0939272d38782f803565bf171bdfe7 Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 3 May 2007 16:56:05 +0000 Subject: [PATCH] Improve editing of LIMIT/BURST git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6216 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Chains.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Shorewall-perl/Shorewall/Chains.pm b/Shorewall-perl/Shorewall/Chains.pm index 0d33a8e35..2aae847fa 100644 --- a/Shorewall-perl/Shorewall/Chains.pm +++ b/Shorewall-perl/Shorewall/Chains.pm @@ -914,10 +914,12 @@ sub do_ratelimit( $$ ) { fatal_error "Rate Limiting not available with $action" if $norate{$action}; - if ( $rate =~ /^([^:]+):([^:]+)$/ ) { - "-m limit --limit $1 --limit-burst $2 "; - } else { + if ( $rate =~ /^(\d+(\/(sec|hour|day)))?:(\d+)$/ ) { + "-m limit --limit $1 --limit-burst $4 "; + } elsif ( $rate =~ /^(\d+)(\/(sec|hour|day))?$/ ) { "-m limit --limit $rate "; + } else { + fatal_error "Invalid rate ($rate)"; } }