mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-25 05:47:00 +00:00
base-files: enable get_mac_ascii() to handle redundant strings
The function get_mac_ascii() will fail when there are two or more same MAC address variable names in the mtd partition. Only retain the first variable to workaround this rare situation. Fixes: https://github.com/openwrt/openwrt/issues/17236 Signed-off-by: Shiji Yang <yangshiji66@qq.com> Link: https://github.com/openwrt/openwrt/pull/17262 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
58056df84f
commit
3410ad2f40
@ -66,7 +66,7 @@ get_mac_ascii() {
|
||||
local key="$2"
|
||||
local mac_dirty
|
||||
|
||||
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
|
||||
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p' | head -n 1)
|
||||
|
||||
# "canonicalize" mac
|
||||
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
|
||||
|
Loading…
x
Reference in New Issue
Block a user