Linux USB
 help / color / mirror / Atom feed
* [PATCH] r8152: Set NET_ADDR_STOLEN if using passthru MAC
@ 2024-06-05 15:33 Milan Broz
  2024-06-05 16:39 ` Andrew Lunn
  2024-06-07  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Milan Broz @ 2024-06-05 15:33 UTC (permalink / raw)
  To: linux-usb
  Cc: netdev, davem, edumazet, kuba, pabeni, grundler, dianders,
	hayeswang, hkallweit1, andrew, 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

Signed-off-by: Milan Broz <gmazyland@gmail.com>
---
 drivers/net/usb/r8152.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 19df1cd9f072..ea5c5be4a958 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -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);
 
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] r8152: Set NET_ADDR_STOLEN if using passthru MAC
  2024-06-05 15:33 [PATCH] r8152: Set NET_ADDR_STOLEN if using passthru MAC Milan Broz
@ 2024-06-05 16:39 ` Andrew Lunn
  2024-06-07  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2024-06-05 16:39 UTC (permalink / raw)
  To: Milan Broz
  Cc: linux-usb, netdev, davem, edumazet, kuba, pabeni, grundler,
	dianders, hayeswang, hkallweit1

On Wed, Jun 05, 2024 at 05:33:40PM +0200, Milan Broz 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.
> 
> 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.

> Signed-off-by: Milan Broz <gmazyland@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] r8152: Set NET_ADDR_STOLEN if using passthru MAC
  2024-06-05 15:33 [PATCH] r8152: Set NET_ADDR_STOLEN if using passthru MAC Milan Broz
  2024-06-05 16:39 ` Andrew Lunn
@ 2024-06-07  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-07  1:10 UTC (permalink / raw)
  To: Milan Broz
  Cc: linux-usb, netdev, davem, edumazet, kuba, pabeni, grundler,
	dianders, hayeswang, hkallweit1, andrew

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-07  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 15:33 [PATCH] r8152: Set NET_ADDR_STOLEN if using passthru MAC Milan Broz
2024-06-05 16:39 ` Andrew Lunn
2024-06-07  1:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox