[OpenWrt-Devel] [PATCH] base-files: fix get_mac_address not accepting hex offsets

David Bauer mail at david-bauer.net
Wed Sep 4 15:19:29 EDT 2019


The get_mac_address helper methods did not support hexadecimal offset
values, resulting them to break after 75bfc393ba6c ("treewide:
convert MAC address location offsets to hexadecimal")

This commit fixes this by evaluating the hexadecimal input,
converting them to decimal.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 package/base-files/files/lib/functions/system.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh
index 9b9d03df7b..4a97b27f5a 100644
--- a/package/base-files/files/lib/functions/system.sh
+++ b/package/base-files/files/lib/functions/system.sh
@@ -2,7 +2,7 @@
 
 get_mac_binary() {
 	local path="$1"
-	local offset="$2"
+	local offset=$(($2))
 
 	if ! [ -e "$path" ]; then
 		echo "get_mac_binary: file $path not found!" >&2
@@ -40,7 +40,7 @@ mtd_get_mac_ascii() {
 
 mtd_get_mac_text() {
 	local mtdname=$1
-	local offset=$2
+	local offset=$(($2))
 	local part
 	local mac_dirty
 
@@ -63,7 +63,7 @@ mtd_get_mac_text() {
 
 mtd_get_mac_binary() {
 	local mtdname="$1"
-	local offset="$2"
+	local offset=$(($2))
 	local part
 
 	part=$(find_mtd_part "$mtdname")
@@ -72,7 +72,7 @@ mtd_get_mac_binary() {
 
 mtd_get_mac_binary_ubi() {
 	local mtdname="$1"
-	local offset="$2"
+	local offset=$(($2))
 
 	. /lib/upgrade/nand.sh
 
-- 
2.23.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list