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

Fix ending up in blocked state when disabling split tunnel #7473

Conversation

MarkusPettersson98
Copy link
Contributor

@MarkusPettersson98 MarkusPettersson98 commented Jan 16, 2025

Fix daemon ending up in blocked state if the user toggled split tunneling without having granted Full Disk Access to mullvad-daemon. This could only ever be accomplished from the CLI.


This change is Reviewable

@MarkusPettersson98 MarkusPettersson98 added macOS Issues related to macOS Daemon Issues related to mullvad-daemon labels Jan 16, 2025
@MarkusPettersson98 MarkusPettersson98 marked this pull request as draft January 17, 2025 09:08
@MarkusPettersson98 MarkusPettersson98 force-pushed the connection-still-in-blocked-state-after-disabling-split-des-1567 branch from b250bfc to 1f0f75c Compare January 17, 2025 09:17
@MarkusPettersson98 MarkusPettersson98 marked this pull request as ready for review January 17, 2025 09:18
@MarkusPettersson98 MarkusPettersson98 force-pushed the connection-still-in-blocked-state-after-disabling-split-des-1567 branch from 1f0f75c to fd88c42 Compare January 17, 2025 09:22
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)


mullvad-daemon/src/lib.rs line 1558 at r1 (raw file):

                if cfg!(target_os = "macos") {
                    let split_tunnel_will_be_disabled = !state;
                    if split_tunnel_was_enabled && split_tunnel_will_be_disabled {

My understanding is that if you enable split tunneling without full disk access (via the CLI), you end up in the error state, not the blocked state. If so, could we add a check for being in the error state to this if-statement? That should make it less likely to trigger unnecessarily.

@MarkusPettersson98 MarkusPettersson98 force-pushed the connection-still-in-blocked-state-after-disabling-split-des-1567 branch from fd88c42 to 7266523 Compare January 20, 2025 14:52
Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @Serock3)


mullvad-daemon/src/lib.rs line 1558 at r1 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

My understanding is that if you enable split tunneling without full disk access (via the CLI), you end up in the error state, not the blocked state. If so, could we add a check for being in the error state to this if-statement? That should make it less likely to trigger unnecessarily.

That makes sense! Good catch:)

Serock3
Serock3 previously approved these changes Jan 20, 2025
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


mullvad-daemon/src/lib.rs line 1550 at r2 (raw file):

                    .await
                    .map_err(Error::SettingsError);
                // If Full Disk Access (FDA) is disabled, we may want to reconnect after disabling

Nit 🙈 Maybe this could be worded in a way that make it a little more clear how you would end up the error state in the first place, before you try to disable full disk access?

E.g. "On macOS, if split tunneling is enabled without Full Disk Access then the user will enter the error state. This is only possible using either using the CLI or by disabling FDA after activating split tunneling. In these cases, we want to reconnect if split tunneling is disabled."

Or something. I'll leave it up to you if you want to change the text.

@MarkusPettersson98 MarkusPettersson98 force-pushed the connection-still-in-blocked-state-after-disabling-split-des-1567 branch from 7266523 to cf1b79d Compare January 21, 2025 15:28
Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 3 files reviewed, all discussions resolved (waiting on @Serock3)


mullvad-daemon/src/lib.rs line 1550 at r2 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

Nit 🙈 Maybe this could be worded in a way that make it a little more clear how you would end up the error state in the first place, before you try to disable full disk access?

E.g. "On macOS, if split tunneling is enabled without Full Disk Access then the user will enter the error state. This is only possible using either using the CLI or by disabling FDA after activating split tunneling. In these cases, we want to reconnect if split tunneling is disabled."

Or something. I'll leave it up to you if you want to change the text.

Nice suggestion, done:)

Serock3
Serock3 previously approved these changes Jan 22, 2025
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! :lgtm: but make sure to test it if you haven't already

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Collaborator

@olmoh olmoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 3 files at r1, 1 of 1 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@MarkusPettersson98 MarkusPettersson98 force-pushed the connection-still-in-blocked-state-after-disabling-split-des-1567 branch from d4b9ef0 to d4f9ee5 Compare January 22, 2025 12:54
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@MarkusPettersson98 MarkusPettersson98 merged commit 0072998 into main Jan 22, 2025
60 checks passed
@MarkusPettersson98 MarkusPettersson98 deleted the connection-still-in-blocked-state-after-disabling-split-des-1567 branch January 22, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Daemon Issues related to mullvad-daemon macOS Issues related to macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants