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

Ignore parse errors from pinger when its socket is closed #6953

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

buggmagnet
Copy link
Contributor

@buggmagnet buggmagnet commented Oct 9, 2024

This PR fixes a race condition where we would get parse error from the pinger due to pending reads when closing its socket.

The fix is to look at whether the destAddress is still valid (i.e. socket is still open) before sending the parsing error.


This change is Reviewable

@buggmagnet buggmagnet added the iOS Issues related to iOS label Oct 9, 2024
@buggmagnet buggmagnet self-assigned this Oct 9, 2024
Copy link

linear bot commented Oct 9, 2024

rablador
rablador previously approved these changes Oct 10, 2024
Copy link
Contributor

@rablador rablador 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 r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @buggmagnet)


ios/PacketTunnelCore/Pinger/TunnelPinger.swift line 21 at r1 (raw file):

    private let replyQueue: DispatchQueue
    private var destAddress: IPv4Address?
    // Always accessed from the `replyQueue` and is assigned once, on the main thread of the PacketTunnel. It is thread safe.

Nit: Make this comment a doc instead, with a - Note to hightlight this info.

Copy link
Contributor Author

@buggmagnet buggmagnet 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: 0 of 1 files reviewed, all discussions resolved (waiting on @rablador)


ios/PacketTunnelCore/Pinger/TunnelPinger.swift line 21 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…

Nit: Make this comment a doc instead, with a - Note to hightlight this info.

Done

Copy link
Contributor

@rablador rablador 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
Collaborator

@mojganii mojganii left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@rablador rablador 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: :shipit: complete! all files reviewed, all discussions resolved

@buggmagnet buggmagnet force-pushed the fix-race-condition-in-tunnelpinger-ios-865 branch from c6dc95d to 67dfd8d Compare October 11, 2024 10:32
@buggmagnet buggmagnet merged commit 4fdeaa1 into main Oct 11, 2024
11 checks passed
@buggmagnet buggmagnet deleted the fix-race-condition-in-tunnelpinger-ios-865 branch October 11, 2024 10:35
Copy link

🚨 End to end tests failed. Please check the failed workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Issues related to iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants