Fix IPv6 broker nodename resolution for compressed addresses - #5544
Fix IPv6 broker nodename resolution for compressed addresses#5544Pranav Rathi (pranavrth) wants to merge 2 commits into
Conversation
A metadata-advertised IPv6 host ending in "::" was concatenated as "host:::port" and failed name resolution. Bracket IPv6 literals in rd_kafka_mk_nodename() and make the SASL hostname extraction bracket-aware. Adds broker/sasl unit tests, mock test 0191, and a manual SASL-over-[::1] repro script.
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Fixes broker nodename construction and SASL hostname derivation for IPv6 literals (especially compressed addresses ending in ::) by ensuring IPv6 nodenames are bracketed and by making SASL hostname extraction bracket-aware. This prevents malformed nodelists like host:::port and avoids truncating SASL hostnames to [ when given bracketed IPv6 nodenames.
Changes:
- Bracket IPv6 literals in
rd_kafka_mk_nodename()and add a broker unittest validatingrd_addrinfo_prepare()round-trips host/port correctly. - Introduce bracket-aware SASL hostname extraction and add a SASL unittest for nodename→hostname parsing.
- Add automated test coverage via a new mock test (0191) plus an opt-in manual Docker repro script.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/rdkafka_broker.c |
Brackets IPv6 literals when building broker nodenames; adds unit test for nodename construction/parsing. |
src/rdkafka_sasl.c |
Adds bracket-aware nodename→hostname extraction for SASL; adds SASL unit tests. |
src/rdunittest.c |
Registers the new SASL unit test suite. |
tests/0191-ipv6_nodename_mock.c |
New mock-based regression test validating IPv6 nodename formatting from metadata. |
tests/test.c |
Registers test 0191 in the test runner. |
tests/CMakeLists.txt |
Ensures test 0191 is built in CMake configurations. |
tests/manual-ipv6-sasl-repro.sh |
Adds an opt-in end-to-end manual repro for SASL over IPv6 loopback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| command -v docker >/dev/null || fail "docker not found" | ||
| [ -x "$CLIENT" ] || fail "example client not built: run 'make -C src && make -C examples rdkafka_example'" |
The MSVC build uses win32/tests/tests.vcxproj's explicit source list, not the Makefile glob or CMake, so the new test file must be listed there too or test.c fails to link (unresolved main_0191_...).
A metadata-advertised IPv6 host ending in "::" was concatenated as "host:::port" and failed name resolution. Bracket IPv6 literals in rd_kafka_mk_nodename() and make the SASL hostname extraction bracket-aware. Adds broker/sasl unit tests, mock test 0191, and a manual SASL-over-[::1] repro script.