9
0
Fork 0

net: make eth_register_ethaddr work on registered network devices

When eth_register_ethaddr is called after the device has been registered
it should work aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2015-07-27 13:37:07 +02:00 committed by Jan Luebbe
parent 8d95a37cae
commit 111a6aa4a9
1 changed files with 8 additions and 0 deletions

View File

@ -88,9 +88,17 @@ static void eth_drop_ethaddr(int ethid)
void eth_register_ethaddr(int ethid, const char *ethaddr)
{
struct eth_ethaddr *addr;
struct eth_device *edev;
eth_drop_ethaddr(ethid);
list_for_each_entry(edev, &netdev_list, list) {
if (edev->dev.id == ethid) {
register_preset_mac_address(edev, ethaddr);
return;
}
}
addr = xzalloc(sizeof(*addr));
addr->ethid = ethid;
memcpy(addr->ethaddr, ethaddr, 6);