File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
lib/private/Security/Normalizer
tests/lib/Security/Normalizer Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public function __construct(
2424 }
2525
2626 /**
27- * Return the given subnet for an IPv6 address (64 first bits)
27+ * Return the given subnet for an IPv6 address (48 first bits)
2828 */
2929 private function getIPv6Subnet (string $ ip ): string {
3030 if ($ ip [0 ] === '[ ' && $ ip [-1 ] === '] ' ) { // If IP is with brackets, for example [::1]
@@ -36,9 +36,9 @@ private function getIPv6Subnet(string $ip): string {
3636 }
3737
3838 $ binary = \inet_pton ($ ip );
39- $ mask = inet_pton ('FFFF:FFFF:FFFF:FFFF: : ' );
39+ $ mask = inet_pton ('FFFF:FFFF:FFFF:: ' );
4040
41- return inet_ntop ($ binary & $ mask ) . '/64 ' ;
41+ return inet_ntop ($ binary & $ mask ) . '/48 ' ;
4242 }
4343
4444 /**
@@ -63,7 +63,7 @@ private function getEmbeddedIpv4(string $ipv6): ?string {
6363
6464
6565 /**
66- * Gets either the /32 (IPv4) or the /64 (IPv6) subnet of an IP address
66+ * Gets either the /32 (IPv4) or the /48 (IPv6) subnet of an IP address
6767 */
6868 public function getSubnet (): string {
6969 if (filter_var ($ this ->ip , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 )) {
Original file line number Diff line number Diff line change @@ -36,20 +36,20 @@ public function subnetDataProvider() {
3636 '192.168.0.123/32 ' ,
3737 ],
3838 [
39- '2001:0db8:85a3 :0000:0000:8a2e:0370:7334 ' ,
40- '2001:db8:85a3::/64 ' ,
39+ '2001:0db8:0000 :0000:0000:8a2e:0370:7334 ' ,
40+ '2001:db8::/48 ' ,
4141 ],
4242 [
4343 '2001:db8:3333:4444:5555:6666:7777:8888 ' ,
44- '2001:db8:3333:4444::/64 ' ,
44+ '2001:db8:3333::/48 ' ,
4545 ],
4646 [
4747 '::1234:5678 ' ,
48- '::/64 ' ,
48+ '::/48 ' ,
4949 ],
5050 [
5151 '[::1] ' ,
52- '::/64 ' ,
52+ '::/48 ' ,
5353 ],
5454 ];
5555 }
You can’t perform that action at this time.
0 commit comments