mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-28 03:37:17 +01:00
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:
parent
073a8d07e9
commit
b5d0946351
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue