mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-20 01:37:59 +02:00
Tweak do_ratelimit()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
5a599552f2
commit
93f0183550
@ -5430,7 +5430,7 @@ sub do_ratelimit( $$ ) {
|
|||||||
if ( supplied $2 ) {
|
if ( supplied $2 ) {
|
||||||
my $vlsm = numeric_value($2);
|
my $vlsm = numeric_value($2);
|
||||||
fatal_error "Invalid VLSM ($2)" unless $vlsm and $vlsm <= ( $family == F_IPV4 ? VLSMv4 : VLSMv6 );
|
fatal_error "Invalid VLSM ($2)" unless $vlsm and $vlsm <= ( $family == F_IPV4 ? VLSMv4 : VLSMv6 );
|
||||||
$limit .= $rate =~ /^s:/ ? " --hashlimit-srcmask $vlsm" : " --hashlimit-dstmask $vlsm";
|
$limit .= $mode eq 'srcip' ? " --hashlimit-srcmask $vlsm" : " --hashlimit-dstmask $vlsm";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( supplied $5 ) {
|
if ( supplied $5 ) {
|
||||||
@ -5445,7 +5445,6 @@ sub do_ratelimit( $$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$limit .= " --hashlimit-mode $mode" if $mode;
|
$limit .= " --hashlimit-mode $mode" if $mode;
|
||||||
$limit .= ' ' unless $limit =~ / $/;
|
|
||||||
$units = $10;
|
$units = $10;
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Invalid rate ($rate)";
|
fatal_error "Invalid rate ($rate)";
|
||||||
@ -5460,8 +5459,9 @@ sub do_ratelimit( $$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$limit .= " --hashlimit-htable-expire $expire ";
|
$limit .= " --hashlimit-htable-expire $expire ";
|
||||||
|
} else {
|
||||||
|
$limit .= ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit;
|
$limit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user