Repository navigation
fix(sctp)!: keep the octets after the last whole chunk as captured (#1468) - #1472
Merged
Merged
Conversation
…1468) SCTP has no packet length field, so octets after the last whole chunk -- under a chunk header, a chunk whose length runs past the data, or one declaring less than its own header -- cannot be told apart from a cut chunk, and they made the whole packet raise "Field chunks has an option that runs past the end of the data". The chunk list (`ChunkListField`) now stops at the last whole chunk and the rest is a length-less `trailer` PayloadField; read() keeps it as info.trailer when non-empty, make(trailer=) writes it under the computed checksum, and _make_data round-trips it, as IPv4/IPv6 (#1209) and L2TPv2/OSPF (#1455) do. A raw chunk given to make() that is not whole is still rejected. Breaking: such packets now parse instead of raising, and info gains a `trailer` key when they carry those octets. Two tests whose malformed cases relied on a chunk running past the packet are updated.
Owner
Author
|
Verdict: GOOD TO GO at
Not blockers, and both identical on
|
Contributor
|
Coverage: 89.54% (unit tier, Python 3.14,
Per-file detail: the |
3 of 13 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.
Searched for similar pull requests
Followed the coding style: mypy on the 3 SCTP files reports nothing on the new lines; pylint and isort not run to completion
make testpasses, and a test case covers the change: the new module, the protocols-rest leg (1159 OK),test_capture_roundtrip_runtime.py(4 passed), the transport edge module (6 passed) andtests/project(419 passed, 1 skipped)Changelog entry — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657
fix— corrects a defectCloses #1468
SCTP has no packet length, so octets after the last whole chunk can't be told apart from a cut chunk. Per #1458, the packet now parses and keeps them as
trailer, as #1431/#1460/#1467 do. A raw last element was considered but not used:chunksis keyed by chunk type, so bytes would need a fake key, andfrom_datacould not rebuild from it. AChunkListFieldstops at the last chunk whose declared length is present (≥ 4).make(trailer=)writes the trailer under the checksum. A raw chunk passed tomake()that is not whole is still rejected.Before:
COOKIE ACK + b'x'(and 3, 4, 5 octets, or a chunk declaring 40 with 8 present) raiseProtocolError. After: each parses and rebuilds exactly, throughfrom_data(info)andfrom_data(info.to_dict()), alone and under IPv4.tests/protocols/transport/test_sctp_stray_octets_unit.py: 7 tests, 36 subtests; before the fix, 6 tests and 33 subtests fail. Two existing tests pinned the old behaviour, a chunk running past the packet raising: I updated threetest_sctp_unitcases so the declared octets are present, and dropped the SCTP case fromtest_declared_length_overrun_unit. Not in this PR: the last-chunk padding cut left over from #1465 (sctp/last-chunk-unpadded) is a different shape, octets missing rather than extra, and stays a known failure.