]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: use random ethernet address if invalid and not zero
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Wed, 2 Nov 2016 10:41:01 +0000 (16:11 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 3 Nov 2016 07:41:09 +0000 (08:41 +0100)
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@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net/eth-uclass.c

index c15cc4d90bf47dffacdd1339077340b0c99dd36a..ce01277ee80662bc4fa15a869a1099bd257611d0 100644 (file)
@@ -511,7 +511,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",