client(install): bail if WireGuard interface with same name exists

Closes #113
pull/127/head
Jake McGinty 2021-08-02 23:06:13 +09:00
parent 40e8ca68f9
commit 61b055c44b
1 changed files with 4 additions and 1 deletions

View File

@ -284,7 +284,10 @@ fn install(
let target_conf = CLIENT_CONFIG_DIR.join(&iface).with_extension("conf");
if target_conf.exists() {
bail!("An interface with this name already exists in innernet.");
bail!("An existing innernet network with the name \"{}\" already exists.", iface);
}
if Device::list(network.backend)?.iter().any(|name| name.as_str_lossy() == iface) {
bail!("An existing WireGuard interface with the name \"{}\" already exists.", iface);
}
let iface = iface.parse()?;