my %color = ();
my %mainsettings = ();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
-&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
our %settings = ();
}
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/){
$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);
$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;
}
# Build the configuration file
#
sub BuildConfiguration {
- system '/usr/local/bin/rebuildroutes';
+ &General::system('/usr/local/bin/rebuildroutes');
}