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

Christian Lamparter chunkeey at gmail.com
Wed May 29 18:48:06 EDT 2019


On Friday, May 24, 2019 11:27:18 PM CEST Linus Walleij wrote:
> 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.

I think with the get_mac_binary will handle this already...
Question is, should this be backported to openwrt-18.06?
If so, can you please make a patch against it?

Thanks.
> 
> 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
> 





_______________________________________________
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