You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So with the ip_in_range functions i tested both IPv4 and IPv6 and IPv4 seems to be functioning fine but IPv6 seems to have a problem with the IP and range i provided it.
Also yes i did add my own function to make it easier to use for ipv4 and ipv6 so it can tell the difference between the two. (hopefully it gets added to the main script for easier use)
function ip_range_type($range_ip)
{
if (strpos($range_ip, ':') !== false) {
//if ip range provided is ipv6 then
//echo "range provided is ipv6";
return 1;
} else {
//if ip range provided is ipv4 then
//echo "range provided is ipv4";
return 2;
}
}
function ip_in_range($ip, $range_ip)
{
//only check IPv4 addresses against IPv4 ranges
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) && ip_range_type($range_ip) == 2) {
return ipv4_in_range($ip, $range_ip);
}
//only check IPv6 addresses against IPv6 ranges
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && ip_range_type($range_ip) == 1) {
return ipv6_in_range($ip, $range_ip);
}
}
I have the same issue, if you look at the code, it actually ignores the netmask (/29) and behaves like it would of been /32
I will see if I can provide a patch for this case.
So with the ip_in_range functions i tested both IPv4 and IPv6 and IPv4 seems to be functioning fine but IPv6 seems to have a problem with the IP and range i provided it.
IP and range provided.
Also yes i did add my own function to make it easier to use for ipv4 and ipv6 so it can tell the difference between the two. (hopefully it gets added to the main script for easier use)
Online example :
https://3v4l.org/h5psU
I don't know why that range is incorrect if you look up the details on that users IP it provides that as a valid range.
http://ipinfo.io/2a02:c7f:9e03:1d00:59c2:3083:c23b:7146
The text was updated successfully, but these errors were encountered: