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 split tunneling packet loss #6640

Merged
merged 8 commits into from
Aug 20, 2024
Merged

Fix split tunneling packet loss #6640

merged 8 commits into from
Aug 20, 2024

Conversation

dlon
Copy link
Member

@dlon dlon commented Aug 19, 2024

Fixes the following error:

Failed to forward to tun device: Message too long (os error 40)

There were a couple of issues:

  • The MTU of the ST utun was potentially higher than that of the VPN tunnel. We now keep track of and sync the MTUs.
  • Outbound packets weren't correctly filtered. Capture::direction seems to handle it correctly but doesn't work on macOS 13. Instead, we must discard packets with the wrong source IP.

Close DES-1115.


This change is Reviewable

Copy link

linear bot commented Aug 19, 2024

@dlon dlon changed the title Fix "message too long" error Fix split tunneling packet loss Aug 19, 2024
@dlon dlon marked this pull request as ready for review August 19, 2024 13:02
Copy link
Contributor

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

Reviewed 15 of 16 files at r1, all commit messages.
Reviewable status: 15 of 16 files reviewed, 3 unresolved discussions (waiting on @dlon)


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

        if details.mtu == current_mtu {
            return;
        }

What sort of condition is this? And why would the mtu_updater completely return instead of continuing to listen for new mtu updates? 😊

Code quote:

        if details.mtu == current_mtu {
            return;
        }

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

            log::error!("Failed to set MTU of {st_iface_name} to {mtu}: {error}");
            return;
        }

The return-statement seems excessive here - I assume it's a left over from before you refactored this piece of code into a function 😊

Code quote:

        Err(error) => {
            log::error!("Failed to set MTU of {st_iface_name} to {mtu}: {error}");
            return;
        }

talpid-net/src/unix.rs line 0 at r1 (raw file):
So much unsafe here without SAFETY sections :( Would you mind adding that? 😊

@dlon dlon force-pushed the macos-st-fix-message-too-long branch from b658fb7 to 8fbb73f Compare August 20, 2024 07:41
Copy link
Member Author

@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 16 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 14 of 16 files reviewed, 3 unresolved discussions (waiting on @dlon and @MarkusPettersson98)


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

Previously, MarkusPettersson98 (Markus Pettersson) wrote…

What sort of condition is this? And why would the mtu_updater completely return instead of continuing to listen for new mtu updates? 😊

Done. Nice catch!


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

Previously, MarkusPettersson98 (Markus Pettersson) wrote…

The return-statement seems excessive here - I assume it's a left over from before you refactored this piece of code into a function 😊

Done. Nice catch!


talpid-net/src/unix.rs line at r1 (raw file):

Previously, MarkusPettersson98 (Markus Pettersson) wrote…

So much unsafe here without SAFETY sections :( Would you mind adding that? 😊

Done.

@dlon dlon force-pushed the macos-st-fix-message-too-long branch from bf2e1b7 to 54c8c8d Compare August 20, 2024 08:29
Copy link
Contributor

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

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

@dlon dlon force-pushed the macos-st-fix-message-too-long branch 2 times, most recently from 74314bb to f04a4eb Compare August 20, 2024 09:37
Copy link
Contributor

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

:lgtm:

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

@dlon dlon force-pushed the macos-st-fix-message-too-long branch from ab894a7 to 5e51656 Compare August 20, 2024 10:03
@dlon dlon merged commit 71cd682 into main Aug 20, 2024
53 checks passed
@dlon dlon deleted the macos-st-fix-message-too-long branch August 20, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants