netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Freescale FEC: fall back to random address
@ 2013-03-31 21:06 Pavel Machek
  2013-04-02  8:23 ` Frank Li
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2013-03-31 21:06 UTC (permalink / raw)
  To: kernel list, fabio.estevam, l.stach, Frank.Li, netdev

If there's no valid ethernet address, fall back to randomly generated
one.

(Yes, I need to get newer u-boot for the board, but as the only
available one is from 2009... this might be good idea).

Signed-off-by: Pavel Machek <pavel@denx.de>


index e3f3937..5a7d1e1 100644
pp--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -906,6 +914,16 @@ static void fec_get_mac(struct net_device *ndev)
 		iap = &tmpaddr[0];
 	}
 
+	/*
+	 * 5) random mac address
+	 */
+	if (!is_valid_ether_addr(iap)) {
+		/* Report it and use a random ethernet address instead */
+		netdev_err(ndev, "Invalid MAC address: %pM\n", iap);
+		random_ether_addr(iap);
+		netdev_info(ndev, "Using random MAC address: %pM\n", iap);
+	}
+
 	memcpy(ndev->dev_addr, iap, ETH_ALEN);
 
 	/* Adjust MAC if using macaddr */

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-02 15:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-31 21:06 Freescale FEC: fall back to random address Pavel Machek
2013-04-02  8:23 ` Frank Li
2013-04-02 11:35   ` Pavel Machek
     [not found]     ` <CAHrpEqTdTnRx_htZkFyG2KU5wixdhqmWZ-3R5s=fdedQYc6D9w@mail.gmail.com>
2013-04-02 15:49       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).