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(s2n-quic-transport): fix client connection migration when local address handle changes #1874

Merged
merged 4 commits into from
Aug 11, 2023

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Jul 12, 2023

Description of changes:

There's a bit of an issue on the client with matching incoming packets to stored paths in the case of connection migration. If the local address changes, we end up rejecting the server's packet and the connection times out. You can see this issue by removing the fix and running the integration test.

The fix, instead, finds paths based on the server's address alone and then updates the local address if it has changed.

Testing:

I've included an integration test showing path migration working with this change.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@camshaft
Copy link
Contributor Author

This change breaks the interop tests. Marking as draft for now.

@camshaft camshaft marked this pull request as draft August 10, 2023 18:33
@camshaft camshaft force-pushed the camshaft/client-migration-fix branch from ea30846 to a2045a3 Compare August 10, 2023 19:36
@camshaft camshaft marked this pull request as ready for review August 10, 2023 20:09
@camshaft
Copy link
Contributor Author

Should be fixed now

@@ -250,6 +258,11 @@ impl Handle for Tuple {
self.local_address = other.local_address;
}
}

#[inline]
Copy link
Contributor

Choose a reason for hiding this comment

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

would it also work if you just changed maybe_update to something like:

fn maybe_update(&mut self, other: &Self) {
        if self.local_address.port() != other.local_address.port() {
            self.local_address = other.local_address;
        }
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah that's probably cleaner; although we should probably check that other.port() != 0, just to make sure we're not accidentally clearing information

fn eq_by_handle(&self, handle: &Config::PathHandle) -> bool {
if self.handle.local_address().port() == 0 {
if Config::ENDPOINT_TYPE.is_client() || self.handle.local_address().port() == 0 {
// Only compare the remote address if we haven't updated the local yet
Copy link
Contributor

Choose a reason for hiding this comment

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

update comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll just remove this one since it's documented as part of the function above

@camshaft camshaft force-pushed the camshaft/client-migration-fix branch from a2045a3 to b6127c2 Compare August 11, 2023 16:27
return;
}

// once we discover our path, or the port changes, update the address full address
Copy link
Contributor

Choose a reason for hiding this comment

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

I know its just copy-pasted, but update the address full address isn't making sense to me grammatically

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i should have more carefully read it 😄. i'll fix it

@camshaft camshaft force-pushed the camshaft/client-migration-fix branch from b6127c2 to cf29aed Compare August 11, 2023 18:34
@camshaft camshaft enabled auto-merge (squash) August 11, 2023 18:41
@camshaft camshaft merged commit b1b5470 into main Aug 11, 2023
129 checks passed
@camshaft camshaft deleted the camshaft/client-migration-fix branch August 11, 2023 19:05
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