summaryrefslogtreecommitdiff
path: root/app/src/ovpn3/java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-02-01 15:30:39 +0100
committercyBerta <cyberta@riseup.net>2018-02-01 15:30:39 +0100
commitc89fd2f73f8a84f9ef7742e39476a9645e6d3863 (patch)
treea005140c9ea36b01f2e6c99ddd9969e3ee9307cf /app/src/ovpn3/java
parent5964502a4bbcc790c70ba312f40946a8c2ae0203 (diff)
#8832 add all ics-openvpn code changes
Diffstat (limited to 'app/src/ovpn3/java')
-rw-r--r--app/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/app/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/app/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
index 850983a9..8896cd5d 100644
--- a/app/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
+++ b/app/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
@@ -63,16 +63,17 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
if(!setConfig(configstr))
return;
setUserPW();
+ VpnStatus.logInfo(platform());
VpnStatus.logInfo(copyright());
- StatusPoller statuspoller = new StatusPoller(5000);
+ StatusPoller statuspoller = new StatusPoller(OpenVPNManagement.mBytecountInterval*1000);
new Thread(statuspoller,"Status Poller").start();
ClientAPI_Status status = connect();
if(status.getError()) {
VpnStatus.logError(String.format("connect() error: %s: %s",status.getStatus(),status.getMessage()));
} else {
- VpnStatus.logInfo("OpenVPN3 thread finished");
+ VpnStatus.logDebug("OpenVPN3 thread finished");
}
statuspoller.stop();
}
@@ -103,7 +104,7 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
if(ipv6)
mService.addRoutev6(address + "/" + prefix_length,"tun");
else
- mService.addRoute(new CIDRIP(address, prefix_length));
+ mService.addRoute(new CIDRIP(address, prefix_length), true);
return true;
}
@@ -112,8 +113,8 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
if(ipv6)
mService.addRoutev6(address + "/" + prefix_length, "wifi0");
else {
- //TODO
- mService.addRoute(address, String.valueOf(prefix_length), "1.2.3.4" , "wifi0");
+ CIDRIP route = new CIDRIP(address, prefix_length);
+ mService.addRoute(route, false);
}
return true;
}
@@ -133,7 +134,7 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
@Override
public boolean tun_builder_set_session_name(String name) {
- VpnStatus.logInfo("We should call this session" + name);
+ VpnStatus.logDebug("We should call this session" + name);
return true;
}
@@ -164,7 +165,12 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
@Override
public boolean tun_builder_reroute_gw(boolean ipv4, boolean ipv6, long flags) {
- //ignore
+ if (ipv4)
+ mService.addRoute("0.0.0.0", "0.0.0.0", "127.0.0.1", OpenVPNService.VPNSERVICE_TUN);
+
+ if (ipv6)
+ mService.addRoutev6("::/0", OpenVPNService.VPNSERVICE_TUN);
+
return true;
}
@@ -179,11 +185,12 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
config.setContent(vpnconfig);
config.setTunPersist(mVp.mPersistTun);
config.setGuiVersion(mVp.getVersionEnvString(mService));
+ //config.setPlatformVersion(mVp.getPlatformVersionEnvString());
config.setExternalPkiAlias("extpki");
ClientAPI_EvalConfig ec = eval_config(config);
if(ec.getExternalPki()) {
- VpnStatus.logError("OpenVPN seem to think as external PKI");
+ VpnStatus.logDebug("OpenVPN3 core assumes an external PKI config");
}
if (ec.getError()) {
VpnStatus.logError("OpenVPN config file parse error: " + ec.getMessage());
@@ -196,7 +203,7 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
@Override
public void external_pki_cert_request(ClientAPI_ExternalPKICertRequest certreq) {
- VpnStatus.logError("EXT PKI CERT");
+ VpnStatus.logDebug("Got external PKI certificate request from OpenVPN core");
String[] ks = mVp.getKeyStoreCertificates((Context) mService);
if(ks==null) {
certreq.setError(true);
@@ -215,7 +222,8 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
@Override
public void external_pki_sign_request(ClientAPI_ExternalPKISignRequest signreq) {
- signreq.setSig(mVp.getSignedData(signreq.getData()));
+ VpnStatus.logDebug("Got external PKI signing request from OpenVPN core");
+ signreq.setSig(mVp.getSignedData(signreq.getData(), false));
}
void setUserPW() {
@@ -244,12 +252,13 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
@Override
public boolean stopVPN(boolean replaceConnection) {
+ stop();
return false;
}
@Override
public void networkChange(boolean sameNetwork) {
-
+ reconnect(1);
}
@Override
@@ -288,6 +297,7 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
@Override
public void stop() {
super.stop();
+ mService.openvpnStopped();
}
@Override