fix packet encoding/decoding which seems to break after 2 billions packets sent#1743
fix packet encoding/decoding which seems to break after 2 billions packets sent#1743ghedo merged 3 commits intocloudflare:masterfrom
Conversation
f6577ec to
e9fb607
Compare
| // computes ceil of num_unacked.log2() | ||
| let min_bits = u64::BITS - num_unacked.leading_zeros(); | ||
| // get the num len in bytes | ||
| Ok((min_bits as f32 / 8.).ceil() as usize) |
There was a problem hiding this comment.
Ok((num_bits + 7) / 8 as usize) should be faster.
There was a problem hiding this comment.
Looks right! Good catch. The Result is not useful anymore either, and I removed it.
|
@frochet contributions are generally welcome (and btw, thank you very much for this PR!), but review might take some time due to reviewers (mostly me and Lucas) being busy or not available (or in other cases we might forget unfortunately :/). However, "quality of life" can be subjective :) so it might be better to discuss things a bit in advance just to avoid you doing a bunch of work that might not get merged. Do you happen to be on the quicdev Slack channel? We have a room for quiche there which might be easier for this kind of communication than sending emails or creating a bunch of issues on GitHub. If you are not on there yet, it should be relatively easy to join, see https://github.com/quicwg/base-drafts/blob/main/CONTRIBUTING.md#following-discussion Speaking of this PR, could you rebae it please? Looks like it might need some changes due to some refactoring in the recovery code that landed in the meantime. |
|
@frochet also, specifically about recvmmsg() support, @evanrittenhouse has been pulling all that UDP socket logic into its own crate #1764 so that is probably a better place to look into for that change. |
caaeb39 to
986dcfb
Compare
|
I've asked for a quicdev slack invite. Thank you for the guidance :-) Rebase done! It looks like some changes in Master addressed the first two questions in the first post as well, so great! |
|
Merged, thanks @frochet! And sorry it took so long 😞 |
|
And also thanks @vanc for the review and suggestions! |
Hello,
Long story short, I've been using the encoding/decoding logic of packet number for another purpose than encoding pn, and observed that it would start decoding incorrect values when reaching 2^31.
I dived into RFC9000, on the Appendix for the algorithmic details of encoding/decoding, and observed that the encoding algorithm in quiche does not match the encoding algorithm suggested by the RFC. I suppose there is a reason for this, but it eludes me.
So, this pull request does an implementation close to what is suggested (hopefully more efficient), and fixes my problem, and the bug with packet numbers too. I've also added test cases for packet encoding/decoding using example values from the RFC.
This passes all unit tests, and a simple integration test in which I downloaded a 5 GiB file through the H3 module using quiche-[client/server]. However, I am unsure about: