From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ups/cZhm; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 783205A065D for ; Mon, 15 Dec 2025 02:54:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765763696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YGIcuO/0L8TArUhnczchZ/ffYNKmCa7qGxE0HPmL/pE=; b=Ups/cZhmrASrhLnRbtaYVSGJfM3Ij72UYyYs5VNNX39gpax0td7R6rp0QYSNHEINutcJp6 7YybwINdkeTrBnObq12Kfhomn+ycjreJQg4wiubVPXpjwV6pcsHP8lqMOGZN8n/PmmHzOg Tz5IV2LpRNN95aW5ovHq7UvPfaiDd3I= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-_oslBUZzPW-3M4axMLCsKw-1; Sun, 14 Dec 2025 20:54:52 -0500 X-MC-Unique: _oslBUZzPW-3M4axMLCsKw-1 X-Mimecast-MFC-AGG-ID: _oslBUZzPW-3M4axMLCsKw_1765763691 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B8A6718002C9; Mon, 15 Dec 2025 01:54:51 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.rmtcaqc.csb (unknown [10.22.88.123]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7558730001A2; Mon, 15 Dec 2025 01:54:50 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, dgibson@redhat.com, david@gibson.dropbear.id.au, jmaloy@redhat.com, passt-dev@passt.top Subject: [RFC 06/12] arp: Check all configured addresses in ARP filtering Date: Sun, 14 Dec 2025 20:54:35 -0500 Message-ID: <20251215015441.887736-7-jmaloy@redhat.com> In-Reply-To: <20251215015441.887736-1-jmaloy@redhat.com> References: <20251215015441.887736-1-jmaloy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: wgTV7Dvtjl9Q5X5hu79xbEjblfpcfHS8TgZzE2vU_OA_1765763691 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: L32XGQK6Q7UIDHEG2D5P2F2XGDSMSZNK X-Message-ID-Hash: L32XGQK6Q7UIDHEG2D5P2F2XGDSMSZNK X-MailFrom: jmaloy@redhat.com 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 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: We update ignore_arp() to check against all addresses in the addrs[] array, not just addrs[0]. This ensures ARP requests for any of the guest's configured addresses are properly ignored. Signed-off-by: Jon Maloy --- arp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arp.c b/arp.c index 7eaf517..61c309e 100644 --- a/arp.c +++ b/arp.c @@ -41,6 +41,8 @@ static bool ignore_arp(const struct ctx *c, const struct arphdr *ah, const struct arpmsg *am) { + int i; + if (ah->ar_hrd != htons(ARPHRD_ETHER) || ah->ar_pro != htons(ETH_P_IP) || ah->ar_hln != ETH_ALEN || @@ -53,9 +55,10 @@ static bool ignore_arp(const struct ctx *c, !memcmp(am->sip, am->tip, sizeof(am->sip))) return true; - /* Don't resolve the guest's assigned address, either. */ - if (!memcmp(am->tip, &c->ip4.addrs[0].addr, sizeof(am->tip))) - return true; + /* Don't resolve any of the guest's assigned addresses, either */ + for (i = 0; i < c->ip4.addr_count; i++) + if (!memcmp(am->tip, &c->ip4.addrs[i].addr, sizeof(am->tip))) + return true; return false; } -- 2.51.1