Skip to contentSkip to conversation

r8152: Set NET_ADDR_STOLEN if using passthru MAC

PATCH Applied Milan Broz 3 participants 3 messages Jun 5, 2024 – Jun 7, 2024

Subsystems (4)
lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 r8152: Set NET_ADDR_STOLEN if using passthru MAC

Some docks support MAC pass-through - MAC address
is taken from another device.

Driver should indicate that with NET_ADDR_STOLEN flag.

This should help to avoid collisions if network interface names are generated with MAC policy.

Reported and discussed here
https://github.com/systemd/systemd/issues/33104

---
 drivers/net/usb/r8152.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/usb/r8152.c +1 -0
index 19df1cd9f072..ea5c5be4a958 100644
@@ -1774,6 +1774,7 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
 		goto amacout;
 	}
 	memcpy(sa->sa_data, buf, 6);
+	tp->netdev->addr_assign_type = NET_ADDR_STOLEN;
 	netif_info(tp, probe, tp->netdev,
 		   "Using pass-thru MAC addr %pM\n", sa->sa_data);
 
Signature · 1 line
2.45.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Milan Broz

Some docks support MAC pass-through - MAC address
is taken from another device.

Driver should indicate that with NET_ADDR_STOLEN flag.

This should help to avoid collisions if network interface names are generated with MAC policy.

Reported and discussed here
https://github.com/systemd/systemd/issues/33104

MAC pass-through is broken, and expected to cause problems. We strongly push back on any patches trying to add more instances of it.

Ideally it needs to be done in user space where you have full access to the tree of devices, can determine if the device getting the MAC address really is in a dock, is the first dock in a chain of docks, and not a USB dongle etc.

Using NET_ADDR_STOLEN is interesting. It is currently used in bonding, when the bond device takes the MAC address from one of its slaves. It is also used with VLAN interfaces, which inherit the MAC address of the base interface. There is a clear relationship between the two interfaces using the same MAC address. However in the pass through case, the interfaces are unrelated.

However, the code says:

#define NET_ADDR_STOLEN 2 /* address is stolen from other device */

which is exactly what is happening here.

Quoted 1 line

Andrew

#2 lore raw
In reply to Milan Broz
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 5 Jun 2024 17:33:40 +0200 you wrote:

Some docks support MAC pass-through - MAC address
is taken from another device.

Driver should indicate that with NET_ADDR_STOLEN flag.

This should help to avoid collisions if network interface names are generated with MAC policy.

[...]

Here is the summary with links:
- r8152: Set NET_ADDR_STOLEN if using passthru MAC

    https://git.kernel.org/netdev/net-next/c/cb6cf0820f22

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html