diff options
| author | Shiji Yang | 2024-12-16 07:09:50 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2025-01-04 15:20:46 +0000 |
| commit | 551e04f3c9c063d885ca7a91db36f27f684a3a5c (patch) | |
| tree | 0fd88f7bedfc250cdb47327913c61071980fa125 | |
| parent | 3410ad2f40c085e5db7a71f6ae4b80734826a1e3 (diff) | |
| download | openwrt-551e04f3c9c063d885ca7a91db36f27f684a3a5c.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>
| -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" |