From 22714a5fd15e3250ce0297045985a2267777c692 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 21 Jun 2012 11:03:29 +0200 Subject: Organize Imports --- src/de/blinkt/openvpn/OpenVpnService.java | 4 +--- src/de/blinkt/openvpn/Settings_Basic.java | 2 -- src/de/blinkt/openvpn/VpnProfile.java | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'src/de') diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index fd0b4f2a..765f0f53 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -19,10 +19,7 @@ package de.blinkt.openvpn; import java.io.IOException; import java.util.Vector; -import de.blinkt.openvpn.OpenVPN.StateListener; - import android.app.Notification; -import android.app.Notification.Builder; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; @@ -35,6 +32,7 @@ import android.net.LocalSocketAddress; import android.net.VpnService; import android.os.ParcelFileDescriptor; import android.preference.PreferenceManager; +import de.blinkt.openvpn.OpenVPN.StateListener; public class OpenVpnService extends VpnService implements StateListener { private Thread mServiceThread; diff --git a/src/de/blinkt/openvpn/Settings_Basic.java b/src/de/blinkt/openvpn/Settings_Basic.java index 1b82b579..0bf3078a 100644 --- a/src/de/blinkt/openvpn/Settings_Basic.java +++ b/src/de/blinkt/openvpn/Settings_Basic.java @@ -39,8 +39,6 @@ import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.ToggleButton; - - import de.blinkt.openvpn.R.id; public class Settings_Basic extends Fragment implements View.OnClickListener, OnItemSelectedListener, Callback { diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 7ca75723..f482b173 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -28,7 +28,6 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.security.KeyChain; import android.security.KeyChainException; -import android.util.Log; public class VpnProfile implements Serializable{ // Parcable -- cgit v1.2.3 From 2b6c6b1cd53a4ae7c463f299d6114e17e8e1e4aa Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Fri, 22 Jun 2012 11:14:09 +0200 Subject: Fix openvpn error when no netmask is specified to a custom IP --- src/de/blinkt/openvpn/VpnProfile.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/de') diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index f482b173..d679cd00 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -385,9 +385,9 @@ public class VpnProfile implements Serializable{ private String cidrToIPAndNetmask(String route) { String[] parts = route.split("/"); - // No /xx, return verbatim + // No /xx, assume /32 as netmask if (parts.length ==1) - return route; + parts = (route + "/32").split("/"); if (parts.length!=2) return null; @@ -480,7 +480,6 @@ public class VpnProfile implements Serializable{ cachain = KeyChain.getCertificateChain(context, mAlias); if(cachain.length <= 1 && !nonNull(mCaFilename)) OpenVPN.logMessage(0, "", context.getString(R.string.keychain_nocacert)); - for(X509Certificate cert:cachain) { OpenVPN.logInfo(R.string.cert_from_keystore,cert.getSubjectDN()); -- cgit v1.2.3 From 60441995beec38b931c82e36bf1bb14aad640a95 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 25 Jun 2012 12:15:45 +0200 Subject: More obscure options to be ignored --- src/de/blinkt/openvpn/ConfigParser.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/de') diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java index ea7d60e8..7089b5a6 100644 --- a/src/de/blinkt/openvpn/ConfigParser.java +++ b/src/de/blinkt/openvpn/ConfigParser.java @@ -216,16 +216,21 @@ public class ConfigParser { "ipchange", "route-up", "auth-user-pass-verify", - "route-gateway", - "topology", + "dhcp-release", + "dhcp-renew", + "management-hold", + "management", + "management-query-passwords", + "pause-exit", "persist-tun", "persist-key", + "register-dns", + "route-gateway", "route-metric", + "show-net-up", "suppress-timestamps", - "management-query-passwords", "tmp-dir", - "management-hold", - "management" + "topology", }; -- cgit v1.2.3 From 5428376e0d14bd128c2bdc5b50ab95c85321a517 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 27 Jun 2012 23:00:32 +0200 Subject: log phone version support more than 100 routes --- src/de/blinkt/openvpn/ConfigParser.java | 1 + src/de/blinkt/openvpn/OpenVPN.java | 27 +++++++++++++++++++++------ src/de/blinkt/openvpn/VpnProfile.java | 18 +++++++++++++++--- 3 files changed, 37 insertions(+), 9 deletions(-) (limited to 'src/de') diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java index 7089b5a6..913fda24 100644 --- a/src/de/blinkt/openvpn/ConfigParser.java +++ b/src/de/blinkt/openvpn/ConfigParser.java @@ -227,6 +227,7 @@ public class ConfigParser { "register-dns", "route-gateway", "route-metric", + "route-method", "show-net-up", "suppress-timestamps", "tmp-dir", diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java index c23ee56d..64ecf17c 100644 --- a/src/de/blinkt/openvpn/OpenVPN.java +++ b/src/de/blinkt/openvpn/OpenVPN.java @@ -4,9 +4,24 @@ import java.util.LinkedList; import java.util.Vector; import android.content.Context; +import android.os.Build; public class OpenVPN { + + public static LinkedList logbuffer; + + private static Vector logListener; + private static Vector stateListener; + private static String[] mBconfig; + + static { + logbuffer = new LinkedList(); + logListener = new Vector(); + stateListener = new Vector(); + logInformation(); + } + static class LogItem { public static final int ERROR = 1; public static final int INFO = 2; @@ -68,11 +83,6 @@ public class OpenVPN { - public static LinkedList logbuffer = new LinkedList(); - - private static Vector logListener=new Vector(); - private static Vector stateListener=new Vector(); - private static String[] mBconfig; public interface LogListener { void newLog(LogItem logItem); @@ -90,6 +100,12 @@ public class OpenVPN { synchronized static void clearLog() { logbuffer.clear(); + logInformation(); + } + + private static void logInformation() { + + logInfo(R.string.mobile_info,Build.MODEL, Build.BOARD,Build.BRAND,Build.VERSION.SDK_INT); } synchronized static void addLogListener(LogListener ll){ @@ -110,7 +126,6 @@ public class OpenVPN { } - synchronized public static LogItem[] getlogbuffer() { // The stoned way of java to return an array from a vector diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index d679cd00..dd729a06 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -261,11 +261,14 @@ public class VpnProfile implements Serializable{ if(mUsePull && mRoutenopull) cfg += "route-nopull\n"; + String routes = ""; + int numroutes=0; if(mUseDefaultRoute) - cfg += "route 0.0.0.0 0.0.0.0\n"; + routes += "route 0.0.0.0 0.0.0.0\n"; else for(String route:getCustomRoutes()) { - cfg += "route " + route + "\n"; + routes += "route " + route + "\n"; + numroutes++; } @@ -273,9 +276,18 @@ public class VpnProfile implements Serializable{ cfg += "route-ipv6 ::/0\n"; else for(String route:getCustomRoutesv6()) { - cfg += "route-ipv6 " + route + "\n"; + routes += "route-ipv6 " + route + "\n"; + numroutes++; } + // Round number to next 100 + if(numroutes> 90) { + numroutes = ((numroutes / 100)+1) * 100; + cfg+="# Alot of routes are set, increase max-routes\n"; + cfg+="max-routes " + numroutes + "\n"; + } + cfg+=routes; + if(mOverrideDNS || !mUsePull) { if(nonNull(mDNS1)) cfg+="dhcp-option DNS " + mDNS1 + "\n"; -- cgit v1.2.3