Repository navigation
fix(tcp): keep Quick-Start rate an int and a Fast Open cookie request bytes (#2167) - #2185
Merged
Merged
Conversation
… bytes (#2167) Problem: the Quick-Start readers in TCP, IPv4, HOPOPT and IPv6-Opts computed the rate with true division, so 80 kbps parsed as 80.0 against an int annotation; a Fast Open cookie request (22 02) parsed as cookie=None against a bytes annotation, while one built with cookie=b'' read back b''. Fix: use floor division in all four (the value is always 40 * 2 ** N), read an absent cookie as b'', and reword _make_mode_qs's diff as RFC 4782's TTL Diff. Test: rate type checks for TCP and for IPv4/HOPOPT/IPv6-Opts, and a cookie request parse/construct/to_dict round trip in test_tcp_udp_unit.
Owner
Author
|
Review: GOOD TO GO at |
Owner
Author
|
Ready to merge at
|
Contributor
|
Coverage: 91.55% (unit tier, Python 3.15,
Per-file detail: the |
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectDescription
Closes #2167.
TCP._read_mode_qs,IPv4._read_opt_qs,HOPOPT._read_opt_qsandIPv6_Opts._read_opt_qsused true division, so 80 kbps parsed as80.0against anintannotation. They now use//, which is exact because the rate is always 40·2^N kbps.22 02parsed ascookie=Noneagainst abytesannotation, while one built withcookie=b''read backb''. An absent cookie now readsb'', so parse and build agree.FastOpenCookiegets aversionchangednote._make_mode_qs'sdiffis described as RFC 4782's TTL Diff.test_rate_parses_as_an_intcovers TCP, and IPv4/HOPOPT/IPv6-Opts for both functions.test_a_fast_open_cookie_request_parses_as_empty_byteschecks parse, construct fromNoneandb'', and rebuild frominfo.optionsandto_dict(), all byte-exact.cookieisb'', notNone.