Skip to content

Commit

Permalink
base-files: strip space and tab characters from ASCII mac address
Browse files Browse the repository at this point in the history
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: openwrt/openwrt#17262
Signed-off-by: Hauke Mehrtens <[email protected]>
  • Loading branch information
DragonBluep authored and hauke committed Jan 4, 2025
1 parent 3410ad2 commit 551e04f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package/base-files/files/lib/functions/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 551e04f

Please sign in to comment.