From nobody Tue Dec 16 03:24:38 2025 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28B17192580; Mon, 10 Mar 2025 11:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741605700; cv=none; b=FWcnZ9Y76KdoAN2IMzAUEtYlSgLNTZYzB47/dkw1qD77FYkO875i7TaSJbDdq64yYZInNYuZCorw3P16f1cAoMTYaBpgcXU4nLGEthZ8eZLe4d34IAFKIQac9qi6wkJM5Qh5zxt5jnkTrZQV1PU7L1Dnr2kyujHwOj1hQ1YUcOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741605700; c=relaxed/simple; bh=bE8tMZAyDMevNCLzxK3lkI0jlkL810w8iRNQz71VWKY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EYOUSmgug0F5WsXqvkvTRhdeq1taTx/OVGzJY+ihGxHcxl4QRphPwI434ovIon7tkyQ4IByv1gvccTrlHh+fSU2hZKM8iWYIhSKTkcLZHzeEhDTeQOFt7R9gOVfZZJLkzG6CI6ar0CTa/rwzDpQPjNDZDOyvuKsZ5RmvUwFx+GI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=bVSCJuES; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="bVSCJuES" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=M4FrvF1IcMf9Ag+QFJ2jji+690UfAG0H/9opoj+3sck=; b=bVSCJuES+Sp+HD36dCCRDCPheC YF5G/7s0EqI5MgfKT+CNJ24oL9c85/CB5KB314yk3jvKZjViqKfXp0SgTHgEnyAHwgYYA2nrk0jt8 50t2zOH3ZImngl7zl29W8egsWlpCJrIwRFaFNo4+jPT9w2zLa72jUqScRRuNNXKN+frk=; Received: from p5b206ef1.dip0.t-ipconnect.de ([91.32.110.241] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1trbCD-00FdkE-2c; Mon, 10 Mar 2025 12:21:21 +0100 From: Felix Fietkau To: netdev@vger.kernel.org, Eric Dumazet , Neal Cardwell , Kuniyuki Iwashima , "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , Simon Horman , Willem de Bruijn Cc: linux-kernel@vger.kernel.org Subject: [PATCH net v2] net: ipv6: fix TCP GSO segmentation with NAT Date: Mon, 10 Mar 2025 12:21:20 +0100 Message-ID: <20250310112121.73654-1-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When updating the source/destination address, the TCP/UDP checksum needs to be updated as well. Fixes: bee88cd5bd83 ("net: add support for segmenting TCP fraglist GSO pack= ets") Signed-off-by: Felix Fietkau --- v2: move code to make it similar to __tcpv4_gso_segment_list_csum net/ipv6/tcpv6_offload.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c index a45bf17cb2a1..34dd0cee3ba6 100644 --- a/net/ipv6/tcpv6_offload.c +++ b/net/ipv6/tcpv6_offload.c @@ -94,10 +94,20 @@ INDIRECT_CALLABLE_SCOPE int tcp6_gro_complete(struct sk= _buff *skb, int thoff) } =20 static void __tcpv6_gso_segment_csum(struct sk_buff *seg, + struct in6_addr *oldip, + const struct in6_addr *newip, __be16 *oldport, __be16 newport) { struct tcphdr *th; =20 + if (!ipv6_addr_equal(oldip, newip)) { + inet_proto_csum_replace16(&th->check, seg, + oldip->s6_addr32, + newip->s6_addr32, + true); + *oldip =3D *newip; + } + if (*oldport =3D=3D newport) return; =20 @@ -129,10 +139,10 @@ static struct sk_buff *__tcpv6_gso_segment_list_csum(= struct sk_buff *segs) th2 =3D tcp_hdr(seg); iph2 =3D ipv6_hdr(seg); =20 - iph2->saddr =3D iph->saddr; - iph2->daddr =3D iph->daddr; - __tcpv6_gso_segment_csum(seg, &th2->source, th->source); - __tcpv6_gso_segment_csum(seg, &th2->dest, th->dest); + __tcpv6_gso_segment_csum(seg, &iph2->saddr, &iph->saddr, + &th2->source, th->source); + __tcpv6_gso_segment_csum(seg, &iph2->daddr, &iph->daddr, + &th2->dest, th->dest); } =20 return segs; --=20 2.47.1