Skip to content

Fix IPv6 broker nodename resolution for compressed addresses - #5544

Open
Pranav Rathi (pranavrth) wants to merge 2 commits into
masterfrom
dev_ipv6_nodename_bracket_fix
Open

Fix IPv6 broker nodename resolution for compressed addresses#5544
Pranav Rathi (pranavrth) wants to merge 2 commits into
masterfrom
dev_ipv6_nodename_bracket_fix

Conversation

@pranavrth

Copy link
Copy Markdown
Member

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.

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.
@pranavrth
Pranav Rathi (pranavrth) requested a review from a team as a code owner July 7, 2026 03:40
Copilot AI review requested due to automatic review settings July 7, 2026 03:40
@confluent-cla-assistant

Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 validating rd_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.

Comment on lines +47 to +48
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_...).
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.

2 participants