Repository navigation
fix(mh): keep zero-length PadN, reserved fields and BU/BA flag bits on rebuild - #1345
Conversation
|
Cross-review verdict on
The code held everywhere it was tested:
Nit: RFC 7161 draws BU |
…n rebuild - PadN with Option Length 0 is a valid two-octet pad (RFC 6275 6.2.3); it is no longer rejected on read or rewritten as Pad1 on make (#1324). - The fixed-header reserved octet, the BRR reserved field and the Handoff Indicator reserved octet are read as integers and written back (new data fields MH.reserved, BRR.msg_reserved, HI.reserved). - BU and BA model every flag IANA assigns (M R P F T B S D / R P T B S D) and keep the remaining reserved bits (flags_reserved). - IPv4 Home Address and Network-Identifier ANI sub-option keep their reserved bits (reserved). Closes #1324 Refs #1329
a73d667 to
f81c392
Compare
|
Round-2 verdict on |
|
Coverage: 85.85% (unit tier, Python 3.14,
Per-file detail: the |
|
The 85.85% on this PR is a CI artefact, not this diff. |
make pylint,make mypy,make isort) — only mypy run on the 3 MH files: no new errors (2 pre-existing inmh.py); pylint/isort not runmake testpasses, and a test case covers the change — per-module runs listed below, not the full suiteWhat is the purpose of your pull request?
fix— corrects a defectCloses #1324
Refs #1329
#1324: RFC 6275 §6.2.3 (checked): PadN is for "two or more octets", with Option Length N-2, so length 0 is legal. As in #1310,
_read_opt_padno longer rejects it and_make_opt_padno longer rewrites it as Pad1. Fresh-make padding of 2 octets still uses two Pad1s, also as in #1310.#1329: the header reserved, BRR reserved and Handoff Indicator reserved are now integer fields. The IPv4 Home Address (9 bits) and ANI Network-Identifier (7 bits) get a
reservedsub-field. BU/BA now model every flag in the vendored IANA registries (pcapkit/const/mh/binding_{update,ack}_flag.py): BUM R P F T B S D(RFC 4140/3963/5213/5555/5845/6602/7161/8885), BAR P T B S D, plusflags_reserved. PadN contents (the rest of #1329's repro) and the otherPaddingFieldsites are #1223, henceRefs. BUSfollows IANA/RFC 8885 (bit 10), not RFC 7161's drawing (bit 7, colliding withF).Breaking: new required data fields:
MH.reserved(every message),BindingRefreshRequestMessage.msg_reserved, BU/BA flags +flags_reserved, andreservedonHandoffIndicatorOption,IPv4HomeAddressOptionandANINetworkIdentifierSuboption. The message-level names differ fromreservedbecause they would clash with the inherited header field.Probe (parse, then
MH.from_data): before, D14 raisedProtocolError, and header/BRR/BU/BA came back…00…,f000,80. After, all 8 repros are byte-exact. All 99 MH frames inoptions-*.pcapstill round-trip.Tests: new
test_mh_roundtrip_unit.py(6 tests, 41 subtests). With the three source files reverted: 34 failed, 2 passed.test_mh_unit.pyis edited where it pinned the old shape: PadN 0 → Pad1, PadN 0 rejected, and fake headers/flags without the new keys. Passing: new module,test_mh_unit52/499,test_mh_mesg_id_fraction_unit,test_option_roundtrip_unit6/362,test_ipv6_ext_unit,test_length_hint_minimum_header_unit, andtests/project389 passed.run_unittest_leg.py protocols/internet: 509 OK.