mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Fix getting subnet of ipv4 mapped ipv6 addresses
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
68fecc1d9f
commit
7e08a4ab15
2 changed files with 6 additions and 0 deletions
|
|
@ -103,6 +103,8 @@ class IpAddress {
|
|||
$this->ip,
|
||||
32
|
||||
);
|
||||
} elseif (substr(strtolower($this->ip), 0, 7) === '::ffff:') {
|
||||
return '::ffff:' . $this->getIPv4Subnet(substr($this->ip, 7), 32);
|
||||
}
|
||||
return $this->getIPv6Subnet(
|
||||
$this->ip,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ class IpAddressTest extends TestCase {
|
|||
'192.168.0.123',
|
||||
'192.168.0.123/32',
|
||||
],
|
||||
[
|
||||
'::ffff:192.168.0.123',
|
||||
'::ffff:192.168.0.123/32',
|
||||
],
|
||||
[
|
||||
'2001:0db8:85a3:0000:0000:8a2e:0370:7334',
|
||||
'2001:db8:85a3::/64',
|
||||
|
|
|
|||
Loading…
Reference in a new issue