mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-04 04:15:11 +00:00
network: is_ip_in_cidr: correctly handle the CIDR being a singleton range
i.e. is_ip_in_cidr('127.0.0.1', '127.0.0.1/32', 4) should return 1; Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
06c1c13f1c
commit
123c310474
@ -592,7 +592,9 @@ sub is_ip_in_cidr {
|
||||
my $ip_obj = Net::IP->new($ip, $version);
|
||||
return undef if !$ip_obj;
|
||||
|
||||
return $cidr_obj->overlaps($ip_obj) == $Net::IP::IP_B_IN_A_OVERLAP;
|
||||
my $overlap = $cidr_obj->overlaps($ip_obj);
|
||||
|
||||
return $overlap == $Net::IP::IP_B_IN_A_OVERLAP || $overlap == $Net::IP::IP_IDENTICAL;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user