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

Remove split tunnel interface if split tunneling is disabled #6666

Merged

Conversation

MarkusPettersson98
Copy link
Contributor

@MarkusPettersson98 MarkusPettersson98 commented Aug 23, 2024

In the current split tunnel design, the split tunnel interface is never destroyed once it has been created. This PR removes the split tunnel interface when split tunneling is disabled, since any potential issues with split tunneling should not affect anyone who disables the feature.


This change is Reviewable

@MarkusPettersson98 MarkusPettersson98 added the macOS Issues related to macOS label Aug 23, 2024
Copy link

linear bot commented Aug 23, 2024

Copy link
Member

@dlon dlon 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, 2 unresolved discussions (waiting on @MarkusPettersson98)


talpid-core/src/split_tunnel/macos/mod.rs line 435 at r1 (raw file):

                vpn_interface,
            } if paths.is_empty() => {
                drop(tun_handle);

We should shut these down gracefully rather than just drop them. See Self::shutdown(). That could probably be called here.


talpid-core/src/split_tunnel/macos/mod.rs line 512 at r1 (raw file):

                match tun_handle
                    .set_interfaces(default_interface, Some(vpn_interface.clone()))

vpn_interface is shadowed by the old/existing value here.

@MarkusPettersson98 MarkusPettersson98 force-pushed the remove-split-tunnel-utun-when-disabled-des-1130 branch 2 times, most recently from 6912bd6 to 8b5a877 Compare August 23, 2024 14:00
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, 2 unresolved discussions (waiting on @dlon)


talpid-core/src/split_tunnel/macos/mod.rs line 435 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

We should shut these down gracefully rather than just drop them. See Self::shutdown(). That could probably be called here.

Done


talpid-core/src/split_tunnel/macos/mod.rs line 512 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

vpn_interface is shadowed by the old/existing value here.

Done

Copy link
Member

@dlon dlon 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

Copy link
Member

@dlon dlon 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: all files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)


talpid-core/src/split_tunnel/macos/mod.rs line 505 at r2 (raw file):

                                process,
                                tun_handle,
                                vpn_interface,

Previously, the state wasn't altered when failing, but now it seems to receive the new VPN interface. It could probably become out of sync with tun, so might be best to keep the old behavior.

@MarkusPettersson98 MarkusPettersson98 force-pushed the remove-split-tunnel-utun-when-disabled-des-1130 branch from 8b5a877 to 998ca2f Compare August 27, 2024 06:24
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 @dlon)


talpid-core/src/split_tunnel/macos/mod.rs line 505 at r2 (raw file):

Previously, dlon (David Lönnhager) wrote…

Previously, the state wasn't altered when failing, but now it seems to receive the new VPN interface. It could probably become out of sync with tun, so might be best to keep the old behavior.

Ah yes, that's a fair point. Reverted that change, so now the old VPN interface is kept upon failure.

Copy link
Member

@dlon dlon 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 r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@MarkusPettersson98 MarkusPettersson98 force-pushed the remove-split-tunnel-utun-when-disabled-des-1130 branch 3 times, most recently from 279c7d4 to 166e257 Compare August 27, 2024 08:25
@MarkusPettersson98 MarkusPettersson98 force-pushed the remove-split-tunnel-utun-when-disabled-des-1130 branch from 166e257 to 6b97a6f Compare August 27, 2024 08:56
@MarkusPettersson98 MarkusPettersson98 merged commit f530d3b into main Aug 27, 2024
51 checks passed
@MarkusPettersson98 MarkusPettersson98 deleted the remove-split-tunnel-utun-when-disabled-des-1130 branch August 27, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS Issues related to macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants