netifd: use stable IAID for DHCPv4 main master
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Sat, 10 Jan 2026 14:44:48 +0000 (15:44 +0100)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Wed, 14 Jan 2026 17:07:38 +0000 (18:07 +0100)
Commit 9151c7015ed2 introduced support for the global DHCP DUID to
generate a RFC4361-style client identifier.
However, the IAID introduced in those changes is based on ifindex, which
is subject to changes and causes issues on environments requiring a stable
IAID.

This commit switches the IAID to a stable one based on MD5.

Fixes: 9151c7015ed2 ("netifd: use the global DHCP DUID for DHCPv4")
Link: https://github.com/openwrt/openwrt/pull/21489
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
package/network/config/netifd/Makefile
package/network/config/netifd/files/lib/netifd/proto/dhcp.sh

index 2c550ef554df1b086c0fe0a7961d18938b2b5d14..a66f87d38ddf18c0100e3b8f677bc55fe32a2b13 100644 (file)
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=netifd
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
index 1c0f720f4ae63c9925dbc2bf8ce8ace12a91846e..e5724ff11f7f3f18840b854ca87cdf3412b761dc 100755 (executable)
@@ -3,6 +3,7 @@
 [ -x /sbin/udhcpc ] || exit 0
 
 . /lib/functions.sh
+. /lib/functions/network.sh
 . ../netifd-proto.sh
 . /lib/config/uci.sh
 init_proto "$@"
@@ -37,11 +38,11 @@ proto_dhcp_get_default_clientid() {
 
        local iface="$1"
        local duid
-       local iaid="0"
+       local iaid
 
-        [ -e "/sys/class/net/$iface/ifindex" ] && iaid="$(cat "/sys/class/net/$iface/ifindex")"
-        duid="$(uci_get network @globals[0] dhcp_default_duid)"
-        [ -n "$duid" ] && printf "ff%08x%s" "$iaid" "$duid"
+       network_generate_iface_iaid iaid "$iface"
+       duid="$(uci_get network @globals[0] dhcp_default_duid)"
+       [ -n "$duid" ] && printf "ff%s%s" "$iaid" "$duid"
 }
 
 proto_dhcp_setup() {