$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");
<td><input type='text' name='REMARK' value='$settings{'REMARK'}' size='25'/></td>
</tr>
</table>
-<hr />
+<br>
<table width='100%'>
<tr>
- <td width='50%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
+ <td width='50%' align='right'><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
</tr>
</table>
</form>