From 551e04f3c9c063d885ca7a91db36f27f684a3a5c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Mon, 16 Dec 2024 15:09:50 +0800 Subject: [PATCH] base-files: strip space and tab characters from ASCII mac address Spaces and tabs are widely used in variable definitions. We have to remove them to ensure that get_mac_ascii() works properly. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/17262 Signed-off-by: Hauke Mehrtens --- package/base-files/files/lib/functions/system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index aaeb75f261..f43281b5dc 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -66,7 +66,7 @@ get_mac_ascii() { local key="$2" local mac_dirty - mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p' | head -n 1) + mac_dirty=$(strings "$part" | tr -d ' \t' | sed -n 's/^'"$key"'=//p' | head -n 1) # "canonicalize" mac [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" -- 2.30.2