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=Krp3moDe; 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 872F85A0262 for ; Mon, 13 Apr 2026 02:53:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776041609; 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=qw8QpoCN6ZApq9l4iX64H9J9qzij2kww2OZ3x0NCE9E=; b=Krp3moDePe444AEkYrKwWGt+yNpgl6qgW4EhI3JS76gcJ80YmZX0moxgyKRy3LNUug2/g9 ZO+F/SVoTJAEUuMS0iFAkOIIETMVR53rSo7GxGS5Vekoeuvzgylj9IXO5aMdw1Ro/5Z3yk lud5fI9kVnGGpWoMOTEsvKd6VQ+xPXE= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-67-FMcwJLMUOxqE-H1YHQZeow-1; Sun, 12 Apr 2026 20:53:27 -0400 X-MC-Unique: FMcwJLMUOxqE-H1YHQZeow-1 X-Mimecast-MFC-AGG-ID: FMcwJLMUOxqE-H1YHQZeow_1776041606 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 10F0419560B2; Mon, 13 Apr 2026 00:53:26 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.rmtcaqc.csb (unknown [10.22.64.70]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 525CA30001A1; Mon, 13 Apr 2026 00:53:25 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, david@gibson.dropbear.id.au, jmaloy@redhat.com, passt-dev@passt.top Subject: [PATCH v7 04/13] arp: Check all configured addresses in ARP filtering Date: Sun, 12 Apr 2026 20:53:10 -0400 Message-ID: <20260413005319.3295910-5-jmaloy@redhat.com> In-Reply-To: <20260413005319.3295910-1-jmaloy@redhat.com> References: <20260413005319.3295910-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: rDts7u0W_KfIlHbDMWQyYdl462uY82SonKkbdcankhw_1776041606 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: AK556EPOMDDCJDJSYTQ2U64SRH3GKSEL X-Message-ID-Hash: AK556EPOMDDCJDJSYTQ2U64SRH3GKSEL 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: As a preparation for handling multiple addresses, we update ignore_arp() to check against all addresses in the unified addrs[] array using the for_each_addr() macro. Signed-off-by: Jon Maloy Reviewed-by: David Gibson --- v3: -Adapted to single-array changes earlier in this series v6: -Made loop in ignore_arp() a little more palatable, but not entirely as suggested by David. v7: -Curly brackets in ignore_arp(), as suggested by Stefano. -I did not modify the for_each_addr(), macro, as Stefano suggested, since it also would require us to add an extra parameter indicating the array length. --- arp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arp.c b/arp.c index a7fd82f..a3fdeb6 100644 --- a/arp.c +++ b/arp.c @@ -42,6 +42,7 @@ static bool ignore_arp(const struct ctx *c, const struct arphdr *ah, const struct arpmsg *am) { const struct guest_addr *a; + union inany_addr addr; if (ah->ar_hrd != htons(ARPHRD_ETHER) || ah->ar_pro != htons(ETH_P_IP) || @@ -55,11 +56,12 @@ 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. */ - a = fwd_get_addr(c, AF_INET, 0, 0); - if (a && !memcmp(am->tip, inany_v4(&a->addr), sizeof(am->tip))) - return true; - + /* Don't resolve any of the guest's addresses */ + inany_from_af(&addr, AF_INET, am->tip); + for_each_addr(a, c->addrs, c->addr_count, AF_INET) { + if (inany_equals(&addr, &a->addr)) + return true; + } return false; } -- 2.52.0