Переглянути джерело

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 <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/17262
Signed-off-by: Hauke Mehrtens <[email protected]>
(cherry picked from commit 551e04f3c9c063d885ca7a91db36f27f684a3a5c)
Shiji Yang 1 рік тому
батько
коміт
8b5f3ee940
1 змінених файлів з 1 додано та 1 видалено
  1. 1 1
      package/base-files/files/lib/functions/system.sh

+ 1 - 1
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"