Adds an property to disable the use of IPv6 link local addresses for candidate allocation.
This commit is contained in:
parent
707d258084
commit
9eca04ecad
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user