Skip to content

Commit

Permalink
Merge pull request librespeed#623 from librespeed/dev
Browse files Browse the repository at this point in the history
ipv6 regexmatch
  • Loading branch information
sstidl authored May 18, 2024
2 parents 8713fac + b023f31 commit 8a9467b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/getIP.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ function getLocalOrPrivateIpInfo($ip)
return 'link-local IPv6 access';
}

// fc00::/7 Unique Local IPv6 Unicast Addresses
if (preg_match('/^(fc|fd)([0-9a-f]{0,4}:){1,7}[0-9a-f]{1,4}$/i', $ip) === 1) {
return 'ULA IPv6 access';
}

// anything within the 127/8 range is localhost ipv4, the ip must start with 127.0
if (strpos($ip, '127.') === 0) {
return 'localhost IPv4 access';
Expand Down

0 comments on commit 8a9467b

Please sign in to comment.