summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2023-07-07 15:20:23 +0200
committerLinus Färnstrand <faern@faern.net>2023-07-07 15:20:23 +0200
commit9280aca5ac1060be8f7583bdaa5599ed2647d85b (patch)
tree145faf00aa6cadcf68149e61a378e42db0af90a3
parent08ffc38c23f02d26a0912b9cd368af8a137e17dd (diff)
parent7455706dc037898f445d262f6359a4a53c4392a0 (diff)
downloadmullvadvpn-9280aca5ac1060be8f7583bdaa5599ed2647d85b.tar.xz
mullvadvpn-9280aca5ac1060be8f7583bdaa5599ed2647d85b.zip
Merge branch 'upgrade-duct-os_pipe'
-rw-r--r--Cargo.lock15
-rw-r--r--talpid-core/Cargo.toml1
-rw-r--r--talpid-openvpn/Cargo.toml2
-rw-r--r--talpid-openvpn/src/process/openvpn.rs14
4 files changed, 16 insertions, 16 deletions
diff --git a/Cargo.lock b/Cargo.lock
index dd7dc5848f..b237808e43 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -907,9 +907,9 @@ dependencies = [
[[package]]
name = "duct"
-version = "0.13.5"
+version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fc6a0a59ed0888e0041cf708e66357b7ae1a82f1c67247e1f93b5e0818f7d8d"
+checksum = "37ae3fc31835f74c2a7ceda3aeede378b0ae2e74c8f1c36559fcc9ae2a4e7d3e"
dependencies = [
"libc",
"once_cell",
@@ -2491,12 +2491,12 @@ dependencies = [
[[package]]
name = "os_pipe"
-version = "0.9.2"
+version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb233f06c2307e1f5ce2ecad9f8121cffbbee2c95428f44ea85222e460d0d213"
+checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177"
dependencies = [
"libc",
- "winapi",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -3441,9 +3441,9 @@ dependencies = [
[[package]]
name = "shared_child"
-version = "0.3.5"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6be9f7d5565b1483af3e72975e2dee33879b3b86bd48c0929fccf6585d79e65a"
+checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef"
dependencies = [
"libc",
"winapi",
@@ -3657,7 +3657,6 @@ dependencies = [
"nftnl",
"nix 0.23.1",
"once_cell",
- "os_pipe",
"parity-tokio-ipc",
"parking_lot",
"pfctl",
diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml
index f16aa7307c..69059493e0 100644
--- a/talpid-core/Cargo.toml
+++ b/talpid-core/Cargo.toml
@@ -20,7 +20,6 @@ lazy_static = "1.0"
once_cell = "1.13"
libc = "0.2"
log = "0.4"
-os_pipe = "0.9"
parking_lot = "0.12.0"
regex = "1.1.0"
talpid-routing = { path = "../talpid-routing" }
diff --git a/talpid-openvpn/Cargo.toml b/talpid-openvpn/Cargo.toml
index dcab157677..a1d8a44645 100644
--- a/talpid-openvpn/Cargo.toml
+++ b/talpid-openvpn/Cargo.toml
@@ -18,7 +18,7 @@ futures = "0.3.15"
is-terminal = "0.4.2"
lazy_static = "1.0"
log = "0.4"
-os_pipe = "0.9"
+os_pipe = "1.1.4"
parking_lot = "0.12.0"
shell-escape = "0.1"
talpid-routing = { path = "../talpid-routing" }
diff --git a/talpid-openvpn/src/process/openvpn.rs b/talpid-openvpn/src/process/openvpn.rs
index 1ca2cb3958..722468e3ca 100644
--- a/talpid-openvpn/src/process/openvpn.rs
+++ b/talpid-openvpn/src/process/openvpn.rs
@@ -363,17 +363,20 @@ impl fmt::Display for OpenVpnCommand {
}
}
-/// Proc handle for an openvpn process
+/// Handle to a running OpenVPN process.
pub struct OpenVpnProcHandle {
/// Duct handle
pub inner: duct::Handle,
- /// Standard input handle
+ /// Pipe handle to stdin of the OpenVPN process. Our custom fork of OpenVPN
+ /// has been changed so that it exits cleanly when stdin is closed. This is a hack
+ /// solution to cleanly shut OpenVPN down without using the
+ /// management interface (which would be the correct thing to do).
pub stdin: Mutex<Option<PipeWriter>>,
}
-/// Impl for proc handle
impl OpenVpnProcHandle {
- /// Constructor for a new openvpn proc handle
+ /// Configures the expression to run OpenVPN in a way compatible with this handle
+ /// and spawns it. Returns the handle.
pub fn new(mut cmd: duct::Expression) -> io::Result<Self> {
use is_terminal::IsTerminal;
@@ -396,10 +399,9 @@ impl OpenVpnProcHandle {
}
impl StoppableProcess for OpenVpnProcHandle {
- /// Closes STDIN to stop the openvpn process
fn stop(&self) {
// Dropping our stdin handle so that it is closed once. Closing the handle should
- // gracefully stop our openvpn child process.
+ // gracefully stop our OpenVPN child process.
if self.stdin.lock().take().is_none() {
log::warn!("Tried to close OpenVPN stdin handle twice, this is a bug");
}