From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=njh.eu Received: from mail.notjusthosting.com (mail.notjusthosting.com [IPv6:2a01:4f8:a0:516f:1::1]) by passt.top (Postfix) with ESMTPS id 486FF5A0271 for ; Thu, 11 Sep 2025 22:19:54 +0200 (CEST) Received: from echelon-telekom.c-base.org ([80.147.140.51] helo=vlap) by mail.notjusthosting.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1uwnlp-0006Oh-Qu; Thu, 11 Sep 2025 22:19:53 +0200 From: Volker Diels-Grabsch To: passt-dev@passt.top Subject: [PATCH v5 3/5] Introduce constant MAC_BROADCAST Date: Thu, 11 Sep 2025 22:19:01 +0200 Message-ID: <20250911201900.237677-6-v@njh.eu> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250911201900.237677-2-v@njh.eu> References: <20250911201900.237677-2-v@njh.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: XFPMSUGV2UAY5RO5IDSQ3ESZUSYEZMMK X-Message-ID-Hash: XFPMSUGV2UAY5RO5IDSQ3ESZUSYEZMMK X-MailFrom: v@njh.eu X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Volker Diels-Grabsch X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Volker Diels-Grabsch --- 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