8233847: (sctp) Flx link-local IPv6 scope handling and test cleanup

Reviewed-by: alanb
This commit is contained in:
Chris Hegarty 2019-11-21 12:14:29 +00:00
parent 180ffe5e45
commit 76e5a32c52
13 changed files with 84 additions and 71 deletions

View file

@ -29,7 +29,7 @@ package com.sun.nio.sctp;
*
* <P> The {@code HandlerResult} is used to determine the behavior of the
* channel after it handles a notification from the SCTP stack. Essentially its
* value determines if the channel should try to receive another notificaiton or
* value determines if the channel should try to receive another notification or
* a message before returning.
*
* @since 1.7

View file

@ -53,6 +53,7 @@ import com.sun.nio.sctp.MessageInfo;
import com.sun.nio.sctp.NotificationHandler;
import com.sun.nio.sctp.SctpChannel;
import com.sun.nio.sctp.SctpSocketOption;
import sun.net.util.IPAddressUtil;
import sun.nio.ch.DirectBuffer;
import sun.nio.ch.IOStatus;
import sun.nio.ch.IOUtil;
@ -1012,6 +1013,9 @@ public class SctpChannelImpl extends SctpChannel
if (target != null) {
InetSocketAddress isa = Net.checkAddress(target);
addr = isa.getAddress();
if (addr.isLinkLocalAddress()) {
addr = IPAddressUtil.toScopedAddress(addr);
}
port = isa.getPort();
}

View file

@ -53,6 +53,7 @@ import com.sun.nio.sctp.MessageInfo;
import com.sun.nio.sctp.SctpChannel;
import com.sun.nio.sctp.SctpMultiChannel;
import com.sun.nio.sctp.SctpSocketOption;
import sun.net.util.IPAddressUtil;
import sun.nio.ch.DirectBuffer;
import sun.nio.ch.NativeThread;
import sun.nio.ch.IOStatus;
@ -892,6 +893,9 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
if (target != null) {
InetSocketAddress isa = Net.checkAddress(target);
addr = isa.getAddress();
if (addr.isLinkLocalAddress()) {
addr = IPAddressUtil.toScopedAddress(addr);
}
port = isa.getPort();
}
int pos = bb.position();

View file

@ -34,6 +34,7 @@ import java.util.Set;
import java.util.HashSet;
import java.security.AccessController;
import java.security.PrivilegedAction;
import sun.net.util.IPAddressUtil;
import sun.nio.ch.IOUtil;
import sun.nio.ch.Net;
import com.sun.nio.sctp.SctpSocketOption;
@ -169,9 +170,13 @@ public class SctpNet {
InetSocketAddress netAddr = (InetSocketAddress)addr;
if (name.equals(SCTP_PRIMARY_ADDR)) {
InetAddress inetAddress = netAddr.getAddress();
if (inetAddress.isLinkLocalAddress()) {
inetAddress = IPAddressUtil.toScopedAddress(inetAddress);
}
setPrimAddrOption0(fd,
assocId,
netAddr.getAddress(),
inetAddress,
netAddr.getPort());
} else {
setPeerPrimAddrOption0(fd,