summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas2026-01-10 14:44:48 +0000
committerÁlvaro Fernández Rojas2026-01-15 10:06:32 +0000
commit88f97a96491cb0a62398752cb5901d37aff2f147 (patch)
tree9315af6b13a7c8a8bde6e01030b66e0ebec95bd4
parentb5d094635118ba1e9cc89abbbabd7e267bd7af3a (diff)
downloadopenwrt-88f97a96491cb0a62398752cb5901d37aff2f147.tar.gz
netifd: use stable IAID for DHCPv4
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. (cherry picked from commit e1c125c167e5c4fef16fd5e2bf670f290808b2d1) 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>
-rw-r--r--package/network/config/netifd/Makefile2
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/proto/dhcp.sh9
2 files changed, 6 insertions, 5 deletions
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 2c550ef554..a66f87d38d 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -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
diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 1c0f720f4a..e5724ff11f 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -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() {