From 0d6d0c1c0f196453914519e586af489874e414ce Mon Sep 17 00:00:00 2001 From: teastep Date: Sun, 29 Jul 2007 18:09:00 +0000 Subject: [PATCH] Allow 'sec' as a valid unit of time in rate-limit specifications git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6998 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-common/changelog.txt | 2 ++ Shorewall-common/releasenotes.txt | 3 +++ Shorewall-perl/Shorewall/Chains.pm | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Shorewall-common/changelog.txt b/Shorewall-common/changelog.txt index 886859e87..79818b515 100644 --- a/Shorewall-common/changelog.txt +++ b/Shorewall-common/changelog.txt @@ -21,6 +21,8 @@ Changes in 4.0.1 10) Cleaner way to handle quotes in rules. +11) Allow '/min' in RATE/BURST column. + Changes in 4.0.0 Final 1) Fix lite install.sh manpage problem. diff --git a/Shorewall-common/releasenotes.txt b/Shorewall-common/releasenotes.txt index 9645893cf..b05abdc71 100644 --- a/Shorewall-common/releasenotes.txt +++ b/Shorewall-common/releasenotes.txt @@ -78,6 +78,9 @@ Problems corrected in 4.0.1. actions and when a log level followed by '!' was used with any builtin actions. +10) Shorewall-perl was incorrectly rejecting 'min' as a valid unit of + time in rate-limiting specifications. + Other changes in Shorewall 4.0.1. 1) A new EXPAND_POLICIES option is added to shorewall.conf. The diff --git a/Shorewall-perl/Shorewall/Chains.pm b/Shorewall-perl/Shorewall/Chains.pm index d47c2cf97..508b1ca3f 100644 --- a/Shorewall-perl/Shorewall/Chains.pm +++ b/Shorewall-perl/Shorewall/Chains.pm @@ -1046,9 +1046,9 @@ sub do_ratelimit( $$ ) { fatal_error "Rate Limiting not available with $action" if $norate{$action}; - if ( $rate =~ /^(\d+(\/(sec|hour|day))?):(\d+)$/ ) { + if ( $rate =~ /^(\d+(\/(sec|min|hour|day))?):(\d+)$/ ) { "-m limit --limit $1 --limit-burst $4 "; - } elsif ( $rate =~ /^(\d+)(\/(sec|hour|day))?$/ ) { + } elsif ( $rate =~ /^(\d+)(\/(sec|min|hour|day))?$/ ) { "-m limit --limit $rate "; } else { fatal_error "Invalid rate ($rate)";