smengcl opened a new pull request, #8983: URL: https://github.com/apache/hadoop/pull/8983
Generated-by: Claude Code (Opus 5.5) JIRA: https://issues.apache.org/jira/browse/HADOOP-20083 ### Description of PR `MachineList` resolved each hostname entry with `getByName` and kept only that one address. A host with several addresses (a dual-stack host, or a host with more than one IPv4 address) matched only from that address. For example, `localhost` matched `127.0.0.1` but not `::1` by default, and the reverse with `java.net.preferIPv6Addresses=true`. This affects proxy user hosts, service level authorization host lists and `FileBasedIPList`. This patch resolves hostname entries with `getAllByName` and keeps every address. IP literal and CIDR entries behave as before (`getAllByName` of a literal returns that one address). `InetAddressFactory` gets a public `getAllByName`. The base class returns `InetAddress.getAllByName`. A subclass that overrides only `getByName` keeps resolving through it (one address per entry, as before), so existing subclasses and test factories keep working; they can override `getAllByName` to return more. ### How was this patch tested? New test `TestMachineList#testHostNameWithSeveralAddresses`: a hostname with two IPv4 addresses and one IPv6 address matches from each of them, and unrelated IPv4 and IPv6 addresses are rejected. It fails without the fix. `TestMachineList`, `TestProxyUsers`, `TestServiceAuthorization`, `TestFileBasedIPList`, `TestCacheableIPList`, `TestDefaultImpersonationProvider`, `TestProxyServers`, `TestWhitelistBasedResolver` and `TestDoAsEffectiveUser` pass locally on JDK 17. ### For code changes: - [x] Does the title of this PR start with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')? ### AI Tooling - [x] The PR includes the phrase "Contains content generated by Claude Code". - [x] My use of AI contributions follows the ASF legal policy https://www.apache.org/legal/generative-tooling.html Contains content generated by Claude Code. 🤖 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]
