On Thu, Sep 11, 2025 at 10:19:01PM +0200, Volker Diels-Grabsch wrote:
Signed-off-by: Volker Diels-Grabsch
Reviewed-by: David Gibson
--- tap.c | 2 +- util.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tap.c b/tap.c index d4d19eb..ba6d7b4 100644 --- a/tap.c +++ b/tap.c @@ -1511,7 +1511,7 @@ void tap_backend_init(struct ctx *c) * it sends us packets. Until then, use the broadcast address * so that our first packets will have a chance to reach it. */ - memset(&c->guest_mac, 0xff, sizeof(c->guest_mac)); + memcpy(&c->guest_mac, MAC_BROADCAST, sizeof(c->guest_mac)); break; }
diff --git a/util.h b/util.h index 2a8c38f..22eaac5 100644 --- a/util.h +++ b/util.h @@ -97,6 +97,8 @@ void abort_with_msg(const char *fmt, ...) #define FD_PROTO(x, proto) \ (IN_INTERVAL(c->proto.fd_min, c->proto.fd_max, (x)))
+#define MAC_BROADCAST \ + ((uint8_t [ETH_ALEN]){ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }) #define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 }) #define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN))
-- 2.47.3
-- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson