Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable21] Increase subnet matcher #26514

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/private/Security/Normalizer/IpAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private function getIPv6Subnet(string $ip, int $maskBits = 48): string {
}

/**
* Gets either the /32 (IPv4) or the /128 (IPv6) subnet of an IP address
* Gets either the /32 (IPv4) or the /64 (IPv6) subnet of an IP address
*
* @return string
*/
Expand All @@ -106,7 +106,7 @@ public function getSubnet(): string {
}
return $this->getIPv6Subnet(
$this->ip,
128
64
);
}

Expand Down
12 changes: 10 additions & 2 deletions tests/lib/Security/Normalizer/IpAddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@ public function subnetDataProvider() {
],
[
'2001:0db8:85a3:0000:0000:8a2e:0370:7334',
'2001:db8:85a3::8a2e:370:7334/128',
'2001:db8:85a3::/64',
],
[
'2001:db8:3333:4444:5555:6666:7777:8888',
'2001:db8:3333:4444::/64',
],
[
'::1234:5678',
'::/64',
],
[
'[::1]',
'::1/128',
'::/64',
],
];
}
Expand Down