-
Bug
-
Resolution: Duplicate
-
P3
-
7
This issue causes (at least) 2 JCK test failures:
api/java_nio/channels/DatagramChannel/DatagramChannel.html#NetworkChannel[bindToAutoAddress_test]
api/java_nio/channels/DatagramChannel/DatagramChannel.html#NetworkChannel[bindRepeatedly_test]
The rest is copied from exclude request JCK-7300127:
--- start of quote ----
In JavaSE7 (jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java)
public DatagramChannel bind(SocketAddress local) throws IOException {
.....
InetSocketAddress isa;
if (local == null) {
isa = new InetSocketAddress(0); <= this will create IPv6 socket
} else {
isa = Net.checkAddress(local);
// only Inet4Address allowed with IPv4 socket
if (family == StandardProtocolFamily.INET) {
InetAddress addr = isa.getAddress();
if (!(addr instanceof Inet4Address))
throw new UnsupportedAddressTypeException();
}
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkListen(isa.getPort());
}
Net.bind(family, fd, isa.getAddress(), isa.getPort()); <= family is INET(IPv4)
localAddress = Net.localAddress(fd);
}
}
So they execute in IPv4 mode (family=INET) *AND* java.net.preferIPv6Addresses is TRUE,
then InetSoketAddress(0) constructor creates IPv6 address.
Later it tries to bind with IPv6 address on IPv4 mode.
---- end of quote ----
api/java_nio/channels/DatagramChannel/DatagramChannel.html#NetworkChannel[bindToAutoAddress_test]
api/java_nio/channels/DatagramChannel/DatagramChannel.html#NetworkChannel[bindRepeatedly_test]
The rest is copied from exclude request JCK-7300127:
--- start of quote ----
In JavaSE7 (jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java)
public DatagramChannel bind(SocketAddress local) throws IOException {
.....
InetSocketAddress isa;
if (local == null) {
isa = new InetSocketAddress(0); <= this will create IPv6 socket
} else {
isa = Net.checkAddress(local);
// only Inet4Address allowed with IPv4 socket
if (family == StandardProtocolFamily.INET) {
InetAddress addr = isa.getAddress();
if (!(addr instanceof Inet4Address))
throw new UnsupportedAddressTypeException();
}
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkListen(isa.getPort());
}
Net.bind(family, fd, isa.getAddress(), isa.getPort()); <= family is INET(IPv4)
localAddress = Net.localAddress(fd);
}
}
So they execute in IPv4 mode (family=INET) *AND* java.net.preferIPv6Addresses is TRUE,
then InetSoketAddress(0) constructor creates IPv6 address.
Later it tries to bind with IPv6 address on IPv4 mode.
---- end of quote ----
- duplicates
-
JDK-7161881 (dc) DatagramChannel.bind(null) fails if IPv4 socket and running with preferIPv6Addresses=true
-
- Closed
-
-
JDK-7161881 (dc) DatagramChannel.bind(null) fails if IPv4 socket and running with preferIPv6Addresses=true
-
- Closed
-