[OpenWrt-Devel] [PATCH 2/3] gemini: Fix possible hexdump error on MAC assignment

Linus Walleij linus.walleij at linaro.org
Fri May 24 17:27:18 EDT 2019


If a MAC address is for example 00:50:c2:11:11:11 using
hexdump to extract this from raw bytes in the flash will
yield "00:50:c2:11*" with the asterisk indicating "more
of the same".

This will inhibit the MAC address from being assigned
correctly, so fix it by passing -v to hexdump.

Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
 .../linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini b/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
index ebd3ae0f55c5..6072e828c678 100644
--- a/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
+++ b/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
@@ -12,7 +12,7 @@ set_ether_mac() {
 		if [ ! -z $CONFIG_PARTITION ] ; then
 			DEVID="$(dd if=/dev/mtdblock0 bs=1 skip=119508 count=7 2>/dev/null)"
 			if [ "x$DEVID" = "xdns-313" ] ; then
-				MAC1="$(dd if=/dev/mtdblock0 bs=1 skip=119540 count=6 2>/dev/null | hexdump -n6 -e '/1 ":%02X"' | sed s/^://g)"
+				MAC1="$(dd if=/dev/mtdblock0 bs=1 skip=119540 count=6 2>/dev/null | hexdump -n6 -v -e '/1 ":%02X"' | sed s/^://g)"
 				ifconfig eth0 hw ether $MAC1 2>/dev/null
 				return 0
 			fi
-- 
2.20.1


_______________________________________________
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