Skip to content

fix(transport): a DATA or I-DATA chunk with no user data makes the whole SCTP layer fall back to Raw (#3215) - #3218

Open
JarryShaw wants to merge 1 commit into
developfrom
fix/3215-empty-data-chunks
Open

JarryShaw wants to merge 1 commit into
developfrom
fix/3215-empty-data-chunks

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Please follow the guide below

  • Put an x into every box [ ] that applies to your pull request (like this: [x])

  • Use the Preview tab to see how your pull request will look

  • Searched for similar pull requests

  • Followed the coding style (make pylint, make mypy, make isort)

  • make test passes, and a test case covers the change

  • Described the user-visible change below and left its changelog entry to the maintainer, keeping docs/source/changelog/ and CHANGELOG.md out of the diff, if the change is user-visible: N/A — centralised

What is the purpose of your pull request?

Tick the commit type your subject line carries.

  • fix — corrects a defect

  • feat — adds a feature

  • perf — changes performance, not behaviour

  • refactor — changes neither behaviour nor performance

  • test — tests only

  • docs — documentation only

  • ci — workflows or build tooling

  • release — bumps the version or rolls up a distribution

  • chore — anything else

  • Also tick if it regenerates constant or registry tables, members keeping their numeric values (the const label)


Description of your pull request and other information

Closes #3215.

  • SCTP._read_chunk_data and _read_chunk_i_data now refuse only a Length short of the chunk's fixed fields (16, 20). A chunk with no user data keeps data=b'': RFC 9260 §3.3.1 forbids sending one, but §6.2 has the receiver answer it with an ABORT carrying "No User Data" (§3.3.10.9), and RFC 8260 §2.1 has I-DATA's Length follow DATA's.
  • _make_chunk_data and _make_chunk_i_data still refuse empty user data given as keywords (the sender rule, §3.3.1), and rebuild a parsed chunk as received, as the I-DATA maker already keeps a parsed reserved field. So parse→rebuild and make→parse are byte-exact.
  • An empty fragment yields a reassembly record. RFC 9260 §6.9 and RFC 8260 §2.2.3 identify a fragment by its B and E bits, not its length, and _sctp_fragments already selects on them, so no toolkit change. Dropping the record would leave a TSN or FSN hole that no later chunk fills, so a message captured whole would be reported partial. The ABORT that §6.2 asks for acts on the association, which the reassembler does not model for any chunk. An unfragmented empty chunk (B and E both set) yields no record.
  • Pins: sctp/data-no-user-data leaves the edge suite's REJECTED and round-trips, with a new I-DATA twin. The reader pins in test_sctp_unit.py, test_sctp_extension_chunks_2811_unit.py and test_maker_invalid_format_messages_2296_unit.py move to a Length short of the fixed fields.

Tests: tests/protocols/transport/test_sctp_empty_user_data_3215_unit.py fails 16 of 22 on an origin/develop export. Its passing case is the Length-boundary guard, which passes on purpose. SCTP coverage is unchanged at 93%, and the touched lines are covered. tests/project, tests/protocols/*.py, tests/*.py, tests/protocols/transport, tests/foundation/reassembly and tests/toolkit pass, and so do the Sphinx-gated tests/project modules under docs/requirements.txt.

…ole SCTP layer fall back to Raw (#3215)

- SCTP._read_chunk_data and _read_chunk_i_data refuse only a Length short
  of the chunk's fixed fields (16, 20), so a chunk with no user data parses
  with data=b'' (RFC 9260 6.2, 3.3.10.9; RFC 8260 2.1).
- _make_chunk_data and _make_chunk_i_data still refuse empty user data
  given as keywords (RFC 9260 3.3.1), but rebuild a parsed chunk as
  received, so both round trips are byte-exact.
- Tests: the no-user-data edge cases round-trip; the reader pins move to a
  Length short of the fixed fields.
@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) review: running A cross-review is in flight against the current head - no verdict yet labels Nov 29, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 PyPCAPKit | 🛠️ Build #36238369 | 📁 Comparing 5a4c166 against latest (d2e7bd9)

  🔍 Preview build  

3 files changed
± genindex.html
± pcapkit/protocols/transport/sctp.html
± _modules/pcapkit/protocols/transport/sctp/protocol.html

@JarryShaw

Copy link
Copy Markdown
Owner Author

Good to go at 5a4c16652, after a Sonnet cross-review.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Nov 29, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.10 milestone Nov 29, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment) review: good-to-go Cross-review at the current head says ready; CI state is separate

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant