From 111a6aa4a97630e5dc4143bdab80c67b3c731e32 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 27 Jul 2015 13:37:07 +0200 Subject: [PATCH] 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 --- net/eth.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/eth.c b/net/eth.c index 0c1ff73e4..fd9447a82 100644 --- a/net/eth.c +++ b/net/eth.c @@ -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);