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=Cr0f3qDn; 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 EF16A5A0271 for ; Tue, 05 Aug 2025 22:01:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754424065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WCsDdmTVfBxpQxVvK2nLHz/vk0a6mTCWUxbKZKIHPdI=; b=Cr0f3qDnUG23Wdq9+Y9bs+rqj4lMXzOdVSIdb3Y0o0e+VtI/0wdJ1nUZIpnAkrSDXTRNqR PEWcifu5WCMv3jqScCHmtBHlFZHs8xgVUonn4mZuN21kXbhbvCl0MxzywAEoU7R+BVCBL8 mg6+/cw3YZSLhWXGWfKhEaB6AqJ+c3Y= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-166-R3E5Hr3kPu-VI0686Lq5GQ-1; Tue, 05 Aug 2025 16:01:04 -0400 X-MC-Unique: R3E5Hr3kPu-VI0686Lq5GQ-1 X-Mimecast-MFC-AGG-ID: R3E5Hr3kPu-VI0686Lq5GQ_1754424064 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-70771983a52so112800776d6.2 for ; Tue, 05 Aug 2025 13:01:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754424064; x=1755028864; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WCsDdmTVfBxpQxVvK2nLHz/vk0a6mTCWUxbKZKIHPdI=; b=Qa6gSsuKhVBpMpHW6FiNo9ECFxXqLg86pPvJsCUWl3PLezCF/R7Kbb6v8STD2x8B9Y 7LQ2qn4p85vYwOiflbXyg6VP5XymDtlFh0rYnmPU9TD5PC2m7Vuy7t8tYO4pnO3yKyeo m34Z14dfuD6R++4xmVg4dAtdXgi71DIevmr0mFUEk4PplK6Qg5eFi/G9eC0pCpmGpEr/ a6XcNoBLkUTJs1lIFA+sWjy3r1Xy78Wp5qp17CMYJd9kwk7oUKxlOHLK4AKLVgdigsSY oothXMPWCMprOShBVbbnhxZxL+5ubnWlogUpBGhyIca/HtFuqS5EDYHcjaXY2CsFWsrb OZMA== X-Forwarded-Encrypted: i=1; AJvYcCUllXLlmS2pseVssbdpitLpEMJg6983qpaKn2vZvGn1g3HebYoCcP5iyGSSIEq1Msd/GLhrxDCeypY=@passt.top X-Gm-Message-State: AOJu0YwpFekwu7cq4rSHS7+FhinW4HReAfFZeEtXEAzdArMWXvRF1M8F Acxz5Ms+r1T5moc/9Ee98nkcxp8eMHOLZ+V0DCiBK/c28ENBQgmJCm9Gptg9h3MUm8HBQpHFSOO 14Y+2atfigRvqDXndd8i+3ezy9U10KgsnQtHWHOtzWRIEMGEFe8sDoq36vPcqFKMu X-Gm-Gg: ASbGnctWgc33vs1csrjqgqv404oBVRMmoSAy8VYOpcwF8TCQG380g3pV4EgCsIXVEqN wp7hSqQnv+ZJ4W2kRpr5Im5MWU8qU6aBJBwcj4INY1mCSXJrWCLwCNCO61PPoY8aOY/d4IrYwgO iaStoS2Bv08WP1FWWbWmw2yJMHFaLRSel6PpcsCM8O+UubbpnQGV35OljglGwcrGH9mrRimEmQL x6sz/yNuI88orew/plRT71RQvW02rwLy5DB1NYuvreoxAWkhJMMNAi1aCyl29p0CxZfdWau6Xux 5vxdKOc15EplQ6+/QvBsq806MNq6q+Ebki62f2ayRmVPoDmI6ZsiA8IdALZp5+Wq0BTRK4iJ8lV T4LJ2GTw= X-Received: by 2002:a05:6214:21ae:b0:709:349d:14b3 with SMTP id 6a1803df08f44-709796805b6mr7832856d6.47.1754424061592; Tue, 05 Aug 2025 13:01:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG83c7sDuDHdkSN1Zexd0nzPWLVSG1ImxYEkSxUlGFZ8QpcCUDiGCp96brWfJIpkN+mNTF2CA== X-Received: by 2002:a05:6214:21ae:b0:709:349d:14b3 with SMTP id 6a1803df08f44-709796805b6mr7825206d6.47.1754424055082; Tue, 05 Aug 2025 13:00:55 -0700 (PDT) Received: from ?IPV6:2001:4958:236b:9301:2d53:afdf:4ab:b9e9? ([2001:4958:236b:9301:2d53:afdf:4ab:b9e9]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-7077cd710a1sm75672226d6.56.2025.08.05.13.00.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Aug 2025 13:00:54 -0700 (PDT) Message-ID: Date: Tue, 5 Aug 2025 16:00:53 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/8] arp/ndp: respond with true MAC address of LAN local remote hosts To: David Gibson References: <20250629171348.86323-1-jmaloy@redhat.com> <20250629171348.86323-3-jmaloy@redhat.com> From: Jon Maloy In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pa-uoiLkXGshDh4Wl52HsWkhjkfCKRkR3BKlN1T8UVg_1754424064 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: IJNRTBQK2YSGSUHJ6O3AXCXK5HELFOTY X-Message-ID-Hash: IJNRTBQK2YSGSUHJ6O3AXCXK5HELFOTY 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 CC: sbrivio@redhat.com, dgibson@redhat.com, passt-dev@passt.top 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: On 2025-07-21 21:55, David Gibson wrote: > On Sun, Jun 29, 2025 at 01:13:41PM -0400, Jon Maloy wrote: >> When we receive an ARP request or NDP neigbor solicitation over >> the tap interface for a host on the local network segment attached >> to the template interface, we respond with that host's real MAC >> address. >> >> The local host, which is acting as a proxy for the default gateway, >> is still exempted from this rule. >> >> Signed-off-by: Jon Maloy >> >> --- >> v3: - Added helper function to find out if a remote ip address is subject >> to NAT. This filters out local host addresses which should be >> presented with the passt/pasta local MAC address 9a:55:9a:55:9a:55 even >> though it is on the local segment. >> - Adapted to the change in nl_mac_get() function, so that we now consider >> only the template interface when checking the ARP/NDP table. >> --- >> arp.c | 9 +++++++++ >> fwd.c | 2 +- >> fwd.h | 3 ++- >> inany.c | 15 +++++++++++++++ >> inany.h | 1 + >> ndp.c | 9 +++++++++ >> 6 files changed, 37 insertions(+), 2 deletions(-) >> >> diff --git a/arp.c b/arp.c >> index fc482bb..1952a63 100644 >> --- a/arp.c >> +++ b/arp.c >> @@ -29,6 +29,7 @@ >> #include "dhcp.h" >> #include "passt.h" >> #include "tap.h" >> +#include "netlink.h" >> >> /** >> * arp() - Check if this is a supported ARP message, reply as needed >> @@ -40,6 +41,7 @@ >> int arp(const struct ctx *c, const struct pool *p) >> { >> unsigned char swap[4]; >> + union inany_addr tgt; >> struct ethhdr *eh; >> struct arphdr *ah; >> struct arpmsg *am; >> @@ -72,6 +74,13 @@ int arp(const struct ctx *c, const struct pool *p) >> memcpy(am->tha, am->sha, sizeof(am->tha)); >> memcpy(am->sha, c->our_tap_mac, sizeof(am->sha)); >> >> + /* Respond with true MAC address if remote host is on >> + * the template interface's network segment >> + */ >> + inany_from_af(&tgt, AF_INET, am->tip); >> + if (!inany_nat(c, &tgt)) >> + nl_mac_get(nl_sock, &tgt, c->ifi4, am->sha); >> + > > Hmm. Here's one concern about the overall concept here. If neither > the guest nor the host has contacted this neighbour before, it > probably won't be in the host's arp/neighbour table so this lookup > will fail, and we'll use our_tap_mac. The guest then contacts it, so > the host ARPs it. When the guest's ARP times out, it re-ARPs and this > time gets the actual MAC address. i.e. it seems to me this approach > may substantially increase the odds of the guest seeing a peer change > MAC. Not sure if that's a problem. I notice this recurring concern from you, but I see no suggestion for how to handle it. Could I try to trigger a host ARP call, e.g., by sending a preceding ping when certain conditions are fulfilled, or are you saying the series is meaningless? /jon