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=LEJVIJeJ; 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 143905A028E for ; Thu, 12 Jun 2025 17:18:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749741483; 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=dVu3xEc1ulNd4fHRzeGIPKxQ0IXq8gt9EjEYF/g3yQI=; b=LEJVIJeJO8Nug0L5ywJUDrtm20fdxD7JDBYuj2UNSMnv2az27b2An24UrjsEwv/p2VUotx Z1g7T1ZTi8+jMRF3eoXouyQSYOE5oY5iG0nbCqFW3xJ4WVqFusQtb+RChEUdNfXE9c1eW6 EnehdtYMx75NacIBFaHWFSiZO5+iZD4= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-CZRSOGbAOpGQaaLX7Z2s5g-1; Thu, 12 Jun 2025 11:18:02 -0400 X-MC-Unique: CZRSOGbAOpGQaaLX7Z2s5g-1 X-Mimecast-MFC-AGG-ID: CZRSOGbAOpGQaaLX7Z2s5g_1749741482 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-451dda846a0so8359705e9.2 for ; Thu, 12 Jun 2025 08:18:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749741481; x=1750346281; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dVu3xEc1ulNd4fHRzeGIPKxQ0IXq8gt9EjEYF/g3yQI=; b=TfY96m5EC5NWenAfFbHcyXJhuNZtNcG+JO+yxEQFDsX63MnVXtwbS6i/mbD7NcVUUp j3N71s2ZOAVwqaabofWjkkKvYf4+FLT6n2XdLrHqTh/UIogdB1qAP98S1jS5URp7BgKV csWyWUU0mkU7mUHce6KLk1HEKoybhK56H20UaUda7OEGwfuzLXQNjXFYSFiaTuLRbGqx qveQEqectnooX+uZ/IlJHm8xk2Fp4MMOOMCQdcfV/mlx/uS/y20fexEJu7oVz919Lvxy RVuJxRf2G2f2FG7wljvBNQAYRjXBn8nNUL/bjhwoKVV4qqNmtOHXNMSdYRbyDIZ2IqzN 3DEw== X-Forwarded-Encrypted: i=1; AJvYcCWtCiIyeYCtuHRycO55UAtwFUsdZ9KfP8VVnZ3JCca9FdYGM+lPJVnkbhrlw5cDKhLos5TGnuRj0HY=@passt.top X-Gm-Message-State: AOJu0YzmnznQW875SEP3syr0hTa8PB+LP68GJGukqaAiC/Ac9sgRDDOk APTI1zNksvstftyRuJdw/Cxfy3GGipZHZ2w1flrAq5vS2QaW1VPR065xoNSEDlBZMFH6xtZjcZ3 auFY5sLohJlAMhykc/5XolvwTW65A+0skbWbJbdkDOQ/nhXz/8ldsmanwsjBvwFQvPYBHdgyQjW StfoUHjNi3lNadRSApWcxdiHdsGgMYzBGDi1KC X-Gm-Gg: ASbGncuKJD5BGgWarSakg2mjhFjvlQQJIJxDgjydiAhxQLitFttUfUj8wCwAIE2fohW Q+wuqiPw7IWgwKACIDnbhWNYkBZUizv6T7ffVMmLIHMESeqObGSQIPFufpZO5hArN4uK5WBVJNb pzM7wPFr5lG/PuLePY5C/C2gITU9oW3WMJWdLI3R/HMSxCux4+9JceEiUF4Cz+06NkFMM+4EPFs zQDs+qpXXTfpjhuQRkoBV6Hqim14ofidHBlCXFbiACBjRx85OJM8vggoMhRaVprUnrK9v3jzp9n QuW+Mf2ridS9ZykSDJs8a+JHhAapCKo+bw== X-Received: by 2002:a05:600c:3b98:b0:442:e9ec:4654 with SMTP id 5b1f17b1804b1-45334344af1mr855285e9.8.1749741481301; Thu, 12 Jun 2025 08:18:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmpu9EViusFdM04YcPC/u1itDBiqKqm20bn+bfzWjveNs7qvL5IQ34mmA9oqogfgzyZSZ/ag== X-Received: by 2002:a05:600c:3b98:b0:442:e9ec:4654 with SMTP id 5b1f17b1804b1-45334344af1mr854815e9.8.1749741480775; Thu, 12 Jun 2025 08:18:00 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a561a3c0absm2306843f8f.58.2025.06.12.08.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jun 2025 08:18:00 -0700 (PDT) Date: Thu, 12 Jun 2025 17:17:58 +0200 From: Stefano Brivio To: Jon Maloy Subject: Re: [PATCH v2 7/8] tcp: make tcp_rst_no_conn() respond with correct mac address Message-ID: <20250612171758.62eb5781@elisabeth> In-Reply-To: <20250612042152.695879-8-jmaloy@redhat.com> References: <20250612042152.695879-1-jmaloy@redhat.com> <20250612042152.695879-8-jmaloy@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: SxO42GGThYxAQCLsWm4exH7F7ACl51XZ7WZRd9HHNpk_1749741482 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 7PJIN7LRXAGJXYH5L3244L7WT2375AIH X-Message-ID-Hash: 7PJIN7LRXAGJXYH5L3244L7WT2375AIH X-MailFrom: sbrivio@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: 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 Thu, 12 Jun 2025 00:21:51 -0400 Jon Maloy wrote: > tcp_rst_no_conn() needs to identify and specify which source mac > address to use when sending an RST to the guest. This is because > it doesn't have access to any flow structure where this address > could be fetched. > > Signed-off-by: Jon Maloy > --- > tcp.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/tcp.c b/tcp.c > index 1a32424..b49f603 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -309,6 +309,7 @@ > #include "tcp_internal.h" > #include "tcp_buf.h" > #include "tcp_vu.h" > +#include "netlink.h" > > #ifndef __USE_MISC > /* From Linux UAPI, missing in netinet/tcp.h provided by musl */ > @@ -1888,6 +1889,9 @@ static void tcp_rst_no_conn(const struct ctx *c, int af, > const struct tcphdr *th, size_t l4len) > { > struct iov_tail payload = IOV_TAIL(NULL, 0, 0); > + unsigned char src_mac[ETH_ALEN]; > + union inany_addr translated; > + union inany_addr dst; Same comment as previous patches, here, and... > struct tcphdr *rsth; > char buf[USHRT_MAX]; > uint32_t psum = 0; > @@ -1897,8 +1901,15 @@ static void tcp_rst_no_conn(const struct ctx *c, int af, > if (th->rst) > return; > > + /* If remote host on local network - respond with its mac address */ > + memcpy(src_mac, c->our_tap_mac, ETH_ALEN); > + inany_from_af(&dst, af, daddr); > + nat_outbound(c, &dst, &translated); > + if (!memcmp(&dst, &translated, sizeof(dst))) > + nl_mac_get(nl_sock, &dst, src_mac); here. The rest of the series looks good to me! -- Stefano