summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-01-30 20:04:04 +0100
committerArne Schwabe <arne@rfc2549.org>2014-01-30 20:04:04 +0100
commit440632b32e002470a5b5258e42843764da9aa893 (patch)
tree2abc347e3312b070d1e61f736f14db66f2aaafb6
parent64abb3edff9c6791fac3c621ef014916a4033875 (diff)
Fix p2p topology
--HG-- extra : rebase_source : cdabc9ff910c471f6fb8e7980877aec1cb05b12d
-rw-r--r--src/de/blinkt/openvpn/core/OpenVpnService.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/de/blinkt/openvpn/core/OpenVpnService.java b/src/de/blinkt/openvpn/core/OpenVpnService.java
index e485ee73..49f315a3 100644
--- a/src/de/blinkt/openvpn/core/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/core/OpenVpnService.java
@@ -62,6 +62,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
private boolean mOvpn3 = false;
private OpenVPNManagement mManagement;
private String mLastTunCfg;
+ private String mRemoteGW;
// From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
public static String humanReadableByteCount(long bytes, boolean mbit) {
@@ -531,7 +532,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
}
- public void addRoute(String dest, String mask, String gateway, String device) {
+ public void addRoute (String dest, String mask, String gateway, String device) {
CIDRIP route = new CIDRIP(dest, mask);
boolean include = isAndroidTunDevice(device);
@@ -539,7 +540,11 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
NetworkSpace.ipAddress localNet = new NetworkSpace.ipAddress(mLocalIP,true);
if (localNet.containsNet(gatewayIP))
- include =true;
+ include=true;
+
+ if (gateway!= null &&
+ (gateway.equals("255.255.255.255") || gateway.equals(mRemoteGW)))
+ include=true;
if (route.len == 32 && !mask.equals("255.255.255.255")) {
@@ -599,6 +604,12 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
VpnStatus.logWarning(R.string.ip_not_cidr, local, netmask, mode);
}
}
+
+ if ("p2p".equals(mode))
+ mRemoteGW=netmask;
+ else
+ mRemoteGW=null;
+
}
public void setLocalIPv6(String ipv6addr) {