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

Coalesce outgoing packets #342

Merged
merged 10 commits into from
May 18, 2019
Merged

Coalesce outgoing packets #342

merged 10 commits into from
May 18, 2019

Conversation

djc
Copy link
Collaborator

@djc djc commented May 16, 2019

Results in 3 fewer datagrams on the echo_v4 test.

Currently the server_hs_retransmit() test is still broken. @Ralith any suggestions if/how this should be fixed?

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

No obvious correctness issues on a first pass; will invetigate.

quinn-proto/src/packet.rs Outdated Show resolved Hide resolved
assert_eq!(
buf[..],
hex!("c0ff0000145006b858ec6f80452b00402100 00000000000000000000000000000000")[..]
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this check removed? It's nice to isolate encoding breakage from crypto breakage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The new API no longer exposes the steps separately, so if we still want to have this test we have to duplicate the code from PartialEncode::finish() or break that code up in smaller pieces that can be called independently. I prefer not to make the functional code "less nice" in order to appease test code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair enough.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to restore this test with an unset payload length, just to have specific coverage of the other aspects of header encoding?

quinn-proto/src/connection.rs Show resolved Hide resolved
@Ralith
Copy link
Collaborator

Ralith commented May 16, 2019

The test failure is unrelated to the correctness of this change. server_hs_retransmit attempts to test the retransmission of just the handshake portion of the server's initial flight, but with coalesced packets that no longer makes sense. I'll see if I can refactor it into something that still exercises the anti-amplification logic, at least.

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

ACK encoding currently assumes that there is always room for at least MAX_ACK_BLOCKS (which is currently probably larger than necessary) ACK blocks in a packet, because without coalesced packets this follows from the minimum MTU. With coalesced packets, we need to handle the case where that is no longer true, for example by bailing out early, or by only sending the most recent ACKs that will fit.

quinn-proto/src/connection.rs Outdated Show resolved Hide resolved
quinn-proto/src/connection.rs Show resolved Hide resolved
@djc
Copy link
Collaborator Author

djc commented May 16, 2019

There are some more issues to watch for: the spec mentions coalesced packets should follow the order of Initial, 0-RTT, Handshake, 1-RTT. As such, if the client is sending 0-RTT and Handshake packages they could be in the wrong order. For Quinn this probably doesn't matter but maybe other implementations would have trouble with it?

@Ralith
Copy link
Collaborator

Ralith commented May 16, 2019

In lieu of a strict requirement by the draft or specific knowledge of an implementation that cannot decrypt 0-RTT packets received following handshake packets, I don't think that's worth going well out of our way for. After all, implementations should hold onto 0-RTT keys for a while even after reaching 1-RTT to improve performance under packet reordering.

@djc djc force-pushed the coalesce branch 2 times, most recently from 0ee96b9 to e516df1 Compare May 16, 2019 20:09
quinn-proto/src/connection.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Nice to finally have this feature!

assert_eq!(
buf[..],
hex!("c0ff0000145006b858ec6f80452b00402100 00000000000000000000000000000000")[..]
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to restore this test with an unset payload length, just to have specific coverage of the other aspects of header encoding?

@djc
Copy link
Collaborator Author

djc commented May 18, 2019

Might make sense, but in some experiments I couldn't get it to do something that seemed useful. Want to take a swing at it?

@djc djc merged commit dee6d6a into master May 18, 2019
@delete-merged-branch delete-merged-branch bot deleted the coalesce branch May 18, 2019 20:07
@Ralith Ralith mentioned this pull request Oct 17, 2019
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.

None yet

2 participants