diff options
| author | Shiji Yang | 2024-12-16 07:09:50 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2025-01-04 18:25:34 +0000 |
| commit | 8b5f3ee940793be326aa1c3398c9fe017f18e73a (patch) | |
| tree | 08ef3c1dc935c8eecac818daebe10d44b322ee38 | |
| parent | 676dfd1363fbfc1b92331aa293672f8af9770a02 (diff) | |
| download | openwrt-8b5f3ee940793be326aa1c3398c9fe017f18e73a.tar.gz | |
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 <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/17262
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 551e04f3c9c063d885ca7a91db36f27f684a3a5c)
| -rw-r--r-- | package/base-files/files/lib/functions/system.sh | 2 |
1 files changed, 1 insertions, 1 deletions
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" |