Commit f5990207 authored by Breno Leitao's avatar Breno Leitao Committed by Jakub Kicinski
Browse files

net: netpoll: Initialize UDP checksum field before checksumming



commit f1fce08e ("netpoll: Eliminate redundant assignment") removed
the initialization of the UDP checksum, which was wrong and broke
netpoll IPv6 transmission due to bad checksumming.

udph->check needs to be set before calling csum_ipv6_magic().

Fixes: f1fce08e ("netpoll: Eliminate redundant assignment")
Signed-off-by: default avatarBreno Leitao <leitao@debian.org>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250620-netpoll_fix-v1-1-f9f0b82bc059@debian.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 95b6759a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -432,6 +432,7 @@ int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
	udph->dest = htons(np->remote_port);
	udph->len = htons(udp_len);

	udph->check = 0;
	if (np->ipv6) {
		udph->check = csum_ipv6_magic(&np->local_ip.in6,
					      &np->remote_ip.in6,
@@ -460,7 +461,6 @@ int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
		skb_reset_mac_header(skb);
		skb->protocol = eth->h_proto = htons(ETH_P_IPV6);
	} else {
		udph->check = 0;
		udph->check = csum_tcpudp_magic(np->local_ip.ip,
						np->remote_ip.ip,
						udp_len, IPPROTO_UDP,