Skip to content

Commit

Permalink
Merge pull request #90 from jamesmcm/newissues
Browse files Browse the repository at this point in the history
Fix NetworkManager config path edge case
  • Loading branch information
jamesmcm authored May 31, 2021
2 parents 515e6ca + 4e67504 commit 46775dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "vopono"
description = "Launch applications via VPN tunnels using temporary network namespaces"
version = "0.8.0"
version = "0.8.1"
authors = ["James McMurray <jamesmcm03@gmail.com>"]
edition = "2018"
license = "GPL-3.0-or-later"
Expand All @@ -20,7 +20,7 @@ pretty_env_logger = "0.4"
clap = "2"
which = "4"
users = "0.11"
nix = "0.20"
nix = "0.21"
serde = {version = "1", features = ["derive", "std"]}
csv = "1"
dialoguer ="0.8"
Expand All @@ -34,7 +34,7 @@ chrono = "0.4"
compound_duration = "1"
ipnet = {version = "2", features = ["serde"]}
reqwest = {default-features = false, version = "0.11", features = ["blocking", "json", "rustls-tls"]}
sysinfo = "0.17"
sysinfo = "0.18"
base64 = "0.13"
x25519-dalek = "1"
strum = "0.20"
Expand Down
12 changes: 11 additions & 1 deletion src/veth_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ impl VethPair {
&dest
);
let mut nm_config_path = nm_path.clone();
nm_config_path.push("conf.d/unmanaged.conf");
nm_config_path.push("conf.d");
std::fs::create_dir_all(&nm_config_path)?;
nm_config_path.push("unmanaged.conf");

let backup_file = if nm_config_path.exists() {
// Backup existing unmanaged.conf
Expand All @@ -50,8 +52,16 @@ impl VethPair {

{
let mut file = if nm_config_path.exists() {
debug!(
"Appending to existing NetworkManager config file: {}",
nm_config_path.as_path().to_string_lossy()
);
OpenOptions::new().append(true).open(nm_config_path)?
} else {
debug!(
"Creating new NetworkManager config file: {}",
nm_config_path.as_path().to_string_lossy()
);
std::fs::File::create(nm_config_path)?
};

Expand Down

0 comments on commit 46775dd

Please sign in to comment.