[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51AC7F06.5070805@cogentembedded.com>
Date: Mon, 03 Jun 2013 15:33:26 +0400
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Lucas Stach <l.stach@...gutronix.de>
CC: netdev@...r.kernel.org, davem@...emloft.net,
Pavel Machek <pavel@...x.de>
Subject: Re: [PATCHv2 net-next] net: fec: add fallback to random MAC address
On 03-06-2013 15:30, I wrote:
>> If no valid MAC address could be obtained from the hardware,
>> fall back to a randomly generated one.
>> Signed-off-by: Pavel Machek <pavel@...x.de>
>> Signed-off-by: Lucas Stach <l.stach@...gutronix.de>
>> ---
>> drivers/net/ethernet/freescale/fec_main.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c
>> index 927f4c6..0063761 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -1039,6 +1039,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);
> This was you'll copy an invalid address over the random one again.
Oh, sorry, have overlooked *return*... :-<
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists