public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Volker Diels-Grabsch <v@njh.eu>
To: passt-dev@passt.top
Cc: Volker Diels-Grabsch <v@njh.eu>
Subject: [PATCH v5 3/5] Introduce constant MAC_BROADCAST
Date: Thu, 11 Sep 2025 22:19:01 +0200	[thread overview]
Message-ID: <20250911201900.237677-6-v@njh.eu> (raw)
In-Reply-To: <20250911201900.237677-2-v@njh.eu>

Signed-off-by: Volker Diels-Grabsch <v@njh.eu>
---
 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))
 
-- 
@@ -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


  parent reply	other threads:[~2025-09-11 20:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 20:18 [PATCH v5 1/5] Show debug message whenever we learn a new guest MAC address Volker Diels-Grabsch
2025-09-11 20:18 ` [PATCH v5 2/5] Improve clarity of comment Volker Diels-Grabsch
2025-09-11 20:19 ` Volker Diels-Grabsch [this message]
2025-09-11 20:19 ` [PATCH v5 4/5] Fix --no-icmp description and make it imply --no-ndp Volker Diels-Grabsch
2025-09-11 20:19 ` [PATCH v5 5/5] Send an initial ARP and NDP request to resolve the guest IP address Volker Diels-Grabsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250911201900.237677-6-v@njh.eu \
    --to=v@njh.eu \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).