[
https://issues.apache.org/jira/browse/HDFS-17629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18072857#comment-18072857
]
ASF GitHub Bot commented on HDFS-17629:
---------------------------------------
balodesecurity opened a new pull request, #8419:
URL: https://github.com/apache/hadoop/pull/8419
## Summary
- In `histogram-hostip.js`, `open_hostip_list()` extracted the host from
`dn.infoAddr` using `split(":")[0]`. For an IPv6 `infoAddr` of the form
`[2001:db8::1]:9864` this yields `[2001` instead of the full IPv6 address.
- Fix mirrors the logic already used in `dfshealth.js`: split on `]:` first;
if more than one part the address is IPv6 and we strip the leading `[` from
part `[0]`; otherwise fall back to the original IPv4 `split(":")[0]` path.
## Test
- JavaScript-only change; verified manually that IPv4 (`host:port`)
continues to extract the host, and IPv6 (`[addr]:port`) now correctly extracts
the full address without brackets.
> The IP address is incorrectly displayed in the IPv6 environment.
> ----------------------------------------------------------------
>
> Key: HDFS-17629
> URL: https://issues.apache.org/jira/browse/HDFS-17629
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: zeekling
> Priority: Major
> Labels: pull-request-available
> Attachments: image-2024-09-23-09-22-28-495.png
>
>
>
> !image-2024-09-23-09-22-28-495.png!
>
> function open_hostip_list in histogram-hostip.js , here is root reason
> {code:java}
> if (index > x0 && index <= x1) {
> ips.push(dn.infoAddr.split(":")[0]);
> } {code}
> need change to:
> {code:java}
> if (index > x0 && index <= x1) {
> ips.push(dn.infoAddr.split(":")[0]);
> var idx = dn.infoAddr.lastIndexOf(":");
> var dnIp = dn.infoAddr.substring(0, idx);
> ips.push(dnIp);
> }{code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]