forked from extern/shorewall_code
Clean up range expansion
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8325 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
d33f6583ad
commit
a672e03a82
@ -361,23 +361,23 @@ sub expand_port_range( $$ ) {
|
|||||||
|
|
||||||
if ( $range =~ /^(.*):(.*)$/ ) {
|
if ( $range =~ /^(.*):(.*)$/ ) {
|
||||||
my ( $first, $last ) = ( $1, $2);
|
my ( $first, $last ) = ( $1, $2);
|
||||||
|
my @result;
|
||||||
|
|
||||||
fatal_error "Invalid port range ($range)" unless $first ne '' or $last ne '';
|
fatal_error "Invalid port range ($range)" unless $first ne '' or $last ne '';
|
||||||
|
|
||||||
$first = 0 if $first eq '';
|
$first = 0 if $first eq '';
|
||||||
$last = 65535 if $last eq '';
|
$last = 65535 if $last eq '';
|
||||||
|
|
||||||
my @result;
|
|
||||||
( $first , $last ) = ( validate_port( $proto, $first ) , validate_port( $proto, $last ) );
|
( $first , $last ) = ( validate_port( $proto, $first ) , validate_port( $proto, $last ) );
|
||||||
|
|
||||||
my $l = $last + 1;
|
$last++;
|
||||||
|
|
||||||
while ( $first <= $last ) {
|
while ( $first < $last ) {
|
||||||
my $mask = 0xffff;
|
my $mask = 0xffff;
|
||||||
my $y = 2;
|
my $y = 2;
|
||||||
my $z = 1;
|
my $z = 1;
|
||||||
|
|
||||||
while ( ( $first % $y ) == 0 && ( $first + $y ) <= $l ) {
|
while ( ( $first % $y ) == 0 && ( $first + $y ) <= $last ) {
|
||||||
$mask <<= 1;
|
$mask <<= 1;
|
||||||
$z = $y;
|
$z = $y;
|
||||||
$y <<= 1;
|
$y <<= 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user