mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Felix Fietkau <nbd@nbd.name>,
	 netdev@vger.kernel.org,  "David S. Miller" <davem@davemloft.net>,
	 David Ahern <dsahern@kernel.org>,
	 Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Simon Horman <horms@kernel.org>,
	 Steffen Klassert <steffen.klassert@secunet.com>,
	 Willem de Bruijn <willemb@google.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: ipv6: fix UDPv6 GSO segmentation with NAT
Date: Mon, 28 Apr 2025 12:17:12 -0400	[thread overview]
Message-ID: <680faa08829e9_23f8812941f@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20250426153210.14044-1-nbd@nbd.name>

Felix Fietkau wrote:
> If any address or port is changed, update it in all packets and recalculate
> checksum.
> 
> Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Reviewed-by: Willem de Bruijn <willemb@google.com>

This is the IPv6 equivalent to commit c3df39ac9b0e ("udp: ipv4:
manipulate network header of NATed UDP GRO fraglist"). Not sure why
IPv6 was missed at the time.

> ---
>  net/ipv4/udp_offload.c | 61 +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 60 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> index 2c0725583be3..9a8142ccbabe 100644
> --- a/net/ipv4/udp_offload.c
> +++ b/net/ipv4/udp_offload.c
> @@ -247,6 +247,62 @@ static struct sk_buff *__udpv4_gso_segment_list_csum(struct sk_buff *segs)
>  	return segs;
>  }
>  
> +static void __udpv6_gso_segment_csum(struct sk_buff *seg,
> +				     struct in6_addr *oldip,
> +				     const struct in6_addr *newip,
> +				     __be16 *oldport, __be16 newport)
> +{
> +	struct udphdr *uh = udp_hdr(seg);
> +
> +	if (ipv6_addr_equal(oldip, newip) && *oldport == newport)
> +		return;
> +
> +	if (uh->check) {
> +		inet_proto_csum_replace16(&uh->check, seg, oldip->s6_addr32,
> +					  newip->s6_addr32, true);
> +
> +		inet_proto_csum_replace2(&uh->check, seg, *oldport, newport,
> +					 false);
> +		if (!uh->check)
> +			uh->check = CSUM_MANGLED_0;
> +	}
> +
> +	*oldip = *newip;
> +	*oldport = newport;
> +}
> +
> +static struct sk_buff *__udpv6_gso_segment_list_csum(struct sk_buff *segs)
> +{
> +	const struct ipv6hdr *iph;
> +	const struct udphdr *uh;
> +	struct ipv6hdr *iph2;
> +	struct sk_buff *seg;
> +	struct udphdr *uh2;
> +
> +	seg = segs;
> +	uh = udp_hdr(seg);
> +	iph = ipv6_hdr(seg);
> +	uh2 = udp_hdr(seg->next);
> +	iph2 = ipv6_hdr(seg->next);
> +
> +	if (!(*(const u32 *)&uh->source ^ *(const u32 *)&uh2->source) &&

only if respin: this could be a simpler equality test?

  reply	other threads:[~2025-04-28 16:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-26 15:32 Felix Fietkau
2025-04-28 16:17 ` Willem de Bruijn [this message]
2025-04-29 22:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=680faa08829e9_23f8812941f@willemb.c.googlers.com.notmuch \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=steffen.klassert@secunet.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®