提交 ff5b2fab 编写于 作者: L Lucas Stach 提交者: David S. Miller

net: fec: add fallback to random MAC address

If no valid MAC address could be obtained from the hardware,
fall back to a randomly generated one.
Signed-off-by: NPavel Machek <pavel@denx.de>
Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e768fb29
......@@ -1038,6 +1038,18 @@ 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);
eth_hw_addr_random(ndev);
netdev_info(ndev, "Using random MAC address: %pM\n",
ndev->dev_addr);
return;
}
memcpy(ndev->dev_addr, iap, ETH_ALEN);
/* Adjust MAC if using macaddr */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册