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=cMgK+2/k; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 805625A0274 for ; Fri, 26 Jun 2026 04:45:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782441930; 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=OZv4hu6P3lgbMLk6+UA+Q8q59OwqO3jItj4k7KE/wfc=; b=cMgK+2/k9z3XCDf4FROBUMd0SGXGIy0hMg3e2DtnoUB1jhpYS6/wxIXkYYp5fqYeSWlAd+ F1ov8yXvsnwDIZa7/rU3DMUq4F1IXn+b/3WjX57ZBxOzGcPgS3AJie/yS9o0NtFu/vCca3 sOydJWo0DkPqziHa7t13VIzaL1t7EaQ= 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-610-nKcwTCawMxqcEn13vmHAJw-1; Thu, 25 Jun 2026 22:45:29 -0400 X-MC-Unique: nKcwTCawMxqcEn13vmHAJw-1 X-Mimecast-MFC-AGG-ID: nKcwTCawMxqcEn13vmHAJw_1782441928 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 0FCEC1802660; Fri, 26 Jun 2026 02:45:28 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.rmtcaqc.csb (unknown [10.22.88.44]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D55551956087; Fri, 26 Jun 2026 02:45:26 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, david@gibson.dropbear.id.au, jmaloy@redhat.com, passt-dev@passt.top Subject: [PATCH v8 05/14] arp: Check all configured addresses in ARP filtering Date: Thu, 25 Jun 2026 22:45:10 -0400 Message-ID: <20260626024519.3701556-6-jmaloy@redhat.com> In-Reply-To: <20260626024519.3701556-1-jmaloy@redhat.com> References: <20260626024519.3701556-1-jmaloy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: S_-BuazZ7s5uZlVB8niUYii5tGJA43YjlZEbrtriUjE_1782441928 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: QYUJ3U3PEXD56CD3Q4WQMHSTOKUW6VL7 X-Message-ID-Hash: QYUJ3U3PEXD56CD3Q4WQMHSTOKUW6VL7 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 0392861d..364c105a 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, CONF_ADDR_ANY, 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