]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
base-files: introduce a function to generate IAID
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Tue, 13 Jan 2026 17:19:48 +0000 (18:19 +0100)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Thu, 15 Jan 2026 10:06:32 +0000 (11:06 +0100)
Add new function "network_generate_iface_iaid()" to generate a stable IAID
from an interface name.

(cherry picked from commit e1f2b666ff94f2b8a50ca000d69f5b5f0b89a27c)
Link: https://github.com/openwrt/openwrt/pull/21489
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
package/base-files/files/lib/functions/network.sh

index 4851a5817ada074ee57b3a95a712253c4d34ecf1..54ca7b00d49a53fc5b363b8a3aed6578b99c6111 100644 (file)
@@ -24,6 +24,17 @@ __network_ifstatus() {
        eval "$__tmp"
 }
 
+# determine the IAID of the given logical interface
+# 1: destination variable
+# 2: interface
+network_generate_iface_iaid() {
+       local __iaid
+
+       __iaid=$(printf '%s' "$2" | md5sum | cut -c 1-8)
+
+       export "$1=$__iaid"
+}
+
 # determine first IPv4 address of given logical interface
 # 1: destination variable
 # 2: interface