Skip to contentSkip to conversation

netfilter: nat: fix udp checksum corruption

PATCH Applied Florian Westphal 2 participants 2 messages May 20, 2019 – May 21, 2019

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nat: fix udp checksum corruption

Due to copy&paste error nf_nat_mangle_udp_packet passes IPPROTO_TCP, resulting in incorrect udp checksum when payload had to be mangled.

Fixes dac3fe72596f9 ("netfilter: nat: remove csum_recalc hook")
---
 net/netfilter/nf_nat_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_nat_helper.c +1 -1
index ccc06f7539d7..53aeb12b70fb 100644
@@ -170,7 +170,7 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
 	if (!udph->check && skb->ip_summed != CHECKSUM_PARTIAL)
 		return true;
 
-	nf_nat_csum_recalc(skb, nf_ct_l3num(ct), IPPROTO_TCP,
+	nf_nat_csum_recalc(skb, nf_ct_l3num(ct), IPPROTO_UDP,
 			   udph, &udph->check, datalen, oldlen);
 
 	return true;
Signature · 1 line
2.21.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Florian Westphal

Due to copy&paste error nf_nat_mangle_udp_packet passes IPPROTO_TCP, resulting in incorrect udp checksum when payload had to be mangled.

Applied, thanks.