HDDS-9894. IP address checks neglect disabling some IPv6 addresses that are disabled for IPv4#10687
Draft
smengcl wants to merge 3 commits into
Draft
HDDS-9894. IP address checks neglect disabling some IPv6 addresses that are disabled for IPv4#10687smengcl wants to merge 3 commits into
smengcl wants to merge 3 commits into
Conversation
…at are disabled for IPv4
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an address-filtering gap in HddsServerUtil#getValidInetsForCurrentHost() where IPv6 wildcard/loopback addresses (::, ::1) could be included in certificate SANs even though the IPv4 equivalents were excluded, by switching from string-based filtering to semantic InetAddress predicates.
Changes:
- Replaced fixed-string invalid IP filtering with a semantic helper
isValidInetForCsr(InetAddress)usingisAnyLocalAddress()/isLoopbackAddress(), plus existing IPv6 scoped/prefix exclusion. - Removed the unused
INVALID_IPSset and centralized the CSR eligibility logic in the helper. - Added unit tests validating exclusion of IPv4/IPv6 wildcard and loopback addresses, and inclusion of representative routable addresses.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtils.java | Adds unit tests covering IPv4/IPv6 wildcard + loopback exclusion and routable address inclusion for CSR SAN eligibility. |
| hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HddsServerUtil.java | Introduces isValidInetForCsr(InetAddress) and updates interface enumeration to use semantic address predicates, ensuring IPv6 equivalents are filtered consistently. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated-by: Claude Code (Opus 4.8)
What changes were proposed in this pull request?
HddsServerUtil#getValidInetsForCurrentHost()excluded IPv4 wildcard/loopback(
0.0.0.0,127.0.0.1) from certificate SANs via a fixed string set, but missedthe IPv6 equivalents (
::,::1), which then leaked into SANs.Replaced the string match with the semantic
isAnyLocalAddress()/isLoopbackAddress()predicates (covering both families) in a new testable helperisValidInetForCsr(InetAddress); removed the unusedINVALID_IPSset.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9894
How was this patch tested?