diff options
author | Rosy Song <rosysong@rosinson.com> | 2019-11-04 20:44:41 +0100 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2019-11-07 17:13:18 +0100 |
commit | 6170c46b477d4953f91b99e805a276de444913cf (patch) | |
tree | 323d7cb101d84fa1adaf52d9079dbe7a284556d8 /package/base-files/files/lib/functions | |
parent | a6fbdd3a7837ea93d65115a62001ab96d5ff0b67 (diff) | |
download | upstream-6170c46b477d4953f91b99e805a276de444913cf.tar.gz upstream-6170c46b477d4953f91b99e805a276de444913cf.tar.bz2 upstream-6170c46b477d4953f91b99e805a276de444913cf.zip |
base-files: rename hostname with EUI of mac address
If a label MAC address is provided for device, system
will rename the hostname with OpenWrt_{eui mac address}.
This helps to distinguish between different devices.
Since it's no good idea to nest json_* functions, this code does
not use get_mac_label directly, but only get_mac_label_dt as
external resource.
Signed-off-by: Rosy Song <rosysong@rosinson.com>
[merged with commit introducing macaddr_geteui, rebased on updated
label MAC address storage, extended commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'package/base-files/files/lib/functions')
-rw-r--r-- | package/base-files/files/lib/functions/system.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index be7efe4e2e..c4dc3cc3a9 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -144,6 +144,13 @@ macaddr_add() { echo $oui:$nic } +macaddr_geteui() { + local mac=$1 + local sep=$2 + + echo ${mac:9:2}$sep${mac:12:2}$sep${mac:15:2} +} + macaddr_setbit_la() { local mac=$1 |