mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 10:35:27 +00:00
DHCPv6: Fix sorting of IPv6 static mappings (#4513)
* DHCPv6: Fix sorting of IPv6 static mappings The ipcmp() function doesn't seem to return a correct result for IPv6 addresses. That's why the DHCPv6 static mappings are shown in the order they were added. This commit introduces ip6cmp() function and fixes sorting of IPv6 static mappings. * DHCPv6: Fix sorting of IPv6 static mappings Move ip6cmp() approach to ipcmp(), use single function for both IPv4 and IPv6. * DHCPv6: Fix sorting of IPv6 static mappings Oops, fixed a typo in ipcmp()
This commit is contained in:
parent
854942b4e0
commit
f8b7f92baf
@ -1190,9 +1190,11 @@ function check_subnets_overlap($subnet1, $bits1, $subnet2, $bits2)
|
||||
/* compare two IP addresses */
|
||||
function ipcmp($a, $b)
|
||||
{
|
||||
if (ip_less_than($a, $b)) {
|
||||
$na = inet_pton($a);
|
||||
$nb = inet_pton($b);
|
||||
if ($na < $nb) {
|
||||
return -1;
|
||||
} elseif (ip_greater_than($a, $b)) {
|
||||
} elseif ($na > $nb) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user