0
0
mirror of https://github.com/schwabe/ics-openvpn.git synced 2024-09-20 12:02:28 +02:00
Fix backtrace from market console, I suspect someone tried IPv6 and I failed him/her :(
This commit is contained in:
Arne Schwabe 2012-05-11 01:17:01 +02:00
parent bfb51aa744
commit 0291c75669
8 changed files with 24 additions and 54 deletions

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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