mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/9802] Only check for IPv4-mapped address when address is IPv6.
PHPBB3-9802
This commit is contained in:
parent
bef2540d9c
commit
5ca7121ed2
1 changed files with 22 additions and 17 deletions
|
@ -278,13 +278,12 @@ class session
|
||||||
|
|
||||||
foreach ($ips as $ip)
|
foreach ($ips as $ip)
|
||||||
{
|
{
|
||||||
// check IPv4 first, the IPv6 is hopefully only going to be used very seldomly
|
if (preg_match(get_preg_expression('ipv4'), $ip))
|
||||||
if (!preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip))
|
|
||||||
{
|
{
|
||||||
// Just break
|
$this->ip = $ip;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else if (preg_match(get_preg_expression('ipv6'), $ip))
|
||||||
|
{
|
||||||
// Quick check for IPv4-mapped address in IPv6
|
// Quick check for IPv4-mapped address in IPv6
|
||||||
if (stripos($ip, '::ffff:') === 0)
|
if (stripos($ip, '::ffff:') === 0)
|
||||||
{
|
{
|
||||||
|
@ -296,9 +295,15 @@ class session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the last in chain
|
|
||||||
$this->ip = $ip;
|
$this->ip = $ip;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We want to use the last valid address in the chain
|
||||||
|
// Leave foreach loop when address is invalid
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->load = false;
|
$this->load = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue