JDK-6500095 : Inet6Address.getHostName() should not include scope id for global addresses
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux
  • CPU: x86
  • Submitted: 2006-12-04
  • Updated: 2024-05-21
  • Resolved: 2024-05-21
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux mach 2.6.15-26-386 #1 PREEMPT Fri Jul 7 19:27:00 UTC 2006 i686 GNU/Linux

and basically all others, judging by the Inet6Address source code.

A DESCRIPTION OF THE PROBLEM :
In the javadoc section entitled "Textual representation of IPv6 scoped addresses" for java.net.Inet6Address, it is stated that the use of scope IDs follows draft-ietf-ipngwg-scoping-arch-04.txt.

In section 12.1 of draft-ietf-ipngwg-scoping-arch-04.txt it is stated

"12.1 Non-Global Addresses

The format applies to all kinds of unicast and multicast addresses of
non-global scope except the unspecified address, which does not have a
scope.  The format is meaningless and should not be used for global
addresses. "

Yet, if one does a getHostName() on a global Inet6Address, one gets something like

2001:4840:ffff:fffe:211:24ff:fea5:d2c8%0

My reading of the section 12.1 of the IETF draft suggests that the scope ID should not be present on this textual representation.  Moreover, the same language is used in Section 11.1 of RFC 4007 http://www.ietf.org/rfc/rfc4007.txt, which is the standards-track version of this draft.

In closing, I would consider the scope ID on global IPv6 addresses a bug.

REPRODUCIBILITY :
This bug can be reproduced always.

Comments
The addresses returned by DNS do not have a scope ID in their textual representation unless the scope is non-zero. It takes an address with scope 0 to create an address with scope zero. I wouldn't change that.
21-05-2024

Could not reproduce the issue. Could not find any related changes either.
21-05-2024