summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-18 14:11:37 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-18 14:11:37 +0200
commit40eb17c3c472bf088568abe7082427f1ab891399 (patch)
treef1433083ca238930bf3b8167d6c38a7a3cacb2ec /src/de/blinkt/openvpn/OpenVpnService.java
parentf743921f5812cd7f6c6b681382d60508ed02a4a9 (diff)
Allow only one log window at a time (closes issue #26)
Make OpenvpnService honour net30 routes (closes issue #24)
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index 8f846e32..e2f7ba12 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -248,7 +248,9 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
// Let the configure Button show the Log
Intent intent = new Intent(getBaseContext(),LogWindow.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
PendingIntent startLW = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
+ intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
builder.setConfigureIntent(startLW);
try {
ParcelFileDescriptor pfd = builder.establish();
@@ -309,16 +311,31 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
}
- public void setLocalIP(String local, String netmask,int mtu) {
+ public void setLocalIP(String local, String netmask,int mtu, String mode) {
mLocalIP = new CIDRIP(local, netmask);
mMtu = mtu;
if(mLocalIP.len == 32 && !netmask.equals("255.255.255.255")) {
- OpenVPN.logMessage(0, "", String.format(getString(R.string.ip_not_cidr, local,netmask)));
+ // get the netmask as IP
+ long netint = CIDRIP.getInt(netmask);
+ if(Math.abs(netint - mLocalIP.getInt()) ==1) {
+ if(mode.equals("net30"))
+ mLocalIP.len=30;
+ else
+ mLocalIP.len=31;
+ } else {
+ OpenVPN.logMessage(0, "", String.format(getString(R.string.ip_not_cidr, local,netmask,mode)));
+ }
}
}
+
+
+
+
+
+
public void setLocalIPv6(String ipv6addr) {
mLocalIPv6 = ipv6addr;
}