mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +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
@@ -122,6 +122,19 @@ sub network2bin($) {
|
||||
return ($network_start, $netmask_bin);
|
||||
}
|
||||
|
||||
# Deletes leading zeros in ip address
|
||||
sub ip_remove_zero{
|
||||
my $address = shift;
|
||||
my @ip = split (/\./, $address);
|
||||
|
||||
foreach my $octet (@ip) {
|
||||
$octet = int($octet);
|
||||
}
|
||||
|
||||
$address = join (".", @ip);
|
||||
|
||||
return $address;
|
||||
}
|
||||
# Returns True for all valid IP addresses
|
||||
sub check_ip_address($) {
|
||||
my $address = shift;
|
||||
|
||||
Reference in New Issue
Block a user