Repository navigation
refactor(protocols)!: range-check the transport makers and adopt the shared helpers (#2614) - #2670
Merged
Merged
Conversation
…shared helpers (#2614) BREAKING CHANGE: the released TCP, UDP and SCTP makers stop wrapping. A value an integer field cannot hold raises ProtocolError naming the field, where it was written as its low bits (TCP(window=70000) packed 0x1170, seq_no=-1 packed 0xffffffff), and a fixed-size octet field of the wrong size raises where it was padded or cut. - TCP, UDP, DCCP and SCTP make() and their option, chunk, parameter and cause makers check each integer field with _make_uint, bar the two below, and each fixed-size octet field with _make_octets; a UDP Length and an SCTP chunk, parameter or cause length past 16 bits, given or computed, raises. - TCP _make_mode_timeout keeps its 15-bit-minutes limit and also refuses, by name, a timeout that is negative, a bool, or neither an int nor a timedelta, where a bare ValueError or AttributeError came out or True packed 1 second. - The Quick-Start TTL Diff keeps wrapping: RFC 4782 defines it modulo 256. - TCP _make_tcp_options, DCCP _make_dccp_options and SCTP _padding_width pad with pad_length; DCCP _make_opt_ndp_count sizes its count with _uint_size. - New test_transport_maker_range_2614_unit; the MPTCP unknown-subtype case in test_tcp_udp_unit gives a first data octet that fits its four bits.
Owner
Author
|
GOOD TO GO at |
JarryShaw
added a commit
that referenced
this pull request
Nov 2, 2026
…he cut-frame fixes and GRE's bindings into 1.6.0 (#2449) - Breaking: TCP, UDP and SCTP makers (#2670) and PCAP-NG's (#2671) raise on a value a field cannot hold, where 1.5.x wrote it masked; each entry gives the old and new values. The TTL Diff wraps as before. - Changed: __index__ returns the LinkType, EtherType, TransType or AppType value, ports as ints (#2652); only Create Release waits for a deployment approval (#2658). The conventions entry records the index rule. - Fixed: a cut HTTP/2 SETTINGS frame parses and rebuilds; HTTPv2.make takes frame_length (#2666). - Folded into unreleased entries: FRAD at LinkType 107 and GRE at IP protocol 47 (#2667); cut IGMPv3 messages and num_group_records (#2662, #2672); Linux_ARPHRD (#2663); DCCP's range checks (#2670); a cut GRE frame is TRUNCATED, replacing fold-12's INVALID note, and frame_length in pcapkit.utilities.contextvars (#2668). - No entry for _make_sint's private allow_unsigned, ARP's private PAT_MAC_ADDR, or the test- and docs-only d728873, 326a6cf, fc80fb1, a37edf1 and 2766707. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
1 of 5 tasks
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 pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
refactor— changes neither behaviour nor performanceDescription of your pull request and other information
The transport group of #2614: TCP, UDP, DCCP and SCTP take the shared value helpers on
Protocol.ProtocolErrornaming the field. Measured onmain,TCP(window=70000)packed0x1170andseq_no=-1packed0xffffffff. A fixed-size octet field of the wrong size raises too, where it used to be padded or cut.boolor non-numeric timeout by name.pad_length, and DCCP's NDP Count is sized with_uint_size.Parsed output is byte-identical to
mainacross every generated capture, and every TCP, UDP, SCTP and DCCP layer rebuilds exactly. A Sonnet cross-review ran over two rounds: the first found the User Timeout leak, and the second asked for the TTL Diff pin. Both are fixed in this head.Part of #2614; the internet and PCAP-NG/ARP groups follow in their own PRs.