smengcl opened a new pull request, #8807:
URL: https://github.com/apache/hadoop/pull/8807
Generated-by: Claude Code (Opus 5.5)
### Description of PR
`DNS.reverseDns` builds only `in-addr.arpa` names. For an IPv6 address it
throws `ArrayIndexOutOfBoundsException` before any lookup is made.
`DNS.getHosts` catches only `NamingException`, so `DNS.getDefaultHost` fails
for any named interface that has an IPv6 address. This affects
`hadoop.security.dns.interface`, `dfs.datanode.dns.interface` and
`DNSDomainNameResolver.getHostnameByIP` once `java.net.preferIPv4Stack` is not
set to true.
This PR builds the `ip6.arpa` name defined by RFC 3596 for IPv6 addresses:
the 32 nibbles of the address in reverse order, followed by `ip6.arpa`.
* IPv4 names are unchanged.
* IPv4 mapped addresses are unchanged. The JDK returns them as
`Inet4Address`, so they still use `in-addr.arpa`.
* The scope id of a scoped address is not part of the name.
Sub-task of HADOOP-11890.
### How was this patch tested?
Added `TestDNS#testReverseDnsName`, which checks the generated names without
a DNS server: an IPv4 address, the example from RFC 3596 section 2.5,
`2001:db8::1`, `::1`, an IPv4 mapped address and a scoped link local address.
`mvn test -Dtest=TestDNS` in `hadoop-common` with JDK 17: 13 tests run, 0
failures, 0 errors, 0 skipped.
Also verified by hand on a host with IPv6 enabled:
`DNS.getDefaultHost("lo0", null, true)` threw `ArrayIndexOutOfBoundsException`
before the change and returns `localhost` after it.
### For code changes:
- [x] 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.*
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`,
`NOTICE-binary` files?
### AI Tooling
Contains content generated by Claude Code.
- [x] The PR includes the phrase "Contains content generated by <tool>"
where <tool> is the name of the AI tool used.
- [x] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]