From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com 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 DBF4B5A0274 for ; Fri, 20 Nov 2026 20:24:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795202688; 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=RwCnW1gVX+YEqNuhiNNY14dU0GHG/SAKxCCwbdDo51U=; b=FP9vKmbLAEj6at8udxJ8jSW7DEdAOiqtn2SRpqPMd8+vqvXfJFJS3d0OB53X/AFk4ghG0m 6JcCnY7wOQ+5ukA/fmJhqpx4+6tsgtYHb8R7Z/ZD/GlK7LokmRBM6jgqlmBNY8xgTSOTN8 zb8I11AsIA/GGtz53xfXyeSm2zqhyDM= Received: from mx-prod-mc-06.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-286-cmvktuYzM5yCnjwqEHXE4Q-1; Fri, 20 Nov 2026 19:24:45 +0000 X-MC-Unique: cmvktuYzM5yCnjwqEHXE4Q-1 X-Mimecast-MFC-AGG-ID: cmvktuYzM5yCnjwqEHXE4Q_1795202684 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D3DA2180075A; Fri, 20 Nov 2026 19:24:43 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0F7DC180056E; Fri, 20 Nov 2026 19:24:42 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, david@gibson.dropbear.id.au, jmaloy@redhat.com, passt-dev@passt.top Subject: [PATCH v9 3/5] arp: Check all configured addresses in ARP filtering Date: Fri, 20 Nov 2026 14:24:35 -0500 Message-ID: <20261120192437.1860855-4-jmaloy@redhat.com> In-Reply-To: <20261120192437.1860855-1-jmaloy@redhat.com> References: <20261120192437.1860855-1-jmaloy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1I3zpQBjqgshdOyERSbnb6db5kmmGmG8ddp99oL-9X4_1795202684 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: HJJHYJB5ZUNCHR27LKGL5IG4B55OPN6M X-Message-ID-Hash: HJJHYJB5ZUNCHR27LKGL5IG4B55OPN6M 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. v9: Adapted to changes due to rebase and earlier changes in series --- arp.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/arp.c b/arp.c index 08d5a9f9..74167e44 100644 --- a/arp.c +++ b/arp.c @@ -42,7 +42,7 @@ static bool ignore_arp(const struct ctx *c, const struct arphdr *ah, const struct arpmsg *am) { const struct guest_addr *a; - const struct in_addr *a4; + union inany_addr addr; if (ah->ar_hrd != htons(ARPHRD_ETHER) || ah->ar_pro != htons(ETH_P_IP) || @@ -56,14 +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, true, CONF_ADDR_ANY); - if (!a) - return false; - a4 = inany_v4(&a->addr); - if (a4 && !memcmp(am->tip, a4, 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.56.1