Skip to content

HADOOP-19958. Support IPv6 delegation token service addresses - #8669

Open
smengcl wants to merge 1 commit into
apache:trunkfrom
smengcl:HADOOP-19958
Open

HADOOP-19958. Support IPv6 delegation token service addresses#8669
smengcl wants to merge 1 commit into
apache:trunkfrom
smengcl:HADOOP-19958

Conversation

@smengcl

@smengcl smengcl commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Codex (GPT-5.6 Sol)

Description of PR

Jira: HADOOP-19958

Parent Jira: HADOOP-11890

Delegation token services use host:port. This representation is ambiguous when the host is an IPv6 literal.

This change:

  • adds a shared NetUtils helper that formats IPv6 addresses as [host]:port;
  • accepts bracketed IPv6 authorities when creating socket addresses;
  • uses the shared format for delegation token services in both token-service modes;
  • verifies token service round trips when hadoop.security.token.service.use_ip is true or false;
  • rejects ambiguous unbracketed IPv6 authorities; and
  • preserves existing DNS and IPv4 behavior.

How was this patch tested?

  • JAVA_HOME=<JDK17> mvn -B -pl :hadoop-common -Dtest=TestNetUtils,TestSecurityUtil test --no-transfer-progress
  • Result: 76 tests passed with no failures, errors, or skips.
  • git diff --check asf/trunk...HEAD

For code changes:

  • Does the title of this PR start with the corresponding JIRA issue id
    (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: Have the integration tests been executed and the endpoint
    declared according to the connector-specific documentation? Note: Automated CI
    testing doesn't cover all cases so manual testing with cloud storage is still
    required.
    Not applicable to this change.
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion
    under ASF 2.0? No new dependencies are added.
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?
    No license or notice changes are required.

AI Tooling

Contains content generated by Codex.

If an AI tool was used:

Copilot AI lite review requested due to automatic review settings August 11, 2026 06:21
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 21s #8669 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8669/1/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

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

This PR addresses ambiguity in delegation token service identifiers when the host is an IPv6 literal by introducing a consistent bracketed "[host]:port" representation and ensuring socket address creation accepts bracketed IPv6 authorities.

Changes:

  • Add NetUtils.getHostPortString(host, port) to format host:port while bracketing IPv6 literals.
  • Update delegation token service string construction to use the shared host/port formatter.
  • Add tests covering IPv6 host/port formatting, bracketed IPv6 socket address parsing, and delegation token service round-trips.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestSecurityUtil.java Updates token-service string expectations and adds an IPv6 token service round-trip test.
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java Adds tests for IPv6 host/port formatting, bracketed parsing, and rejection of ambiguous unbracketed IPv6 authorities.
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java Uses the shared host/port formatter when building token service identifiers.
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java Adds IPv6-aware host/port formatting and strips brackets from parsed URI hosts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +788 to +791
if (normalizedHost != null && normalizedHost.contains(":")) {
return "[" + normalizedHost + "]:" + port;
}
return normalizedHost + ":" + port;
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 22s #8669 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8669/2/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@slfan1989 slfan1989 self-assigned this Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants