[OpenWrt-Devel] [PATCH] ipq40xx: add label MAC address for FritzBox 4040

Christian Lamparter chunkeey at gmail.com
Sat Sep 28 12:36:31 EDT 2019


On Monday, September 23, 2019 4:31:38 PM CEST Adrian Schmutzler wrote:
> This adds label MAC address for the AVM FritzBox 4040, the first
> device in ipq40xx target.

I had to look this up a bit more, since my (broken) retail-unit
Fritz!Box 4040 does not have the MAC-Address on the sticker labeled
as "MAC Address" (or something like that).
Instead there is a "CWMP-Account" String/Number which displays the
Address as a "part" of it.

Wouldn't it be better to just go with the "serial number" of the device 
in this case then?

Going deeper: The patch that introduced ucidef_set_label_macaddr describes it as

|commit 469e347f19ce9eefdc16f421b8e1f18ed60c310c
|Author: Adrian Schmutzler <freifunk at adrianschmutzler.de>
|Date:   Thu Aug 15 15:13:27 2019 +0200
|
|    base-files: provide option to specify label MAC address in board.d
|    
|    For many devices, MAC addresses cannot be retrieved via the
|    device tree alias.
| [...]

... This is somewhat strange in the context of the Fritz!Box 4040.
This is because the extra u-boot we use for the Fritz!Box 4040 makes
a real effort to patch the real mac-address into the device tree
before handing it off to the kernel.

https://github.com/chunkeey/FritzBox-4040-UBOOT/blob/master/board/qcom/ipq40xx_cdp/ipq40xx_cdp.c#L455

So, everything should just "click" with this alias added.

	label-mac-device = &gmac0;

Or does it not?

Cheers,
Christian

> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  target/linux/ipq40xx/base-files/etc/board.d/02_network | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
> index e5ba7260f3..082724ebfc 100755
> --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
> @@ -77,6 +77,9 @@ ipq40xx_setup_macs()
>  		wan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006)
>  		lan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
>  		;;
> +	avm,fritzbox-4040)
> +		label_mac=$(cat /sys/class/net/eth0/address)
> +		;;
>  	engenius,ens620ext)
>  		wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
>  		lan_mac=$(macaddr_add "$wan_mac" 1)
> @@ -89,6 +92,7 @@ ipq40xx_setup_macs()
>  
>  	[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
>  	[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
> +	[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
>  }
>  
>  board_config_update
> 





_______________________________________________
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