summaryrefslogtreecommitdiffhomepage
path: root/talpid-core
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-09-03 16:59:11 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-09-17 10:44:20 -0300
commit0772073fe5bfb0f17a50899686eaab30d3d6459e (patch)
tree12aaf848f1cba437d411189d887b88c291a76062 /talpid-core
parent25afa242b0a3016a0458ab64f0b5260044743cb8 (diff)
downloadmullvadvpn-0772073fe5bfb0f17a50899686eaab30d3d6459e.tar.xz
mullvadvpn-0772073fe5bfb0f17a50899686eaab30d3d6459e.zip
Add authentication failure reason
Diffstat (limited to 'talpid-core')
-rw-r--r--talpid-core/src/tunnel/mod.rs7
-rw-r--r--talpid-core/src/tunnel_state_machine/connecting_state.rs4
2 files changed, 7 insertions, 4 deletions
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index a5d8c35f78..2c84f16596 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -80,7 +80,7 @@ error_chain!{
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub enum TunnelEvent {
/// Sent when the tunnel fails to connect due to an authentication error.
- AuthFailed,
+ AuthFailed(Option<String>),
/// Sent when the tunnel comes up and is ready for traffic.
Up(TunnelMetadata),
/// Sent when the tunnel goes down.
@@ -106,7 +106,10 @@ impl TunnelEvent {
env: &HashMap<String, String>,
) -> Option<TunnelEvent> {
match *event {
- OpenVpnPluginEvent::AuthFailed => Some(TunnelEvent::AuthFailed),
+ OpenVpnPluginEvent::AuthFailed => {
+ let reason = env.get("auth_failed_reason").cloned();
+ Some(TunnelEvent::AuthFailed(reason))
+ }
OpenVpnPluginEvent::Up => {
let interface = env
.get("dev")
diff --git a/talpid-core/src/tunnel_state_machine/connecting_state.rs b/talpid-core/src/tunnel_state_machine/connecting_state.rs
index c41fca0b3b..228bc0c6fd 100644
--- a/talpid-core/src/tunnel_state_machine/connecting_state.rs
+++ b/talpid-core/src/tunnel_state_machine/connecting_state.rs
@@ -246,13 +246,13 @@ impl ConnectingState {
use self::EventConsequence::*;
match try_handle_event!(self, self.tunnel_events.poll()) {
- Ok(TunnelEvent::AuthFailed) => NewState(DisconnectingState::enter(
+ Ok(TunnelEvent::AuthFailed(reason)) => NewState(DisconnectingState::enter(
shared_values,
(
self.close_handle,
self.tunnel_close_event,
AfterDisconnect::Block(
- BlockReason::AuthFailed,
+ BlockReason::AuthFailed(reason),
self.tunnel_parameters.allow_lan,
),
),