Repository navigation
fix(tcp): from_data reorders and re-pads TCP options - #1163
Merged
Merged
Conversation
_make_tcp_options dropped every NOP/EOOL it was given as "padding" and then padded each option to 4 octets on its own, inserting an EOOL after any misaligned option. A parsed segment therefore rebuilt with its NOPs moved, mid-list EOOLs, and a larger data offset (a0 -> b0 on http.pcap). Options are now emitted as given, and the list is padded once at the end: zero octets after a trailing EOOL, otherwise NOPs followed by an EOOL. test_tcp_udp_unit pinned the old drop-the-NOPs behaviour and is updated. Closes #1151
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.86% (unit tier, Python 3.14,
Per-file detail: the |
JarryShaw
added a commit
that referenced
this pull request
Oct 7, 2026
- 4 new 1.5.0 entries: HTTP/2 sample stream identifiers (#1161), TCP option re-padding (#1163, breaking), format='pcap' output (#1164), declared lengths on truncated captures (#1166, breaking) - extend the PCAP Header (#1159), HIP (#1160) and from_data round-trip (#1162) entries rather than duplicating them - regenerate CHANGELOG.md with util/changelog_md.py - process.rst: entry-count pin re-measured, 189 -> 193 tests/project: conventions_doc_claims, changelog_md and documentation_claims pass; changelog_md.py --check is in step.
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 pylint,make mypy,make isort) — ran the tools ontcp.pyonly: mypy 0 errors, pylint no new messages (5 fewer); isort's complaint ontcp.py/test_tcp_udp_unit.pyis already onmainmake testpasses, and a test case covers the change — the 17tests/protocols/transport/test_tcp*/test_transport_unitmodules,test_option_roundtrip_unit, andtests/project, each run on its ownWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1151.
_make_tcp_optionsdropped the NOP/EOOL options it was given and padded each option to 4 octets separately. Now it emits options as given and pads once at the end: zero octets after a trailing EOOL, otherwise NOPs then an EOOL.Probe: parse each TCP segment,
TCP.from_data(info), compare header octets. The payload maker is stubbed so the HTTP rebuild (#1154) does not interfere.http.pcapbefore:a002…0402080a…01030306→b002…040201 00 080a…0100 030306 00.options-*.pcapregenerate byte-identical.New test file
tests/protocols/transport/test_tcp_options_roundtrip_unit.py: 4 passed with the fix, 4 failed without it.test_tcp_udp_unit.pypinned the old NOP-dropping behaviour and is updated.EXPECTED_FAILUREShad no TCP entries, so it is unchanged.