diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2018-11-07 21:22:15 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-11-08 08:53:47 +0100 |
commit | 72f68288a5b44f4b6da36bbc762391550016c632 (patch) | |
tree | f9278de7d62d225c763369b84b5efe4bc9ce0961 /net | |
parent | 0b8fbb3b4ec3f16561a4a962e164abd13d9a421e (diff) | |
download | barebox-72f68288a5b44f4b6da36bbc762391550016c632.tar.gz |
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.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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, ðaddr_list); } |