[U-Boot] [PATCH] net: use random ethernet address if invalid and not zero

James Chargin jimccrown at gmail.com
Wed Nov 2 14:21:54 CET 2016


Hi,

Regarding "invalid" Ethernet address.

Is there a reliable way to set the default environment that will prevent 
Ethernet communications from being attempted.

That is, when an Ethernet capable system is brand new and before an 
Ethernet MAC address has been assigned to that system during 
manufacturing with the "setenv ethaddr" command, how can Ethernet comms 
be disabled?

This would be a fail-safe to make sure that part of the manufacturing 
process is done correctly and that an Ethernet address is intentionally 
assigned.

Thanks,
Jim

On 11/02/2016 04:52 AM, Michal Simek wrote:
> From: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>
>
> Use random ethernet address if the ethernet address found
> is invalid, not zero and config for random address
> is defined.
>
> Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
>
>  net/eth-uclass.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> index a32961e6ceaa..1d130110890e 100644
> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
> @@ -512,7 +512,8 @@ static int eth_post_probe(struct udevice *dev)
>  		eth_setenv_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
>  		printf("\nWarning: %s using MAC address from ROM\n",
>  		       dev->name);
> -	} else if (is_zero_ethaddr(pdata->enetaddr)) {
> +	} else if (is_zero_ethaddr(pdata->enetaddr) ||
> +		   !is_valid_ethaddr(pdata->enetaddr)) {
>  #ifdef CONFIG_NET_RANDOM_ETHADDR
>  		net_random_ethaddr(pdata->enetaddr);
>  		printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
>

-- 
Jim Chargin
AJA Video Systems                       jimc at aja.com
(530) 271-3334                          http://www.aja.com


More information about the U-Boot mailing list