Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block OpenVPN relays from being selected on android #5574

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Line wrap the file at 100 chars. Th
#### Linux
- Prevent fragmentation when multihop is enabled by setting a default route MTU.

#### Android
- Fix issue with the app under some circumstances trying to connect to OpenVPN relays.

## [2023.6] - 2023-12-06
### Changed
Expand Down
11 changes: 11 additions & 0 deletions mullvad-relay-selector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ impl RelaySelector {

/// Returns a random relay and relay endpoint matching the given constraints and with
/// preferences applied.
#[cfg_attr(target_os = "android", allow(unused_variables))]
fn get_tunnel_endpoint(
&self,
relay_constraints: &RelayConstraints,
Expand All @@ -339,6 +340,12 @@ impl RelaySelector {
default_tunnel_type: TunnelType,
custom_lists: &CustomListsSettings,
) -> Result<NormalSelectedRelay, Error> {
#[cfg(target_os = "android")]
{
self.get_wireguard_endpoint(relay_constraints, retry_attempt, custom_lists)
}

#[cfg(not(target_os = "android"))]
match relay_constraints.tunnel_protocol {
Constraint::Only(TunnelType::OpenVpn) => self.get_openvpn_endpoint(
relay_constraints,
Expand Down Expand Up @@ -402,6 +409,7 @@ impl RelaySelector {

/// Returns an OpenVpn endpoint, should only ever be used when the user has specified the tunnel
/// protocol as only OpenVPN.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn get_openvpn_endpoint(
&self,
relay_constraints: &RelayConstraints,
Expand Down Expand Up @@ -585,6 +593,7 @@ impl RelaySelector {
}

/// Like [Self::get_tunnel_endpoint_internal] but also selects an entry endpoint if applicable.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn get_multihop_tunnel_endpoint_internal(
&self,
relay_constraints: &RelayConstraints,
Expand Down Expand Up @@ -674,6 +683,7 @@ impl RelaySelector {

/// Returns a tunnel endpoint of any type, should only be used when the user hasn't specified a
/// tunnel protocol.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn get_any_tunnel_endpoint(
&self,
relay_constraints: &RelayConstraints,
Expand Down Expand Up @@ -719,6 +729,7 @@ impl RelaySelector {
}

// This function ignores the tunnel type constraint on purpose.
#[cfg_attr(target_os = "android", allow(dead_code))]
fn preferred_constraints(
&self,
original_constraints: &RelayConstraints,
Expand Down
Loading