Author: blogic Date: 2015-01-28 13:06:22 +0100 (Wed, 28 Jan 2015) New Revision: 44166
Modified: trunk/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c Log: 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 <[email protected]> Modified: trunk/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c =================================================================== --- trunk/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c 2015-01-28 12:06:13 UTC (rev 44165) +++ trunk/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c 2015-01-28 12:06:22 UTC (rev 44166) @@ -1220,8 +1220,10 @@ 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) _______________________________________________ openwrt-commits mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits
