summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-12-01 19:00:31 +0100
committerArne Schwabe <arne@rfc2549.org>2014-12-01 19:00:31 +0100
commit97f7e247c61994ca22f7bc70980ec0b063d59e1c (patch)
treee572df3297ff81d6d4c67e0ef9d1c610c152dff9 /main/src
parentedf90cc5d3ff50d2f27de67d259aeb0759d5fdff (diff)
Fix block local LAN on non KK,LP devices
--HG-- extra : rebase_source : cdd438f410d402bffbee241e3afa12c0fc319bbe
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/AndroidManifest.xml1
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java9
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java4
3 files changed, 11 insertions, 3 deletions
diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml
index 8f478bcc..e226bdfc 100644
--- a/main/src/main/AndroidManifest.xml
+++ b/main/src/main/AndroidManifest.xml
@@ -42,7 +42,6 @@
<activity android:name=".activities.FileSelect" />
<activity
android:name=".activities.MainActivity"
- android:uiOptions="splitActionBarWhenNarrow"
tools:ignore="ExportedActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
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 fd3dee92..701909d1 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/NetworkSpace.java
@@ -21,6 +21,8 @@ import de.blinkt.openvpn.BuildConfig;
public class NetworkSpace {
+
+
static class ipAddress implements Comparable<ipAddress> {
private BigInteger netAddress;
public int networkMask;
@@ -198,6 +200,13 @@ public class NetworkSpace {
mIpAddresses.add(new ipAddress(cidrIp, include));
}
+ public void addIPSplit(CIDRIP cidrIp, boolean include) {
+ ipAddress newIP = new ipAddress(cidrIp, include);
+ ipAddress[] splitIps = newIP.split();
+ for (ipAddress split: splitIps)
+ mIpAddresses.add(split);
+ }
+
void addIPv6(Inet6Address address, int mask, boolean included) {
mIpAddresses.add(new ipAddress(address, mask, included));
}
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 29009e5c..3f16248d 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -16,7 +16,6 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
-import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.VpnService;
import android.os.Binder;
@@ -651,7 +650,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
continue;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT && !mProfile.mAllowLocalLAN) {
- mRoutes.addIP(new CIDRIP(ipAddr,netMask), true);
+ mRoutes.addIPSplit(new CIDRIP(ipAddr,netMask), true);
+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && mProfile.mAllowLocalLAN)
mRoutes.addIP(new CIDRIP(ipAddr,netMask), false);
}