summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-07-27 13:37:07 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-07-28 08:00:03 +0200
commit65681ac20165ae709c52bda26ed9c32f4aeff0dd (patch)
tree42fb8b5ade29f756f233eba7330df2fbf64becd7 /net
parent3148c20faa37af676e8b75b89c84c302c380813e (diff)
downloadbarebox-65681ac20165ae709c52bda26ed9c32f4aeff0dd.tar.gz
barebox-65681ac20165ae709c52bda26ed9c32f4aeff0dd.tar.xz
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>
Diffstat (limited to 'net')
-rw-r--r--net/eth.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/eth.c b/net/eth.c
index a090961bca..c381ebd75a 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -100,9 +100,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);