Skip to content

fix DHCP decode of data after the END option - #402

Merged
GIC-de merged 1 commit into
rtbrick:devfrom
vorco:fix-dhcp-end-option
Oct 3, 2026
Merged

GIC-de merged 1 commit into
rtbrick:devfrom
vorco:fix-dhcp-end-option

Conversation

@smpettit

Copy link
Copy Markdown

decode_dhcp() reads a length byte for every option except PAD before it reaches case DHCP_OPTION_END. If a DHCP message has non-zero bytes after END and the byte following END is larger than the remaining length, the message is rejected with DECODE_ERROR (counted as an RX protocol error) and never reaches the DHCP client.

RFC 2132 section 3.2 defines END as a single octet that marks the end of valid information, so the decoder now stops at END. The case DHCP_OPTION_END that this makes unreachable is removed.

Testing

  • New unit test test_protocols_dhcp_end_option (an Offer with non-zero bytes after END). It fails without the change and passes with it.
  • -DBNGBLASTER_TESTS=ON, RelWithDebInfo, gcc 13.3 on Ubuntu 24.04: builds without warnings, ctest 4/4 passed.
  • Lab: DHCPv4 IPoE sessions against a server whose Offers carry data after END now establish (120/120, 0 before).

🤖 Generated with Claude Code

decode_dhcp() read a length byte for the END option before handling it,
so a DHCP message with non-zero bytes after END was rejected as a decode
error whenever the byte following END exceeded the remaining length.
RFC 2132 section 3.2 defines END as a single octet that marks the end of
valid information, so stop parsing at END.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants