android: Ignore IllegalArgumentException for multicast addresses
Some Android versions seem to reject routes that use multicast addresses. Fixes #2420.
This commit is contained in:
+21
@@ -933,9 +933,20 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
|
||||
}
|
||||
ranges.remove(mExcludedSubnets);
|
||||
for (IPRange subnet : ranges.subnets())
|
||||
{
|
||||
try
|
||||
{
|
||||
builder.addRoute(subnet.getFrom(), subnet.getPrefix());
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{ /* some Android versions don't seem to like multicast addresses here,
|
||||
* ignore it for now */
|
||||
if (!subnet.getFrom().isMulticastAddress())
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
{ /* allow traffic that would otherwise be blocked to bypass the VPN */
|
||||
@@ -963,9 +974,19 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
|
||||
}
|
||||
ranges.remove(mExcludedSubnets);
|
||||
for (IPRange subnet : ranges.subnets())
|
||||
{
|
||||
try
|
||||
{
|
||||
builder.addRoute(subnet.getFrom(), subnet.getPrefix());
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
if (!subnet.getFrom().isMulticastAddress())
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user