Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ignore-block-command-unsecured'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Mar 27, 2024
2 parents d867bd8 + 9e92126 commit 36a4dc3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
11 changes: 4 additions & 7 deletions talpid-core/src/tunnel_state_machine/disconnected_state.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::{
ConnectingState, ErrorState, EventConsequence, SharedTunnelStateValues, TunnelCommand,
ConnectingState, EventConsequence, SharedTunnelStateValues, TunnelCommand,
TunnelCommandReceiver, TunnelState, TunnelStateTransition,
};
#[cfg(target_os = "macos")]
use crate::dns;
use crate::firewall::FirewallPolicy;
#[cfg(target_os = "macos")]
use crate::{dns, tunnel_state_machine::ErrorState};
use futures::StreamExt;
#[cfg(target_os = "macos")]
use std::net::Ipv4Addr;
Expand Down Expand Up @@ -205,10 +205,7 @@ impl TunnelState for DisconnectedState {
SameState(self)
}
Some(TunnelCommand::Connect) => NewState(ConnectingState::enter(shared_values, 0)),
Some(TunnelCommand::Block(reason)) => {
Self::reset_dns(shared_values);
NewState(ErrorState::enter(shared_values, reason))
}
Some(TunnelCommand::Block(_reason)) => SameState(self),
#[cfg(target_os = "android")]
Some(TunnelCommand::BypassSocket(fd, done_tx)) => {
shared_values.bypass_socket(fd, done_tx);
Expand Down
5 changes: 3 additions & 2 deletions talpid-core/src/tunnel_state_machine/disconnecting_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ impl DisconnectingState {
AfterDisconnect::Nothing
}
Some(TunnelCommand::Connect) => AfterDisconnect::Reconnect(0),
Some(TunnelCommand::Disconnect) | None => AfterDisconnect::Nothing,
Some(TunnelCommand::Block(reason)) => AfterDisconnect::Block(reason),
Some(TunnelCommand::Disconnect) | Some(TunnelCommand::Block(_)) | None => {
AfterDisconnect::Nothing
}
#[cfg(target_os = "android")]
Some(TunnelCommand::BypassSocket(fd, done_tx)) => {
shared_values.bypass_socket(fd, done_tx);
Expand Down
2 changes: 1 addition & 1 deletion talpid-core/src/tunnel_state_machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub enum TunnelCommand {
Connect,
/// Close tunnel connection.
Disconnect,
/// Disconnect any open tunnel and block all network access
/// Block all network access unless tunnel is disconnecting or disconnected
Block(ErrorStateCause),
/// Bypass a socket, allowing traffic to flow through outside the tunnel.
#[cfg(target_os = "android")]
Expand Down

0 comments on commit 36a4dc3

Please sign in to comment.