BUG 10538: Routes may only added once and should not be part of an internal network

This commit is contained in:
Alexander Marx
2014-06-16 09:45:59 +02:00
parent 581f19ddf1
commit 29f238b239
2 changed files with 34 additions and 0 deletions

View File

@@ -134,6 +134,27 @@ if ($settings{'ACTION'} eq $Lang::tr{'add'}) {
$errormessage = $Lang::tr{'invalid ip'}. " - ".$Lang::tr{'gateway ip'};
}
#set networkip if not already correctly defined
my($ip,$cidr) = split(/\//,$settings{'IP'});
my $netip=&General::getnetworkip($ip,$cidr);
$settings{'IP'} = "$netip/$cidr";
#Check for already existing routing entry
foreach my $line (@current) {
chomp($line); # remove newline
my @temp=split(/\,/,$line);
$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'}){
$errormessage = $Lang::tr{'ccd err irouteexist'};
last;
}
#Is the network part of an internal network?
$errormessage .= &General::check_net_internal($settings{'IP'});
last;
}
unless ($errormessage) {
if ($settings{'KEY1'} eq '') { #add or edit ?
unshift (@current, "$settings{'EN'},$settings{'IP'},$settings{'GATEWAY'},$settings{'REMARK'}\n");