Repository navigation
fix(ipv4): rebuild option areas, route slots, timestamps and reserved bits byte-exactly - #1344
Conversation
|
Cross-review verdict on 1. Octets after EOOL are still lost when they are non-zero. This is blocking: #1317 asks for exactly these octets to be kept. Measured in the PR worktree:
The fix keeps trailing octets as EOOL entries, so it can only express zeros. Carry the raw octets after EOOL instead. 2. Verified and accepted:
For follow-up issues, all confirmed:
|
… bits byte-exactly - make(): concatenate the options and pad once at the end, so an EOOL after an unaligned option no longer hides the rest (#1316). - from_data: write parsed NOP/EOOL in place, and carry the octets after EOOL verbatim as the new `padding` data field and make() keyword (#1317). - Unassigned options: data defaults to b'', length is len(data) + 2, and a length of 2 is accepted (#1318). - LSR/SSR/RR: model every route slot; slots at or past the pointer are the new data field `remaining` and a make() keyword (#1319). - TS: keep a timestamp with the high-order bit set as the raw value (#1320). - SEC: the field termination indicator follows RFC 1108 section 2.4(a), 0 on the final octet and 1 when more follow (#1321). - QS: an unassigned function parses and rebuilds as an unassigned option, and make() builds one (#1322). - Name the reserved flag bit, the QS nonce reserved bits and the QS report unused octet (#1326).
94c503f to
816b8b6
Compare
|
Round-2 verdict on 1. Octets after EOOL are kept. A new
A fresh option list still pads exactly once ( 2.
Revert proof: 34 failed / 4 passed against |
|
Coverage: 88.87% (unit tier, Python 3.14,
Per-file detail: the |
…o longer raises the wrapped error (#1395) #1344 pads the IPv4 option area once at the end, so the schema now accepts octets read() then rejects (an option whose length runs past the area), and the reader's bare ProtocolError escaped the wrap #1352 put around the schema re-parse only. unpack() now wraps the read as well when the made header holds raw items, and the wrapped message carries the original one. The same escape is fixed for TCP, HOPOPT, IPv6-Opts, MH, SCTP and HIP. Closes #1394
make pylint,make mypy,make isort): mypy clean and isort clean on the three modules; pylint adds no new message kinds overmainmake testpasses, and a test case covers the change: the modules listed below only, not the whole suiteWhat is the purpose of your pull request?
fix— corrects a defectCloses #1316
Closes #1317
Closes #1318
Closes #1319
Closes #1320
Closes #1321
Closes #1322
Closes #1326
All 21 issue repros, plus non-zero octets after EOOL, used to rebuild wrong or raise, and now rebuild byte-exactly. All 1361 IPv4 layers in
examples/captures/*still rebuild their header byte-exactly. #1321 was checked against RFC 1108 §2.4(a): the low-order bit is0on the final octet and1when more follow.Breaking changes
Flags.reserved;remainingonLSROption/RROption/SSROption;reservedon both QS options;unusedonQuickStartReportOption.IPv4.padding(octets after EOOL, kept verbatim). Newmake()keywords:reservedandpaddingonIPv4.make,remainingon LSR/RR/SSR, andunused/reservedon QS.flagsand the QSnonceBitFields now require areservedkey. LSR/RR/SSRroutenow covers every slot.QuickStartReportOption.reservedis now aUInt8Field.quick_start_data_selectorfalls back toUnassignedOptioninstead of raisingFieldValueError.make()writes SEC with the RFC indicator, so the generatedoptions-ipv4.pcapchanges. A TS integer is now the raw 32-bit field, so a set high bit is kept and no longer warns.Tests (
test_ipv4_roundtrip_unit.pyis new;test_ipv4_unit.pypins updated)invalid header length: 24. With it: 11 passed, 27 subtests.test_ipv4_unit26 passed,test_option_roundtrip_unit6 passed,tests/project389 passed / 1 skipped,run_unittest_leg.py protocols/internet514 tests OK. Alsotest_quick_start_func_unit,test_option_coverage_runtime,test_generated_pcap_runtime,test_declared_length_roundtrip_runtimeand 7 more IPv4-adjacent modules all pass.Left out of scope:
QSFunctionadmits only 0–8, so the selector catchesEnumValueErrorfor 9–15. TS still zero-fills slots past its pointer, the same shape as #1319.