Skip to content

Commit

Permalink
Bug-fix (CIDRAM/CIDRAM#486).
Browse files Browse the repository at this point in the history
Changelog excerpt:
- The aggregator's constructTables method was constructing the wrong IPv6
  netmask for last hextet; Fixed.
  • Loading branch information
Maikuolan committed Aug 3, 2023
1 parent 6b461f3 commit 3c7d6d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Versioning guidelines for SemVer can be found at: https://semver.org/

- [2022.12.09; Maikuolan]: Avoid packaging unnecessary files into dist.

- [2023.08.03; Bug-fix; neufeind]: The aggregator's constructTables method was
constructing the wrong IPv6 netmask for last hextet; Fixed.

=== Version/Release 1.3.3 ===
PATCH RELEASE.

Expand Down
4 changes: 2 additions & 2 deletions src/Aggregator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Aggregator v1.3.4 (last modified: 2022.05.25).
* Aggregator v1.3.4 (last modified: 2023.08.03).
* @link https://github.com/CIDRAM/Aggregator
*
* Description: A stand-alone class implementation of the IPv4+IPv6 IP+CIDR
Expand Down Expand Up @@ -161,7 +161,7 @@ private function constructTables()
$CIDR = 128;
for ($Octet = 8; $Octet > 0; $Octet--) {
$Base = str_repeat('ffff:', $Octet - 1);
$End = ($Octet === 8) ? ':0' : '::';
$End = ($Octet === 8) ? '' : '::';
for ($Addresses = 1, $Iterate = 0; $Iterate < 16; $Iterate++, $Addresses *= 2, $CIDR--) {
$Netmask = $Base . (dechex(65536 - $Addresses)) . $End;
$this->TableNetmaskIPv6[$CIDR] = $Netmask;
Expand Down

0 comments on commit 3c7d6d5

Please sign in to comment.