summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/LaunchVPN.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-07-17 20:17:19 +0200
committerArne Schwabe <arne@rfc2549.org>2012-07-17 20:17:19 +0200
commitf622fbfbf3a6f8985f681c268c64d07e7dcd3eb7 (patch)
treeed870475bbbcb01a50330485ea505a63302d6cd5 /src/de/blinkt/openvpn/LaunchVPN.java
parent2097538559ca82d4c2336da63a5e45e10ca53af0 (diff)
Implementier modprobe tun for more braindead images
Diffstat (limited to 'src/de/blinkt/openvpn/LaunchVPN.java')
-rw-r--r--src/de/blinkt/openvpn/LaunchVPN.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java
index b057a392..7b1c6cce 100644
--- a/src/de/blinkt/openvpn/LaunchVPN.java
+++ b/src/de/blinkt/openvpn/LaunchVPN.java
@@ -350,21 +350,14 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
// Check if we want to fix /dev/tun
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean usecm9fix = prefs.getBoolean("useCM9Fix", false);
+ boolean loadTunModule = prefs.getBoolean("loadTunModule", false);
if(usecm9fix && !mCmfixed ) {
- ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c","chown system /dev/tun"});
- try {
- Process p = pb.start();
- int ret = p.waitFor();
- if(ret ==0)
- mCmfixed=true;
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
+ execeuteSUcmd("chown system /dev/tun");
}
+ if(loadTunModule)
+ execeuteSUcmd("modprobe tun");
if (intent != null) {
@@ -383,6 +376,20 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
}
+ private void execeuteSUcmd(String command) {
+ ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c",command});
+ try {
+ Process p = pb.start();
+ int ret = p.waitFor();
+ if(ret ==0)
+ mCmfixed=true;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
private class startOpenVpnThread extends Thread {
@Override