base-files: generate a global DHCP DUID
authorDavid Härdeman <[email protected]>
Thu, 9 Oct 2025 14:16:53 +0000 (16:16 +0200)
committerRobert Marko <[email protected]>
Sun, 19 Oct 2025 17:46:22 +0000 (19:46 +0200)
commita660a076db5a419963e0429a71201d07445ba6ea
treeb9139a5421a37915f490468fda98f0fd3a6b6cb2
parent86b6b31247cb6ec0a9e7839bee8e91cab0f00ba4
base-files: generate a global DHCP DUID

odhcp6c and odhcpd currently generate custom DUIDS on a per-interface basis
using the MAC address of the given interface.

This is contrary to how DUIDs are meant to be used, as the client identifier
will vary from interface to interface, while it is meant to remain stable for a
given host, no matter how the network hardware changes (see RFC8415, §11).

The same problem exists in odhcpd, which also generates server-side DUIDs on a
per-interface basis.

In order to support a stable per-device DUID, generate one on first boot and
store it via uci.

Currently, a DUID-UUID style clientid is generated. This is mostly meant as an
RFC, and we might consider using a different kind of DUID instead (DUID-LLT,
DUID-EN).

One drawback is that this will typically change the DUID used on existing
OpenWrt devices when upgrading to a new release. However, that seems
unavoidable and is a one-time pain in order to have stable DUIDs (and in many
cases, it shouldn't cause any issues).

v2: move the uci cfg generation outside of an IPv6-only block since this
is relevant to the DHCPv4 client as well

Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20359
Signed-off-by: Robert Marko <[email protected]>
package/base-files/files/bin/config_generate
package/base-files/files/etc/uci-defaults/14_network-generate-clientid [new file with mode: 0644]