base-files: correct global DHCP DUID generation
authorAlice H. <[email protected]>
Sat, 8 Nov 2025 04:39:42 +0000 (04:39 +0000)
committerRobert Marko <[email protected]>
Sat, 8 Nov 2025 15:30:37 +0000 (16:30 +0100)
The old command generates an often incorrect variable length UUID
instead of a fixed 16-octet hex string.

Ref: https://datatracker.ietf.org/doc/html/rfc8415#section-11.5

Signed-off-by: Alice H. <[email protected]>
package/base-files/files/etc/uci-defaults/14_network-generate-clientid

index 70da185c203249a06a54f242f7adb953366c3a9b..11806dd19ccf55f516ed6f324c134ed93cc02dac 100644 (file)
@@ -2,7 +2,7 @@
 
 uci -q batch <<-EOF >/dev/null
        # DUID-UUID - RFC6355
-       set network.globals.dhcp_default_duid="$(hexdump -vn 16 -e '"0004" 2/2 "%x"' /dev/urandom)"
+       set network.globals.dhcp_default_duid="$(printf '%s%s' '0004' $(cat /proc/sys/kernel/random/uuid | sed -e 's/-//g'))"
        commit network
 EOF