[
https://issues.apache.org/jira/browse/HDFS-17834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18039755#comment-18039755
]
ASF GitHub Bot commented on HDFS-17834:
---------------------------------------
mynameis180 opened a new pull request, #8097:
URL: https://github.com/apache/hadoop/pull/8097
<!--
Thanks for sending a pull request!
1. If this is your first time, please read our contributor guidelines:
https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
2. Make sure your PR title starts with JIRA issue id, e.g.,
'HADOOP-17799. Your PR title ...'.
-->
## NOTICE
This is a backport of HDFS-17834 from branch-3.4 to trunk.
## What changes were proposed in this pull request?
This PR fixes
[HDFS-17834](https://issues.apache.org/jira/browse/HDFS-17834): HDFS Router
Federation Health page generates invalid HTTP links for DataNodes in IPv6
environment.
### Problem
The Router Federation Health page incorrectly handles IPv6 addresses when
constructing DataNode HTTP links:
- Fails to properly parse IPv6 addresses from `infoAddr` and
`infoSecureAddr` fields
- Incorrectly splits IPv6 addresses, mistaking address segments for port
numbers
- Generates malformed URLs that don't conform to RFC 2732 standards for IPv6
literal addresses
- Results in unclickable links that prevent access to DataNode web interfaces
### Solution
- Enhance address parsing logic to correctly handle both IPv4 and IPv6
address formats
- Properly extract port numbers from IPv6 addresses formatted as
`[address]:port`
- Maintain backward compatibility with existing IPv4 address handling
- Ensure generated URLs follow RFC 2732 standards for IPv6 literal addresses
### Example
**Before**: `https://fe80:0:0:0:215:5dff:fe00:3110:50075` (invalid)
**After**: `https://[fe80:0:0:0:215:5dff:fe00:3110]:50075` (valid)
## How was this patch tested?
- **Unit tests**: Verified address parsing logic for both IPv4 and IPv6
formats
- **Regression testing**: Confirmed no impact on existing IPv4 functionality
- **Manual testing**: Validated in IPv6-enabled environments
- **Link verification**: Verified generated URLs are correctly formatted and
accessible
## Code Change Verification
- [x] PR title starts with corresponding JIRA issue id (HDFS-17834)
- [x] No new dependencies added
- [x] Existing tests pass
- [x] Code follows Hadoop coding standards
## Original PR
This change was already committed and tested in branch-3.4.
Please review @slfan1989 @Hexiaoqiao
> Fix invalid HTTP links for DataNodes in IPv6 environment.
> ---------------------------------------------------------
>
> Key: HDFS-17834
> URL: https://issues.apache.org/jira/browse/HDFS-17834
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 3.4.1
> Environment: !image-2025-09-10-10-12-28-486.png|width=545,height=298!
> Reporter: sunhui
> Assignee: sunhui
> Priority: Minor
> Labels: pull-request-available
> Fix For: 3.4.3
>
> Attachments: fixwebsite_support_ipv6.diff,
> image-2025-09-10-10-12-28-486.png
>
>
> In the HDFS NameNode Web UI
> (http://nn-host:9870/dfshealth.html#tab-datanode), the "Http Address" column
> for DataNodes generates completely corrupt and invalid links when the
> DataNode's address is an IPv6 literal.
> 1. It fails to encapsulate the IPv6 address in square brackets `[]`, which is
> required by RFC 2732. 2. More critically, it appears to **parse the IPv6
> address incorrectly**, mistaking a part of the address (e.g., the `30` in
> `1172:30:...`) for the port number, which completely breaks the URL. This
> results in a malformed, unclickable link that does not point to the
> DataNode's web interface. **Current Behavior & Evidence:** The DataNode's
> actual address is: `[1172:30:0:0:0:0:8a34]:50010` However, the NameNode UI
> displays the link as: `https://datanodeHostname:30` This link is **invalid**
> and leads nowhere. The UI has: - Stripped the original port `50010`. -
> Incorrectly extracted `30` (which is part of the IPv6 address) and used it as
> the port. - Failed to wrap the IPv6 address, leading to incorrect parsing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]