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
--
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]