Skip to content

fix: print correct address in accept() debug log for IPv6#97

Open
kugland wants to merge 2 commits into
emikulic:masterfrom
kugland:fix/ipv6-accept-debug-log
Open

fix: print correct address in accept() debug log for IPv6#97
kugland wants to merge 2 commits into
emikulic:masterfrom
kugland:fix/ipv6-accept-debug-log

Conversation

@kugland
Copy link
Copy Markdown
Contributor

@kugland kugland commented May 13, 2026

Summary

In IPv6 mode, accept() populates addrin6 but the debug printf always read from the uninitialized addrin (IPv4) struct, printing garbage. Gate on inet6 and use get_address_text() with bracketed IPv6 form.

Test plan

  • Builds clean (both IPv4 and IPv6 paths)
  • Debug output now shows correct peer address for IPv6 connections

kugland added 2 commits May 16, 2026 21:45
Verify that --ipv6 mode prints the correct [::1]:PORT in the accept()
debug log, not garbage from the uninitialized IPv4 addrin struct.
In IPv6 mode, accept() populates addrin6 but the debug printf always
read from the uninitialized addrin (IPv4) struct, printing garbage.
Gate on inet6 and use get_address_text() with bracketed IPv6 form.
@kugland kugland force-pushed the fix/ipv6-accept-debug-log branch from 38ab6b8 to 9902c5c Compare May 17, 2026 00:47
@kugland
Copy link
Copy Markdown
Contributor Author

kugland commented May 17, 2026

Added a regression test for the bug. Also reversed the commit order — test comes first, so you can check out the first commit to see it fail, then the second to see the fix make it pass.

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