Skip to content

fix(): rebuild the SLAAC MAC address from the address bytes - #21

Merged
e7d merged 1 commit into
masterfrom
fix/slaac-mac-leading-zero
Nov 18, 2026
Merged

e7d merged 1 commit into
masterfrom
fix/slaac-mac-leading-zero

Conversation

@e7d

@e7d e7d commented Nov 18, 2026

Copy link
Copy Markdown
Owner

An IPv6 SLAAC/EUI-64 address whose last group starts with a zero answered HTTP 500 with an empty body. 2a01:cb05:801c:d01:be24:11ff:fee8:200 (a Proxmox guest, MAC BC:24:11:E8:02:00) was turned into the MAC bc:24:11:e8:20:0, which Mac rejects. ?ip=<address> hit the same path.

The MAC was cut out of the compressed text form of the address, so a dropped leading zero, a :: inside the interface id or an fffe outside bytes 11-12 shifted every pair after it. It is now read from bytes 8-10 and 13-15 of inet_pton(), with the universal/local bit flipped as before.

PHPUnit 11 comes in as a dev dependency to hold the regression test (composer test). composer prod now installs with --no-dev so the image does not ship it. CI does not run the test yet.

Checked:

  • tests/Unit/Types/IPTest.php: 3 of 5 cases fail with Invalid MAC address before the fix, 5/5 pass after.
  • The published e7db/ifconfig:master image with the patched IP.php mounted: /txt for the address above went from 500 to 200, and /json reports BC:24:11:E8:02:00.
  • Not checked locally: a full image build. It failed in the base stage on apt-get (packages.sury.org) before any repository file is copied; this PR's build covers it.

🤖 Generated with Claude Code

An EUI-64 address whose last group starts with a zero answered HTTP 500
with an empty body: 2a01:cb05:801c:d01:be24:11ff:fee8:200 became the
MAC bc:24:11:e8:20:0, which Mac rejects as invalid. The MAC was cut out
of the compressed text form, so a dropped leading zero, a "::" in the
interface id or an "fffe" outside bytes 11-12 shifted every pair after
it. Reading bytes 8-10 and 13-15 of inet_pton() has none of these cases.

PHPUnit comes in as a dev dependency to hold the regression test;
`composer prod` now installs with --no-dev so the image does not ship it.
@e7d
e7d merged commit af41909 into master Nov 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant