summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-11-07 21:22:15 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-08 08:53:47 +0100
commit72f68288a5b44f4b6da36bbc762391550016c632 (patch)
treef9278de7d62d225c763369b84b5efe4bc9ce0961 /net
parent0b8fbb3b4ec3f16561a4a962e164abd13d9a421e (diff)
downloadbarebox-72f68288a5b44f4b6da36bbc762391550016c632.tar.gz
barebox-72f68288a5b44f4b6da36bbc762391550016c632.tar.xz
net: only use ethaddrs registered with device node on that device
If an ethaddr is registered with a device node the ethid is set to 0 via the struct initialization. Now if a device without a node (for eaxample a USB network adapter) with ethid 0 looks up the ethaddr it will wrongly get that address assigned, as the ethid matches. Avoid this by setting the ethid to something that no device will ever use when the addr is registered via a device node. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r--net/eth.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/eth.c b/net/eth.c
index 9dc4411952..badd183433 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -150,6 +150,7 @@ void of_eth_register_ethaddr(struct device_node *node, const char *ethaddr)
addr = xzalloc(sizeof(*addr));
addr->node = node;
+ addr->ethid = -1;
memcpy(addr->ethaddr, ethaddr, ETH_ALEN);
list_add_tail(&addr->list, &ethaddr_list);
}