Skip to content

feat(application): concatenate repeated DHCP options per RFC 3396 (#3200) - #3209

Merged
JarryShaw merged 1 commit into
developfrom
feat/3200-dhcp-rfc3396-concatenation
Nov 29, 2026
Merged

JarryShaw merged 1 commit into
developfrom
feat/3200-dhcp-rfc3396-concatenation

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Nov 29, 2026 •

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 #3200.

  • A DHCP message's repeated option is one option (RFC 3396 §7). Its instances in the options field, then file, then sname (§5; RFC 2131 §4.1) are concatenated into the new DHCPv4.split_options, one SplitOption (Data_SplitOption) per code, decoded once by the code's registered parser. Each instance keeps its octets in options, so the message rebuilds byte for byte. A field the Option Overload option leaves out is not part of the buffer.
  • message_type reads it, so a repeated option 53 gives its type rather than None. A split Option Overload option overloads its fields. A Domain Search pointer resolves into the joined data (RFC 3397 §2–3).
  • An option one of whose instances runs past its field is cut short, so it keeps its octets and has no split_options entry, as a cut option carried once does.
  • make() refuses fields for a code the aggregate buffer holds more than once, across the fields as well as within one; its parts are given as octets.
  • BOOTP concatenates nothing: RFC 3396 §1 and §7 concatenate the options of a received DHCP packet.

Tests: the new SplitOptionTests in tests/protocols/application/test_dhcp_unit.py fail on an origin/develop export (7 of 8; the BOOTP one pins the scope), and the DHCP modules stay at 100% statement and branch coverage. tests/protocols/*.py, tests/project, tests/*.py, tests/protocols/{application,transport} and the DHCP integration modules pass. The Sphinx-gated modules pass in a docs/requirements.txt venv. The only failure, test_conda_dev_release_gate_2458, fails the same way on the export.

@JarryShaw JarryShaw added feat Pull requests that add a new capability (feat: subject prefix) 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
)

A DHCP message's repeated option is one option (RFC 3396 section 7): its
instances in the options, then file, then sname fields join into the new
DHCPv4.split_options, a SplitOption each, decoded once; every instance keeps
its octets, so the message rebuilds byte for byte. message_type reads it, and
a split Option Overload option overloads its fields. An option one of whose
instances runs past its field is cut short and stays octets. make() refuses
fields for a code the aggregate buffer holds more than once, across fields
too. BOOTP concatenates nothing: RFC 3396 sections 1 and 7 concatenate the
options of a received DHCP packet.
@JarryShaw
JarryShaw force-pushed the feat/3200-dhcp-rfc3396-concatenation branch from 793b6ba to 87e5df1 Compare November 29, 2026 04:23
@JarryShaw

Copy link
Copy Markdown
Owner Author

Good to go at 87e5df1f0, after a Sonnet cross-review plus my check of the fold.

  • An 8000-payload fuzz found no rebuild mismatches. BOOTP output is byte-identical to develop across 4771 packets. RFC 3397's three-part example matches byte for byte, and its C004 pointer lands at offset 4 of the joined data.
  • RFC 3396 §5/§6 field order and the Option Overload scoping hold. make() refuses decoded fields for a code repeated across fields.
  • Fold: the claim "RFC 3396 updates RFC 2131 alone" was wrong, because §4 also updates RFC 2132. The BOOTP exclusion now rests on §1 and §7. range-diff shows only that prose changed.
  • Not breaking: DHCP is unreleased.

@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

Copy link
Copy Markdown
Contributor

Coverage: 94.93% (unit tier, Python 3.15, 87e5df1f0, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 116 4 20 2 95.59%
pcapkit/const 22308 224 3168 191 98.27%
pcapkit/corekit 3160 83 1058 40 96.85%
pcapkit/dumpkit 423 3 148 5 98.60%
pcapkit/foundation 4341 24 1362 26 99.12%
pcapkit/interface 112 4 40 3 95.39%
pcapkit/protocols 28651 153 7568 128 99.21%
pcapkit/toolkit 1136 35 406 9 96.24%
pcapkit/utilities 638 7 176 5 98.53%
pcapkit/vendor 6514 2394 1464 256 59.91%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit c5098c6 into develop Nov 29, 2026
73 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 29, 2026
@JarryShaw
JarryShaw deleted the feat/3200-dhcp-rfc3396-concatenation branch November 29, 2026 07:19
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Pull requests that add a new capability (feat: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant