base-files: introduce a function to generate IAID

Add new function "network_generate_iface_iaid()" to generate a stable IAID
from an interface name.

(cherry picked from commit e1f2b666ff)
Link: https://github.com/openwrt/openwrt/pull/21489
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
Álvaro Fernández Rojas 2026-01-13 18:19:48 +01:00
parent 073a8d07e9
commit b5d0946351

View 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