Skip to content

Commit 8a9467b

Browse files
authored
Merge pull request #623 from librespeed/dev
ipv6 regexmatch
2 parents 8713fac + b023f31 commit 8a9467b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

backend/getIP.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ function getLocalOrPrivateIpInfo($ip)
3030
return 'link-local IPv6 access';
3131
}
3232

33+
// fc00::/7 Unique Local IPv6 Unicast Addresses
34+
if (preg_match('/^(fc|fd)([0-9a-f]{0,4}:){1,7}[0-9a-f]{1,4}$/i', $ip) === 1) {
35+
return 'ULA IPv6 access';
36+
}
37+
3338
// anything within the 127/8 range is localhost ipv4, the ip must start with 127.0
3439
if (strpos($ip, '127.') === 0) {
3540
return 'localhost IPv4 access';

0 commit comments

Comments
 (0)