lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <680faa08829e9_23f8812941f@willemb.c.googlers.com.notmuch>
Date: Mon, 28 Apr 2025 12:17:12 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Felix Fietkau <nbd@....name>, 
 netdev@...r.kernel.org, 
 "David S. Miller" <davem@...emloft.net>, 
 David Ahern <dsahern@...nel.org>, 
 Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, 
 Simon Horman <horms@...nel.org>, 
 Steffen Klassert <steffen.klassert@...unet.com>, 
 Willem de Bruijn <willemb@...gle.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: ipv6: fix UDPv6 GSO segmentation with NAT

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@....name>

Reviewed-by: Willem de Bruijn <willemb@...gle.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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ