smengcl opened a new pull request, #11970: URL: https://github.com/apache/ozone/pull/11970
Generated-by: Claude Code (Opus 5.5) ## What changes were proposed in this pull request? In secure mode, Ozone's copy of the Hadoop RPC client (`org.apache.hadoop.ipc_.Client`) binds the client socket to a local address of the host in the caller's Kerberos principal before connecting. It uses `NetUtils.getLocalInetAddress(host)`, which returns the first address of that host. On a dual stack host with the default `java.net.preferIPv6Addresses=false` that is the IPv4 address, so connecting to a service configured with an IPv6 address fails. The reverse combination fails the same way. This affects OM to SCM, datanode to SCM, Recon and SCM to SCM RPC. HDDS-17195 made `ipc.client.bind.wildcard.addr=true` work as a workaround, but it is off by default. With this change, when the first address of the principal host has a different family from the server address, the client looks for a local address of the principal host in the server's family and binds to that. If there is none, it does not bind, as already happens when the principal host is not a local address. Nothing changes when the first address already matches the server's family, which covers IPv4 only and IPv6 only clusters. The helper only uses JDK APIs and the existing `NetUtils.getLocalInetAddress`, because the Ozone filesystem jar for Hadoop 2 uses the Hadoop 2 `NetUtils` at runtime. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17728 ## How was this patch tested? Added to `TestClient`: * `testNoBindToAddressOfOtherFamily` runs the real connection setup with an IPv6 principal host (`::1`) and an IPv4 server, and checks that the socket is not bound to the IPv6 address. It fails without the fix. * `testLocalAddressOfFamily` covers the address selection for both families, a non local candidate, and no candidate of the server's family. Both are skipped when the IPv6 loopback is not available. The existing `testKerberosSocketBinding` still passes, and now shares the connection setup helper with the new test. Checkstyle passes locally. CI. 🤖 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]
