summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-01-28 20:09:36 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-02-10 15:40:37 +0000
commite25d41b688f0d89b024ad51943eb611d9e15a3c0 (patch)
tree3f70ce992ebe634499864f12830cb7b50ce5eb75
parentbe0a46fd6919c032dc908421ba18d3f2a2b499c7 (diff)
downloadmullvadvpn-e25d41b688f0d89b024ad51943eb611d9e15a3c0.tar.xz
mullvadvpn-e25d41b688f0d89b024ad51943eb611d9e15a3c0.zip
Implement `MullvadDaemon.setAllowLan` method
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt5
-rw-r--r--mullvad-jni/src/lib.rs22
2 files changed, 27 insertions, 0 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt
index 8e8806cc70..e61567a0fe 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt
@@ -81,6 +81,10 @@ class MullvadDaemon(val vpnService: MullvadVpnService) {
setAccount(daemonInterfaceAddress, accountToken)
}
+ fun setAllowLan(allowLan: Boolean) {
+ setAllowLan(daemonInterfaceAddress, allowLan)
+ }
+
fun shutdown() {
shutdown(daemonInterfaceAddress)
}
@@ -112,6 +116,7 @@ class MullvadDaemon(val vpnService: MullvadVpnService) {
private external fun getVersionInfo(daemonInterfaceAddress: Long): AppVersionInfo?
private external fun getWireguardKey(daemonInterfaceAddress: Long): PublicKey?
private external fun setAccount(daemonInterfaceAddress: Long, accountToken: String?)
+ private external fun setAllowLan(daemonInterfaceAddress: Long, allowLan: Boolean)
private external fun shutdown(daemonInterfaceAddress: Long)
private external fun updateRelaySettings(
daemonInterfaceAddress: Long,
diff --git a/mullvad-jni/src/lib.rs b/mullvad-jni/src/lib.rs
index 89528da8c6..7e6dd7f99f 100644
--- a/mullvad-jni/src/lib.rs
+++ b/mullvad-jni/src/lib.rs
@@ -650,6 +650,28 @@ pub extern "system" fn Java_net_mullvad_mullvadvpn_service_MullvadDaemon_setAcco
#[no_mangle]
#[allow(non_snake_case)]
+pub extern "system" fn Java_net_mullvad_mullvadvpn_service_MullvadDaemon_setAllowLan(
+ env: JNIEnv<'_>,
+ _: JObject<'_>,
+ daemon_interface_address: jlong,
+ allow_lan: jboolean,
+) {
+ let env = JnixEnv::from(env);
+
+ if let Some(daemon_interface) = get_daemon_interface(daemon_interface_address) {
+ let allow_lan = bool::from_java(&env, allow_lan);
+
+ if let Err(error) = daemon_interface.set_allow_lan(allow_lan) {
+ log::error!(
+ "{}",
+ error.display_chain_with_msg("Failed to set allow LAN")
+ );
+ }
+ }
+}
+
+#[no_mangle]
+#[allow(non_snake_case)]
pub extern "system" fn Java_net_mullvad_mullvadvpn_service_MullvadDaemon_shutdown(
_: JNIEnv<'_>,
_: JObject<'_>,