summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-01-09 15:55:25 +0100
committerArne Schwabe <arne@rfc2549.org>2015-01-09 15:55:25 +0100
commit3c7cb13eca715b932af8479914f3db6a2df0bd50 (patch)
treeab37fa8b898c4b63d73c0430e65ff22e5adf9ecb
parent3b11c7515a7cd7eb59bf961df47b558bc9834227 (diff)
Ignore multicast routes when adding routes, at least Lollipop does not like them.
--HG-- extra : source : 7601bdd8dce43eb44d6b2ad8fda03f8539fc50e0
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java5
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java8
-rwxr-xr-xmain/src/main/res/values/strings.xml1
3 files changed, 11 insertions, 3 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
index 701909d1..705d737b 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
@@ -172,8 +172,9 @@ public class NetworkSpace {
}
public boolean containsNet(ipAddress network) {
- return getFirstAddress().compareTo(network.getFirstAddress()) != 1 &&
- getLastAddress().compareTo(network.getLastAddress()) != -1;
+ // this.first >= net.first && this.last <= net.last
+ return getFirstAddress().compareTo(network.getFirstAddress()) != -1 &&
+ getLastAddress().compareTo(network.getLastAddress()) != 1;
}
}
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index 66b1f72d..41306db8 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -551,9 +551,15 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
Collection<ipAddress> positiveIPv4Routes = mRoutes.getPositiveIPList();
Collection<ipAddress> positiveIPv6Routes = mRoutesv6.getPositiveIPList();
+ ipAddress multicastRange = new ipAddress(new CIDRIP("224.0.0.0", 3), true);
+
for (NetworkSpace.ipAddress route : positiveIPv4Routes) {
try {
- builder.addRoute(route.getIPv4Address(), route.networkMask);
+
+ if (multicastRange.containsNet(route))
+ VpnStatus.logDebug(R.string.ignore_multicast_route, route.toString());
+ else
+ builder.addRoute(route.getIPv4Address(), route.networkMask);
} catch (IllegalArgumentException ia) {
VpnStatus.logError(getString(R.string.route_rejected) + route + " " + ia.getLocalizedMessage());
}
diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml
index 9c0a1823..c565b1ea 100755
--- a/main/src/main/res/values/strings.xml
+++ b/main/src/main/res/values/strings.xml
@@ -350,5 +350,6 @@
<string name="show_log">Show log</string>
<string name="faq_android_clients">Multiple OpenVPN clients for Android exist. The most common ones are OpenVPN for Android (this client), OpenVPN Connect and OpenVPN Settings.&lt;p&gt;The clients can be grouped into two groups: OpenVPN for Android and OpenVPN Connect use the official VPNService API (Android 4.0+) and require no root and OpenVPN Settings which uses root.&lt;p&gt;OpenVPN for Android is an open source client and developed by Arne Schwabe. It is targeted at more advanced users and offers many settings and the ability to import profiles from files and to configure/change profiles inside the app. The client is based on the community version of OpenVPN. It is based on the OpenVPN 2.x source code. This client can be seen as the semi officially client of the community. &lt;p&gt;OpenVPN Connect is non open source client that is developed by OpenVPN Technologies, Inc. The client is indented to be general use client and moree targeted at the average user and allows the import of OpenVPN profiles. This client is based on the OpenVPN C++ reimplementation of the OpenVPN protocol (This was required to allow OpenVPN Technologies, Inc to publish an iOS OpenVPN app). This client is the official client of the OpenVPN technologies &lt;p&gt; OpenVPN Settings is the oldest of the clients and also a UI for the open source OpenVPN. In contrast to OpenVPN for Android it requires root and does not use the VPNService API. It does not depend on Android 4.0+</string>
<string name="faq_androids_clients_title">Differences between the OpenVPN Android clients</string>
+ <string name="ignore_multicast_route">Ignoring multicast route: %s</string>
</resources>