JDK-6565001 : Should use non-zero scope_id only for link-local addr
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: generic
  • Submitted: 2007-06-04
  • Updated: 2011-05-17
  • Resolved: 2011-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b15Fixed
Related Reports
Relates :  
Description
The test test/java/net/MulticastSocket/Test.java begins to fail since JDK 7 b13:
  **********************
  Test 4: /ff0e:0:0:0:0:0:0:a
  Join: /ff0e:0:0:0:0:0:0:a
  Send packet to: /ff0e:0:0:0:0:0:0:a
  Failed: Unexpected exception thrown:
  java.net.BindException: Cannot assign requested address: Datagram send   failed
        at java.net.PlainDatagramSocketImpl.send(Native Method)
        at java.net.DatagramSocket.send(DatagramSocket.java:657)
        at TestHego.doTest(TestHego.java:69)
        at TestHego.allTests(TestHego.java:186)
        at TestHego.main(TestHego.java:194)
  Test failed!!

Comments
SUGGESTED FIX ------- net_util_md.h ------- --- /tmp/sccs.2RaimH 2007-06-04 11:57:16.412783685 +0800 +++ net_util_md.h 2007-06-04 11:41:51.277713000 +0800 @@ -146,6 +146,13 @@ return (a->s6_bytes[0] == 0xff); } +WS2TCPIP_INLINE int +IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *a) +{ + return (a->s6_bytes[0] == 0xfe + && a->s6_bytes[1] == 0x80); +} + #define NI_MAXHOST 1025 /* Max size of a fully-qualified domain name */ #define NI_MAXSERV 32 /* Max size of a service name */ ------- net_util_md.c ------- --- /tmp/sccs.jgaijW 2007-06-08 11:00:13.846821022 +0800 +++ net_util_md.c 2007-06-07 10:32:04.159254000 +0800 @@ -846,7 +846,8 @@ him6->sin6_port = (u_short) htons((u_short)port); memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) ); him6->sin6_family = AF_INET6; - if (!scopeid && !cached_scope_id) { + if (IN6_IS_ADDR_LINKLOCAL( &(him6->sin6_addr) ) + && (!scopeid && !cached_scope_id)) { cached_scope_id = getDefaultIPv6Interface(env, him6); (*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
04-06-2007

EVALUATION Yes. Seems it is a regression caused by fix for 6543428. The fix incorrectly assign non-zero scope_id for site-local and global IPv6 address. It should assign one only for link-local address.
04-06-2007