summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@blinkt.de>2012-06-27 23:00:32 +0200
committerArne Schwabe <arne@blinkt.de>2012-06-27 23:00:32 +0200
commit5428376e0d14bd128c2bdc5b50ab95c85321a517 (patch)
treebd1b710c30e8869d01fe2945a4a3d8c633a9fa7d
parent60441995beec38b931c82e36bf1bb14aad640a95 (diff)
log phone version
support more than 100 routes
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/de/blinkt/openvpn/ConfigParser.java1
-rw-r--r--src/de/blinkt/openvpn/OpenVPN.java27
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java18
4 files changed, 38 insertions, 9 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2f827fe5..64b8e28b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -219,5 +219,6 @@
<string name="show_log_window">Show log window</string>
<string name="keppstatus_summary">Keep the notification displayed after the connection is established to show traffic statistics.</string>
<string name="keepstatus">Show Traffic Statistics</string>
+ <string name="mobile_info">Running on %1$s (%2$s) %3$s, Android API %4$d</string>
</resources>
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<LogItem> logbuffer;
+
+ private static Vector<LogListener> logListener;
+ private static Vector<StateListener> stateListener;
+ private static String[] mBconfig;
+
+ static {
+ logbuffer = new LinkedList<LogItem>();
+ logListener = new Vector<OpenVPN.LogListener>();
+ stateListener = new Vector<OpenVPN.StateListener>();
+ 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<LogItem> logbuffer = new LinkedList<LogItem>();
-
- private static Vector<LogListener> logListener=new Vector<OpenVPN.LogListener>();
- private static Vector<StateListener> stateListener=new Vector<OpenVPN.StateListener>();
- 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";