mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 19:00:34 +02:00
BUG10940: remove leading zeros in ip address
in firewallgroups (hosts) an error was created when using ip adresses like 192.168.000.008. Now all leading zeros are deleted in firewallgroups and in the firewall itself when using single ip addresses as source or target. Signed-off-by: Alexander Marx <alexander.marx@ipfire.org> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Michael Tremer
parent
f7d4c48ded
commit
f770b72899
@@ -31,6 +31,7 @@ no warnings 'uninitialized';
|
||||
#use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require '/var/ipfire/network-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
require "${General::swroot}/geoip-functions.pl";
|
||||
@@ -465,6 +466,9 @@ sub checksource
|
||||
}
|
||||
}
|
||||
if ($fwdfwsettings{'isip'} eq 'on'){
|
||||
#remove leading zero
|
||||
$ip = &Network::ip_remove_zero($ip);
|
||||
|
||||
##check if ip is valid
|
||||
if (! &General::validip($ip)){
|
||||
$errormessage.=$Lang::tr{'fwdfw err src_addr'}."<br>";
|
||||
@@ -569,11 +573,15 @@ sub checktarget
|
||||
($ip,$subnet)=split (/\//,$fwdfwsettings{'tgt_addr'});
|
||||
$subnet = &General::iporsubtocidr($subnet);
|
||||
}
|
||||
|
||||
#check if only ip
|
||||
if($fwdfwsettings{'tgt_addr'}=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
|
||||
$ip=$fwdfwsettings{'tgt_addr'};
|
||||
$subnet='32';
|
||||
}
|
||||
#remove leading zero
|
||||
$ip = &Network::ip_remove_zero($ip);
|
||||
|
||||
#check if ip is valid
|
||||
if (! &General::validip($ip)){
|
||||
$errormessage.=$Lang::tr{'fwdfw err tgt_addr'}."<br>";
|
||||
|
||||
Reference in New Issue
Block a user