diff options
| author | Emīls <emils@mullvad.net> | 2019-12-04 18:59:20 +0000 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2019-12-09 11:23:07 +0000 |
| commit | 1cb24689fcfada6d17d1b6c722b97077c685a890 (patch) | |
| tree | 50b30143f921731e9ad3e1ed11baef3dbe6e473c /mullvad-cli/src | |
| parent | 709df311b8965df262d4d54185bbd66a79ab1b35 (diff) | |
| download | mullvadvpn-1cb24689fcfada6d17d1b6c722b97077c685a890.tar.xz mullvadvpn-1cb24689fcfada6d17d1b6c722b97077c685a890.zip | |
Update CLI to yell at user if the error state doesn't block traffic
Diffstat (limited to 'mullvad-cli/src')
| -rw-r--r-- | mullvad-cli/src/cmds/status.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/mullvad-cli/src/cmds/status.rs b/mullvad-cli/src/cmds/status.rs index bd68ae64ae..10834b60b3 100644 --- a/mullvad-cli/src/cmds/status.rs +++ b/mullvad-cli/src/cmds/status.rs @@ -2,7 +2,7 @@ use crate::{new_rpc_client, Command, Error, Result}; use futures::{Future, Stream}; use mullvad_ipc_client::DaemonRpcClient; use mullvad_types::{auth_failed::AuthFailed, states::TunnelState, DaemonEvent}; -use talpid_types::tunnel::BlockReason; +use talpid_types::tunnel::{ErrorState, ErrorStateCause}; pub struct Status; @@ -91,7 +91,7 @@ fn print_state(state: &TunnelState) { use self::TunnelState::*; print!("Tunnel status: "); match state { - Blocked(reason) => print_blocked_reason(reason), + Error(reason) => print_error_state(reason), Connected { endpoint, .. } => { println!("Connected to {}", endpoint); } @@ -101,9 +101,18 @@ fn print_state(state: &TunnelState) { } } -fn print_blocked_reason(reason: &BlockReason) { +fn print_error_state(error_state: &ErrorState) { + if !error_state.is_blocking() { + eprintln!("Mullvad daemon failed to setup firewall rules!"); + eprintln!("Deamon cannot block traffic from flowing, non-local traffic will leak"); + } + + print_blocked_reason(error_state.cause()); +} + +fn print_blocked_reason(reason: &ErrorStateCause) { match reason { - BlockReason::AuthFailed(ref auth_failure) => { + ErrorStateCause::AuthFailed(ref auth_failure) => { let auth_failure_str = auth_failure .as_ref() .map(|s| s.as_str()) @@ -111,8 +120,8 @@ fn print_blocked_reason(reason: &BlockReason) { println!("Blocked: {}", AuthFailed::from(auth_failure_str)); } #[cfg(target_os = "linux")] - BlockReason::SetFirewallPolicyError => { - println!("Blocked: {}", BlockReason::SetFirewallPolicyError); + ErrorStateCause::SetFirewallPolicyError => { + println!("Blocked: {}", ErrorStateCause::SetFirewallPolicyError); println!("Your kernel might be terribly out of date or missing nftables"); } other => println!("Blocked: {}", other), |
