Skip to content

RFE: long DHCPv4 options (RFC 3396) #4642

Open
@evverx

Description

@evverx

Brief description

Long DHCPv4 options longer than 255 bytes aren't supported out of the box. For example

raw(DHCP(options=[('captive-portal', 'a'*256)]))

fails with

error: While dissecting field 'options': ubyte format requires 0 <= number <= 255

but according to https://www.rfc-editor.org/rfc/rfc3396#section-1 it can be split and then it should be joined on the receiving side

when more than
one option with a given type code appears in the DHCP packet, all
such options should be concatenated together.

Wireshark started concatenating options according to that RFC a couple months ago: https://gitlab.com/wireshark/wireshark/-/merge_requests/18079

https://www.ietf.org/archive/id/draft-tojens-dhcp-option-concat-considerations-00.html was also mentioned there.

(It's possible to do all that manually. It's just something I noticed in the context of suboptions in NetworkConfiguration/dhcpcd#404. It came up again when I took a look at #4638 and tried to stuff quite a few IP addresses into a reply :-))

Scapy version

7106b01

Python version

Python 3.13.1

Operating system

Fedora 41

Additional environment information

No response

How to reproduce

raw(DHCP(options=[('captive-portal', 'a'*256)]))

and

DHCP(b'\x06\x02\x01\x02\x06\x02\x03\x04')

should be the same as

DHCP(b'\x06\x04\x01\x02\x03\x04')

Actual result

No response

Expected result

No response

Related resources

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions