From: Alexander Marx Date: Wed, 23 Apr 2014 12:19:34 +0000 (+0200) Subject: Firewall: BUG 10528 - allow subnets greater than /8 X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=commitdiff_plain;h=7490b22e9d46045d779bfc2e6d186e81ae15b5d1 Firewall: BUG 10528 - allow subnets greater than /8 --- diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index adfba5489..271dc41da 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -353,7 +353,7 @@ sub iporsubtodec } #Subnet already in decimal and valid? if ($mask=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ &&(($1<=255 && $2<=$1 && $3<=$2 && $4<=$3 ))) { - for (my $i=8;$i<=32;$i++){ + for (my $i=0;$i<=32;$i++){ if (&General::cidrtosub($i) eq $mask){ if ($full == 0){return $mask;}else{ return $net."/".$mask; @@ -362,7 +362,7 @@ sub iporsubtodec } } #Subnet in binary format? - if ($mask=~/^(\d{1,2})$/ && (($1<=32 && $1>=8))){ + if ($mask=~/^(\d{1,2})$/ && (($1<=32 && $1>=0))){ if($full == 0){ return &General::cidrtosub($mask);}else{ return $net."/".&General::cidrtosub($mask); } @@ -389,7 +389,7 @@ sub iporsubtocidr } #Subnet in decimal and valid? if ($mask=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ &&(($1<=255 && $2<=$1 && $3<=$2 && $4<=$3 ))) { - for (my $i=8;$i<=32;$i++){ + for (my $i=0;$i<=32;$i++){ if (&General::cidrtosub($i) eq $mask){ if ($full == 0){return &General::subtocidr($mask);}else{ return $net."/".&General::subtocidr($mask); @@ -398,7 +398,7 @@ sub iporsubtocidr } } #Subnet already in binary format? - if ($mask=~/^(\d{1,2})$/ && (($1<=32 && $1>=8))){ + if ($mask=~/^(\d{1,2})$/ && (($1<=32 && $1>=0))){ if($full == 0){ return $mask;}else{ return $net."/".$mask; } @@ -488,13 +488,13 @@ sub validipandmask if ($ccdip=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ &&(($1>0 && $1<=255 && $2>=0 && $2<=255 && $3>=0 && $3<=255 && $4<=255 ))) { #Subnet in decimal and valid? if ($ccdsubnet=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ &&(($1<=255 && $2<=$1 && $3<=$2 && $4<=$3 ))) { - for (my $i=8;$i<=32;$i++){ + for (my $i=0;$i<=32;$i++){ if (&General::cidrtosub($i) eq $ccdsubnet){ return 1; } - } + } #Subnet already in binary format? - }elsif ($ccdsubnet=~/^(\d{1,2})$/ && (($1<=32 && $1>=8))){ + }elsif ($ccdsubnet=~/^(\d{1,2})$/ && (($1<=32 && $1>=0))){ return 1; }else{ return 0;