From: Pablo Neira Ayuso Date: Wed, 5 Jan 2022 15:09:57 +0000 (+0100) Subject: netfilter: nft_payload: do not update layer 4 checksum when mangling fragments X-Git-Tag: baikal/aarch64/sdk6.1~4966^2^2~10^2~1 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=30e1740ed1d60a306a643f82de04c1754bf3b477;p=kernel.git 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: 027bee253306 ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields") Reported-and-tested-by: Steffen Weinreich Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c index bd689938a2e0c..58e96a0fe0b4c 100644 --- a/net/netfilter/nft_payload.c +++ b/net/netfilter/nft_payload.c @@ -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);