]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netfilter: nft_payload: do not update layer 4 checksum when mangling fragments
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 5 Jan 2022 15:09:57 +0000 (16:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 17:23:04 +0000 (18:23 +0100)
commit 4e1860a3863707e8177329c006d10f9e37e097a8 upstream.

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")
Reported-and-tested-by: Steffen Weinreich <steve@weinreich.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nft_payload.c

index b1a9f330a51fe26b73b7d9c7f1d8a5cfa4b65435..fd87216bc0a99ef2a01a5fa22f4490001c6df9c3 100644 (file)
@@ -194,6 +194,9 @@ static int nft_payload_l4csum_offset(const struct nft_pktinfo *pkt,
                                     struct sk_buff *skb,
                                     unsigned int *l4csum_offset)
 {
+       if (pkt->xt.fragoff)
+               return -1;
+
        switch (pkt->tprot) {
        case IPPROTO_TCP:
                *l4csum_offset = offsetof(struct tcphdr, check);