Repository navigation
fix(tcp): NS flag is written by make() but never parsed - #1114
Conversation
|
Cross-review verdict on The code is correct:
But |
make() packed NS into bit 103 and the OffsetFlag schema declared it, but the reader and _make_data had ns commented out (2e39aeb, a typing-only pass with no stated reason), so a parsed segment had no flags.ns and a from_data rebuild cleared the bit silently. - data/transport/tcp.py: restore ns on the Flags data model - transport/tcp.py: read ns from schema.offset, emit it in _make_data, and list tcp.flags.ns in the module's header table - tcp.rst: drop the footnote saying NS is left unexposed - test_tcp_udp_unit.py: add ns to the hand-built Flags stand-in - new test_tcp_ns_flag_roundtrip_unit.py Closes #1098
80b62ed to
45e84f0
Compare
|
Cross-review verdict on Round 1's only finding is fixed. The footnote in The one remaining Round-1 evidence still holds:
|
|
Coverage: 88.74% (unit tier, Python 3.14,
Per-file detail: the |
Please follow the guide below
unused-argumentpattern on theFlags.__init__stubmake testpasses, and a test case covers the change. Not run in full: see the module list belowWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1098. NS was commented out of
Flags, the reader and_make_datain2e39aeb99("minor revision for TCP on typings"). The commit gives no reason, and it kept NS inmake()and in theOffsetFlagschema, so this PR makes NS round-trip rather than removing it. The owner ruled on #1098 to expose NS. Thetcp.rstfootnote saying NS is "not surfaced in Flags … left unexposed" is removed together with its[*]_marker. Thetcp.flags.nsrow stays, and the one remaining[*]footnote still pairs with its marker.Probe (
TCP(srcport=1, dstport=2, ns=True), parse it, then rebuild withfrom_data): before, byte 12 was0x51,'ns' in flagswasFalse, and the rebuild gave0x50. After:0x51,flags.ns is True, and the rebuild gives0x51.Tests: new
test_tcp_ns_flag_roundtrip_unit.py: 4 passed with the fix. With the fix reverted, 1 failed plus 4 subtests failed (read,from_data, field order);make_sets_nspasses either way, because it guards the write side. Intest_tcp_udp_unit.py, the hand-builtFlagsstand-in pinned the old 8-field shape, sons=Falsewas added to it (18 passed). Also green:test_option_roundtrip_unit(noEXPECTED_FAILURESchange),test_option_generator_tcp_base_unit, and the sixtest_tcp_mptcp_*_unitmodules.tests/project: 379 passed, 1 skipped.