Skip to contentSkip to conversation

netfilter: nft_payload: do not update layer 4 checksum when mangling fragments

PATCH New Pablo Neira Ayuso 1 participant 1 message Jan 5, 2022

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nft_payload: do not update layer 4 checksum when mangling fragments

IP fragments do not come with the transport header, hence skip bogus layer 4 checksum updates.

Fixes 1814096980bb ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields")
---
 net/netfilter/nft_payload.c | 3 +++
 1 file changed, 3 insertions(+)
net/netfilter/nft_payload.c +3 -0
index bd689938a2e0..58e96a0fe0b4 100644
@@ -546,6 +546,9 @@ static int nft_payload_l4csum_offset(const struct nft_pktinfo *pkt,
 				     struct sk_buff *skb,
 				     unsigned int *l4csum_offset)
 {
+	if (pkt->fragoff)
+		return -1;
+
 	switch (pkt->tprot) {
 	case IPPROTO_TCP:
 		*l4csum_offset = offsetof(struct tcphdr, check);
Signature · 1 line
2.30.2