mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-15 18:18:36 +01:00
Make range-counting code a little less obscure
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5986 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
ddc6b76e93
commit
3a4f05823f
@ -650,11 +650,11 @@ sub do_proto( $$$ )
|
|||||||
if ( $count > 1 ) {
|
if ( $count > 1 ) {
|
||||||
fatal_error "Port list requires Multiport support in your kernel/iptables: $ports" unless $capabilities{MULTIPORT};
|
fatal_error "Port list requires Multiport support in your kernel/iptables: $ports" unless $capabilities{MULTIPORT};
|
||||||
|
|
||||||
for my $port ( @ports ) {
|
my @ranges = grep /:/, @ports;
|
||||||
if ( $port =~ /:/ ) {
|
|
||||||
fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $ports" unless $capabilities{XMULTIPORT};
|
if ( @ranges ) {
|
||||||
$count++;
|
fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $ports" unless $capabilities{XMULTIPORT};
|
||||||
}
|
$count += @ranges;
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Too many entries in port list: $ports" if $count > 15;
|
fatal_error "Too many entries in port list: $ports" if $count > 15;
|
||||||
@ -671,11 +671,11 @@ sub do_proto( $$$ )
|
|||||||
if ( $count > 1 ) {
|
if ( $count > 1 ) {
|
||||||
fatal_error "Port list requires Multiport support in your kernel/iptables: $sports" unless $capabilities{MULTIPORT};
|
fatal_error "Port list requires Multiport support in your kernel/iptables: $sports" unless $capabilities{MULTIPORT};
|
||||||
|
|
||||||
for my $port ( @ports ) {
|
my @ranges = grep /:/, @ports;
|
||||||
if ( $port =~ /:/ ) {
|
|
||||||
fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $sports" unless $capabilities{XMULTIPORT};
|
if ( @ranges ) {
|
||||||
$count++;
|
fatal_error "Port range in a list requires Extended Multiport Support in your kernel/iptables: $ports" unless $capabilities{XMULTIPORT};
|
||||||
}
|
$count += @ranges;
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Too many entries in port list: $sports" if $count > 15;
|
fatal_error "Too many entries in port list: $sports" if $count > 15;
|
||||||
|
@ -31,7 +31,7 @@ use File::Basename;
|
|||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
warning_message
|
warning_message
|
||||||
fatal_error
|
fatal_error
|
||||||
find_file
|
find_file
|
||||||
split_line
|
split_line
|
||||||
open_file
|
open_file
|
||||||
|
Loading…
Reference in New Issue
Block a user