Skip to content

Commit

Permalink
Merge branch 'macos-add-split-tunnel-error-info'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed May 29, 2024
2 parents 2b04fed + 6289b4c commit 596286d
Show file tree
Hide file tree
Showing 12 changed files with 218 additions and 57 deletions.
4 changes: 4 additions & 0 deletions gui/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,10 @@ msgctxt "notifications"
msgid "Disconnected and unsecure"
msgstr ""

msgctxt "notifications"
msgid "Failed to enable split tunneling. Please try again or disable it."
msgstr ""

msgctxt "notifications"
msgid "Lockdown mode active, connection blocked"
msgstr ""
Expand Down
6 changes: 6 additions & 0 deletions gui/src/main/daemon-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,12 @@ function convertFromTunnelStateError(state: grpcTypes.ErrorState.AsObject): Erro
...baseError,
cause: ErrorStateCause.splitTunnelError,
};
case grpcTypes.ErrorState.Cause.NEED_FULL_DISK_PERMISSIONS:
// TODO: handle correctly
return {
...baseError,
cause: ErrorStateCause.splitTunnelError,
};
case grpcTypes.ErrorState.Cause.VPN_PERMISSION_DENIED:
// VPN_PERMISSION_DENIED is only ever created on Android
throw invalidErrorStateCause;
Expand Down
17 changes: 13 additions & 4 deletions gui/src/shared/notifications/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,18 @@ function getMessage(errorState: ErrorState): string {
'Your device is offline. The tunnel will automatically connect once your device is back online.',
);
case ErrorStateCause.splitTunnelError:
return messages.pgettext(
'notifications',
'Unable to communicate with Mullvad kernel driver. Try reconnecting or send a problem report.',
);
switch (process.platform ?? window.env.platform) {
case 'darwin':
return messages.pgettext(
'notifications',
'Failed to enable split tunneling. Please try again or disable it.',
);
default:
return messages.pgettext(
'notifications',
'Unable to communicate with Mullvad kernel driver. Try reconnecting or send a problem report.',
);
}
}
}
}
Expand Down Expand Up @@ -265,6 +273,7 @@ function getActions(errorState: ErrorState): InAppNotificationAction | void {
},
};
} else if (errorState.cause === ErrorStateCause.splitTunnelError) {
// TODO: macos: handle this and full disk access error
return {
type: 'troubleshoot-dialog',
troubleshoot: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ message ErrorState {
IS_OFFLINE = 7;
VPN_PERMISSION_DENIED = 8;
SPLIT_TUNNEL_ERROR = 9;
NEED_FULL_DISK_PERMISSIONS = 10;
}

enum AuthFailedError {
Expand Down
10 changes: 9 additions & 1 deletion mullvad-management-interface/src/types/conversions/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ impl From<mullvad_types::states::TunnelState> for proto::TunnelState {
talpid_tunnel::ErrorStateCause::SplitTunnelError => {
i32::from(Cause::SplitTunnelError)
}
#[cfg(target_os = "macos")]
talpid_tunnel::ErrorStateCause::NeedFullDiskPermissions => {
i32::from(Cause::NeedFullDiskPermissions)
}
},
blocking_error: error_state.block_failure().map(map_firewall_error),
auth_failed_error: mullvad_types::auth_failed::AuthFailed::try_from(
Expand Down Expand Up @@ -325,10 +329,14 @@ impl TryFrom<proto::TunnelState> for mullvad_types::states::TunnelState {
Ok(proto::error_state::Cause::VpnPermissionDenied) => {
talpid_tunnel::ErrorStateCause::VpnPermissionDenied
}
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_os = "macos"))]
Ok(proto::error_state::Cause::SplitTunnelError) => {
talpid_tunnel::ErrorStateCause::SplitTunnelError
}
#[cfg(target_os = "macos")]
Ok(proto::error_state::Cause::NeedFullDiskPermissions) => {
talpid_tunnel::ErrorStateCause::NeedFullDiskPermissions
}
_ => {
return Err(FromProtobufTypeError::InvalidArgument(
"invalid error cause",
Expand Down
Loading

0 comments on commit 596286d

Please sign in to comment.