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 @@ -46,7 +46,7 @@ public function __construct(
4646 }
4747
4848 /**
49- * Return the given subnet for an IPv6 address (64 first bits)
49+ * Return the given subnet for an IPv6 address (48 first bits)
5050 */
5151 private function getIPv6Subnet (string $ ip ): string {
5252 if ($ ip [0 ] === '[ ' && $ ip [-1 ] === '] ' ) { // If IP is with brackets, for example [::1]
@@ -58,9 +58,9 @@ private function getIPv6Subnet(string $ip): string {
5858 }
5959
6060 $ binary = \inet_pton ($ ip );
61- $ mask = inet_pton ('FFFF:FFFF:FFFF:FFFF: : ' );
61+ $ mask = inet_pton ('FFFF:FFFF:FFFF:: ' );
6262
63- return inet_ntop ($ binary & $ mask ).'/64 ' ;
63+ return inet_ntop ($ binary & $ mask ).'/48 ' ;
6464 }
6565
6666 /**
@@ -85,7 +85,7 @@ private function getEmbeddedIpv4(string $ipv6): ?string {
8585
8686
8787 /**
88- * Gets either the /32 (IPv4) or the /64 (IPv6) subnet of an IP address
88+ * Gets either the /32 (IPv4) or the /48 (IPv6) subnet of an IP address
8989 */
9090 public function getSubnet (): string {
9191 if (filter_var ($ this ->ip , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 )) {
Original file line number Diff line number Diff line change @@ -51,20 +51,20 @@ public function subnetDataProvider() {
5151 '192.168.0.123/32 ' ,
5252 ],
5353 [
54- '2001:0db8:85a3 :0000:0000:8a2e:0370:7334 ' ,
55- '2001:db8:85a3::/64 ' ,
54+ '2001:0db8:0000 :0000:0000:8a2e:0370:7334 ' ,
55+ '2001:db8::/48 ' ,
5656 ],
5757 [
5858 '2001:db8:3333:4444:5555:6666:7777:8888 ' ,
59- '2001:db8:3333:4444::/64 ' ,
59+ '2001:db8:3333::/48 ' ,
6060 ],
6161 [
6262 '::1234:5678 ' ,
63- '::/64 ' ,
63+ '::/48 ' ,
6464 ],
6565 [
6666 '[::1] ' ,
67- '::/64 ' ,
67+ '::/48 ' ,
6868 ],
6969 ];
7070 }
You can’t perform that action at this time.
0 commit comments