diff --git a/src/org/ice4j/StackProperties.java b/src/org/ice4j/StackProperties.java index ef8d88b..a7b5c94 100644 --- a/src/org/ice4j/StackProperties.java +++ b/src/org/ice4j/StackProperties.java @@ -161,6 +161,13 @@ public class StackProperties public static final String ALLOWED_ADDRESSES = "org.ice4j.ice.harvest.ALLOWED_ADDRESSES"; + /** + * The name of the property which, if set to true, specifies that IPv6 + * link local addresses should not be used for candidate allocations. + */ + public static final String DISABLE_LINK_LOCAL_ADDRESSES + = "org.ice4j.ice.harvest.DISABLE_LINK_LOCAL_ADDRESSES"; + /** * The name of the property which specifies a ";"-separated list of IP * addresses that are not allowed to be used for host candidate allocations. diff --git a/src/org/ice4j/ice/harvest/HostCandidateHarvester.java b/src/org/ice4j/ice/harvest/HostCandidateHarvester.java index 88708e6..40a8cba 100644 --- a/src/org/ice4j/ice/harvest/HostCandidateHarvester.java +++ b/src/org/ice4j/ice/harvest/HostCandidateHarvester.java @@ -141,6 +141,10 @@ public class HostCandidateHarvester StackProperties.DISABLE_IPv6, false); + boolean isIPv6LinkLocalDisabled = StackProperties.getBoolean( + StackProperties.DISABLE_LINK_LOCAL_ADDRESSES, + false); + if(transport != Transport.UDP && transport != Transport.TCP) { throw new IllegalArgumentException( @@ -172,6 +176,13 @@ public class HostCandidateHarvester continue; } + if (isIPv6LinkLocalDisabled + && (addr instanceof Inet6Address) + && addr.isLinkLocalAddress()) + { + continue; + } + if((addr instanceof Inet4Address) || !isIPv6Disabled) { IceSocketWrapper sock = null; diff --git a/src/org/ice4j/ice/harvest/MultiplexingTcpHostHarvester.java b/src/org/ice4j/ice/harvest/MultiplexingTcpHostHarvester.java index 2c4f9e8..a81822a 100644 --- a/src/org/ice4j/ice/harvest/MultiplexingTcpHostHarvester.java +++ b/src/org/ice4j/ice/harvest/MultiplexingTcpHostHarvester.java @@ -289,6 +289,10 @@ public class MultiplexingTcpHostHarvester StackProperties.DISABLE_IPv6, false); + boolean useIPv6LinkLocal = !StackProperties.getBoolean( + StackProperties.DISABLE_LINK_LOCAL_ADDRESSES, + false); + // White list from the configuration String[] allowedAddressesStr = StackProperties.getStringArray(StackProperties.ALLOWED_ADDRESSES, @@ -332,6 +336,15 @@ public class MultiplexingTcpHostHarvester if (!useIPv6 && (address instanceof Inet6Address)) continue; + if (!useIPv6LinkLocal + && (address instanceof Inet6Address) + && address.isLinkLocalAddress()) + { + logger.info("Not using link-local address " + address +" for" + + " TCP candidates."); + continue; + } + if (allowedAddresses != null) { boolean found = false;