8000 [HttpFoundation] Support 0 bit netmask in IPv6 (`::/0`) by stephank · Pull Request #25330 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] Support 0 bit netmask in IPv6 (::/0) #25330

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Add support for IPv6 netmask with 0 bits masked
  • Loading branch information
Stéphan Kochen committed Dec 5, 2017
commit c5142e4f80514fb3a151b9540ae4d4233927be23
4 changes: 4 additions & 0 deletions src/Symfony/Component/HttpFoundation/IpUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public static function checkIp6($requestIp, $ip)
if (false !== strpos($ip, '/')) {
list($address, $netmask) = explode('/', $ip, 2);

if ('0' === $netmask) {
return (bool) unpack('n*', @inet_pton($address));
}

if ($netmask < 1 || $netmask > 128) {
return self::$checkedIps[$cacheKey] = false;
}
Expand Down
0