Skip to content

[WIP] dhcp[46]: Support custom options#262

Draft
Alphix wants to merge 2 commits intoopenwrt:masterfrom
Alphix:custom-options
Draft

[WIP] dhcp[46]: Support custom options#262
Alphix wants to merge 2 commits intoopenwrt:masterfrom
Alphix:custom-options

Conversation

@Alphix
Copy link
Contributor

@Alphix Alphix commented Oct 1, 2025

This adds more feature parity with dnsmasq by allowing custom DHCPv4/DHCPv6 options to be set.

WIP so far, needs more testing and the option parsing could be merged for the v4/v6 cases.

@Alphix Alphix changed the title dhcp[46]: Support custom options [WIP] dhcp[46]: Support custom options Oct 1, 2025
Alphix added 2 commits October 3, 2025 17:55
This adds support for custom DHCPv6 options, similar to what dnsmasq supports
via "--dhcp-option".  Currently, only one type of option data is supported, and
that is a hexadecimal string defining the exact content of the option. More
variants can always be added later.

In other words: the full range of option formats supported by dnsmasq is *not*
supported, but this feature is a bit of a niche feature, so this initial
support is hopefully still useful.

Signed-off-by: David Härdeman <david@hardeman.nu>
This adds support for custom DHCPv4 options in the same manner as the previous
patch which added support for custom DHCPv6 options.

Signed-off-by: David Härdeman <david@hardeman.nu>
@Alphix
Copy link
Contributor Author

Alphix commented Oct 26, 2025

For anyone who comes across this PR: I will substantially rework it once a bunch of other PRs have landed. I'm keeping the draft PR here as a placeholder and to let ppl know that it will land at some point.

| dhcpv6_na |bool | 1 | DHCPv6 stateful addressing hands out IA_NA - Internet Address - Network Address |
| dhcpv6_pd |bool | 1 | DHCPv6 stateful addressing hands out IA_PD - Internet Address - Prefix Delegation |
| dhcpv6_pd_min_len |integer| - | Minimum prefix length to delegate with IA_PD (value is adjusted if needed to be greater than the interface prefix length). Range [1,62] |
| dhcpv6_option |list | - | Custom DHCPv6 options in the form of strings formatted as `<optcode>,<encoding>:<data>`. For example: `42,hex:4575726F70652F4265726C696E` (timezone = "Europe/Berlin", RFC4833, §3) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess a new example is better now we have RFC4833 support? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha...yes...but don't waste time on reviewing this in detail just yet...I have a much more comprehensive idea in mind, it needs some more time though.

@miyatsu
Copy link

miyatsu commented Jan 4, 2026

Hi @Alphix , I'm not a network expert but regular user. This PR seems support set custom option on interface only?

The dnsmasq have tag feature which I can assign different custom options to specific set(s) of client (static lease with specific tag set). Is there any possible we can support some dnsmasq tag like feture that we can set custom options per client(s)? Thx.

@Alphix
Copy link
Contributor Author

Alphix commented Jan 4, 2026

Hi @Alphix , I'm not a network expert but regular user. This PR seems support set custom option on interface only?

It's very early days, but yes, in the future the idea is that custom options will be available on a per-interface and per-static-lease basis. I don't expect this to be ready for 25.12 though, more likely material for the release after that.

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.

3 participants