qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/usb/network: Remove hardcoded 0x40 prefix
@ 2025-05-06 16:45 Stéphane Graber via
  2025-05-07  8:45 ` Daniel P. Berrangé
  0 siblings, 1 reply; 5+ messages in thread
From: Stéphane Graber via @ 2025-05-06 16:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stéphane Graber

USB NICs have a "40:" prefix hardcoded for all MAC addresses.

This overrides user-provided configuration and leads to an inconsistent
experience.

I couldn't find any documented reason (comment or git commits) for this
behavior. It seems like everyone is just expecting the MAC address to be
fully passed through to the guest, but it isn't.

This is also particularly problematic as the "40:" prefix isn't a
reserved prefix for MAC addresses (IEEE OUI). There are a number of
valid allocations out there which use this prefix, meaning that QEMU may
be causing MAC address conflicts.

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2951
---
 hw/usb/dev-network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index 81cc09dcac..1df2454181 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -1383,7 +1383,7 @@ static void usb_net_realize(USBDevice *dev, Error **errp)
     qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
     snprintf(s->usbstring_mac, sizeof(s->usbstring_mac),
              "%02x%02x%02x%02x%02x%02x",
-             0x40,
+             s->conf.macaddr.a[0],
              s->conf.macaddr.a[1],
              s->conf.macaddr.a[2],
              s->conf.macaddr.a[3],
-- 
2.47.2



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

end of thread, other threads:[~2025-09-01 17:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 16:45 [PATCH] hw/usb/network: Remove hardcoded 0x40 prefix Stéphane Graber via
2025-05-07  8:45 ` Daniel P. Berrangé
2025-05-12 14:10   ` Peter Maydell
2025-09-01 16:11     ` Peter Maydell
2025-09-01 17:07       ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).