X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Frouting.cgi;h=be21007fa837ee4857da4fea0cb93b6d14afafc7;hb=351ad526b23daa2e36a7e09c5c2c7e59d4a35259;hp=c460a74e7ca1ab56d4d2dd44f8ecc9d69f9df6c2;hpb=9cf4a7f4188a5e68fc3daaf26661205ea3b69629;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/routing.cgi b/html/cgi-bin/routing.cgi index c460a74e7c..be21007fa8 100644 --- a/html/cgi-bin/routing.cgi +++ b/html/cgi-bin/routing.cgi @@ -118,12 +118,15 @@ if ($settings{'ACTION'} eq $Lang::tr{'toggle enable disable'}) { } if ($settings{'ACTION'} eq $Lang::tr{'add'}) { - # Convert subnet masks to CIDR notation. - $settings{'IP'} = &General::iporsubtocidr($settings{'IP'}); - -# Validate inputs - if (( !&General::validip($settings{'IP'})) and ( !&General::validipandmask($settings{'IP'}))){ - $errormessage = $Lang::tr{'invalid ip'}." / ".$Lang::tr{'invalid netmask'}; + # Validate inputs + if (!&General::validipandmask($settings{'IP'})){ + $errormessage = $Lang::tr{'invalid ip'}." / ".$Lang::tr{'invalid netmask'}; + }else{ + #set networkip if not already correctly defined + my($ip,$cidr) = split(/\//,$settings{'IP'}); + $cidr = &General::iporsubtocidr($cidr); + my $netip=&General::getnetworkip($ip,$cidr); + $settings{'IP'} = "$netip/$cidr"; } if ($settings{'IP'} =~ /^0\.0\.0\.0/){ @@ -134,6 +137,9 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) { $errormessage = $Lang::tr{'invalid ip'}. " - ".$Lang::tr{'gateway ip'}; } + # Escape input in REMARK field + $settings{'REMARK'} = &Header::escape($settings{'REMARK'}); + #set networkip if not already correctly defined my($ip,$cidr) = split(/\//,$settings{'IP'}); my $netip=&General::getnetworkip($ip,$cidr); @@ -146,12 +152,12 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) { $temp[2] ='' unless defined $temp[2]; # not always populated $temp[3] ='' unless defined $temp[2]; # not always populated #Same ip already used? - if($temp[1] eq $settings{'IP'}){ + if($temp[1] eq $settings{'IP'} && $settings{'KEY1'} eq ''){ $errormessage = $Lang::tr{'ccd err irouteexist'}; last; } #Is the network part of an internal network? - $errormessage .= &General::check_net_internal($settings{'IP'}); + $errormessage .= &General::check_net_internal_exact($settings{'IP'}); last; }