diff options
author | John Crispin <blogic@openwrt.org> | 2015-01-28 12:06:22 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2015-01-28 12:06:22 +0000 |
commit | 3e6b801eb487cf2339f779e69222540f37d7d821 (patch) | |
tree | 432d4485d8a682ef3dd43e9799d92078abf1aa88 /target/linux/ramips/files/drivers | |
parent | 27fe727852549ecdc9755990826a08a01ecc3522 (diff) | |
download | upstream-3e6b801eb487cf2339f779e69222540f37d7d821.tar.gz upstream-3e6b801eb487cf2339f779e69222540f37d7d821.tar.bz2 upstream-3e6b801eb487cf2339f779e69222540f37d7d821.zip |
ralink: check ethernet MAC address whether it is valid
The mac address usually write in factory block. but sometime user erase this block , the mac address will change to ff:ff:ff:ff:ff:ff.
This patch is purpose to fix this issue.
Signed-off-by: wengbj <linux.c@foxmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44166 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/files/drivers')
-rw-r--r-- | target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c index d7d1e8efc9..9900a5e508 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c @@ -1220,8 +1220,10 @@ static int __init fe_init(struct net_device *dev) if (priv->soc->switch_init) priv->soc->switch_init(priv); - memcpy(dev->dev_addr, priv->soc->mac, ETH_ALEN); of_get_mac_address_mtd(priv->device->of_node, dev->dev_addr); + /*If the mac address is invalid, use default mac address */ + if (!is_valid_ether_addr(dev->dev_addr)) + memcpy(dev->dev_addr, priv->soc->mac, ETH_ALEN); err = fe_mdio_init(priv); if (err) |