summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-11 01:17:01 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-11 01:17:01 +0200
commit82940714ebe944e63ed70c745e1abe950673fe5b (patch)
tree8dfcf9627b5db22ffdf3ebe37d7c0529f0fb6fe9
parent480535d1de23e30780b3ae5a166cdc59a22a2adc (diff)
CLeanups
Fix backtrace from market console, I suspect someone tried IPv6 and I failed him/her :(
-rw-r--r--AndroidManifest.xml5
-rw-r--r--res/values/strings.xml3
-rw-r--r--src/de/blinkt/openvpn/MainActivity.java2
-rw-r--r--src/de/blinkt/openvpn/OpenVPN.java33
-rw-r--r--src/de/blinkt/openvpn/OpenVPNThread.java6
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java18
-rw-r--r--src/de/blinkt/openvpn/Settings_Authentication.java3
-rw-r--r--todo.txt8
8 files changed, 24 insertions, 54 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 61c5f585..8943334a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,8 +17,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.blinkt.openvpn"
- android:versionCode="23"
- android:versionName="0.5.2" >
+ android:versionCode="24"
+ android:versionName="0.5.3" >
<uses-permission android:name="android.permission.INTERNET" />
@@ -29,7 +29,6 @@
<application
android:icon="@drawable/icon"
android:label="@string/app" >
- <activity android:name=".FileSelectionFragment" />
<activity android:name=".AboutFragment" />
<activity android:name=".VPNPreferences" />
<activity
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2b7c82f0..5d605e08 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -194,5 +194,6 @@
<string name="import_file">Import</string>
<string name="error_importing_file">Error importing File</string>
<string name="import_error_message">Could not import File from Filesystem</string>
- <string name="inline_file_data">[[Inline file data]]</string>
+ <string name="inline_file_data">[[Inline file data]]</string>
+ <string name="opentun_no_ipaddr">Refusing to open tun device without IP information</string>
</resources>
diff --git a/src/de/blinkt/openvpn/MainActivity.java b/src/de/blinkt/openvpn/MainActivity.java
index 86c1d73f..d9169284 100644
--- a/src/de/blinkt/openvpn/MainActivity.java
+++ b/src/de/blinkt/openvpn/MainActivity.java
@@ -10,8 +10,6 @@ public class MainActivity extends PreferenceActivity {
@Override
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.main_headers, target);
- //debug
- OpenVPN.foo();
}
@Override
diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java
index 71df887f..24281d13 100644
--- a/src/de/blinkt/openvpn/OpenVPN.java
+++ b/src/de/blinkt/openvpn/OpenVPN.java
@@ -4,15 +4,11 @@ import java.util.LinkedList;
import java.util.Vector;
public class OpenVPN {
- private static OpenVpnService mOpenVpnService;
- private static final int MAXLOGENTRIES = 500;
- //public static native int startOpenVPNThreadArgs(String argv[]);
- private static final String TAG = "OpenVpn";
+ private static final int MAXLOGENTRIES = 200;
public static LinkedList<String> logbuffer = new LinkedList<String>();
- private static int counter=0;
-
+
private static Vector<LogListener> logListener=new Vector<OpenVPN.LogListener>();
private static String[] mBconfig;
@@ -20,27 +16,13 @@ public class OpenVPN {
void newLog(String logmessage);
}
- /*
- static {
- System.loadLibrary("crypto");
- System.loadLibrary("ssl");
- System.loadLibrary("lzo");
- System.loadLibrary("openvpn");
- }*/
synchronized static void logMessage(int level,String prefix, String message)
{
logbuffer.addLast(prefix + message);
if(logbuffer.size()>MAXLOGENTRIES)
logbuffer.removeFirst();
-
- // The garbage collector does not collect the String from native
- // but kills me for logging 100 messages with too many references :(
- // Force GC how and then to kill loose ends
- if(counter++ % 50==0) {
- //System.gc();
- }
-
+
for (LogListener ll : logListener) {
ll.newLog(prefix + message);
}
@@ -60,15 +42,6 @@ public class OpenVPN {
}
-
-
- public static void setCallback(OpenVpnService openVpnService) {
- mOpenVpnService = openVpnService;
- }
-
- //! Dummy method being called to force loading of JNI Libraries
- public static void foo() { }
-
synchronized public static String[] getlogbuffer() {
// The stoned way of java to return an array from a vector
diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java
index a24abb8b..ce332677 100644
--- a/src/de/blinkt/openvpn/OpenVPNThread.java
+++ b/src/de/blinkt/openvpn/OpenVPNThread.java
@@ -27,11 +27,7 @@ public class OpenVPNThread implements Runnable {
@Override
public void run() {
try {
- Log.i(TAG, "Starting o");
-
-
- OpenVPN.setCallback(mService);
-
+ Log.i(TAG, "Starting openvpn");
// We try to create the tunnel for several times. The better way
// is to work with ConnectivityManager, such as trying only when
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index 9030d29a..ad20737b 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -45,7 +45,7 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
private Vector<CIDRIP> mRoutes=new Vector<CIDRIP>();
- private CIDRIP mLocalIP;
+ private CIDRIP mLocalIP=null;
private OpenVpnManagementThread mSocketManager;
@@ -253,7 +253,12 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
public ParcelFileDescriptor openTun() {
Builder builder = new Builder();
-
+
+ if(mLocalIP==null) {
+ OpenVPN.logMessage(0, "", getString(R.string.opentun_no_ipaddr));
+ return null;
+ }
+
builder.addAddress(mLocalIP.mIp, mLocalIP.len);
for (String dns : mDnslist ) {
@@ -282,15 +287,16 @@ public class OpenVpnService extends VpnService implements Handler.Callback {
bconfig[3] = String.format(getString(R.string.dns_domain_info, mDomain));
bconfig[4] = String.format(getString(R.string.routes_info, joinString(mRoutes)));
+ builder.setSession(mProfile.mName + " - " + mLocalIP);
+
OpenVPN.logBuilderConfig(bconfig);
+ // Reset information
mDnslist.clear();
mRoutes.clear();
-
-
- builder.setSession(mProfile.mName + " - " + mLocalIP);
-
+ mLocalIP=null;
+
// Let the configure Button show the Log
Intent intent = new Intent(getBaseContext(),LogWindow.class);
PendingIntent startLW = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
diff --git a/src/de/blinkt/openvpn/Settings_Authentication.java b/src/de/blinkt/openvpn/Settings_Authentication.java
index 003a26dd..5849923d 100644
--- a/src/de/blinkt/openvpn/Settings_Authentication.java
+++ b/src/de/blinkt/openvpn/Settings_Authentication.java
@@ -106,7 +106,7 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre
return true;
}
void startFileDialog() {
- Intent startFC = new Intent(getActivity(),FileSelectionFragment.class);
+ Intent startFC = new Intent(getActivity(),FileSelect.class);
startFC.putExtra(FileSelect.START_DATA, "/sdcard");
startActivityForResult(startFC,SELECT_TLS_FILE);
@@ -130,6 +130,7 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre
}
private void setTlsAuthSummary(String result) {
+ if(result==null) result = getString(R.string.no_certificate);
if(result.startsWith(FileSelect.INLINE_TAG))
mTLSAuthFile.setSummary(R.string.inline_file_data);
else
diff --git a/todo.txt b/todo.txt
index 49fc9a8b..fc604ce2 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,9 +1,4 @@
Ideas:
-
-- Implement tabbed filebrowser with
- 1. tab file selection
- 2. tab inline file for safer storage
-
- implement security notice fragment
- explain plain text storage of all data except for android keystore
- explain even more insecure of storage on sd card
@@ -38,8 +33,9 @@ Tap support:
- need to chose right mac of receiver
Requested by users:
-cipher
+keepalive 10 120
auth
mtu-link
nobind
+