]> git.baikalelectronics.ru Git - kernel.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)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 6 Jan 2022 09:43:23 +0000 (10:43 +0100)
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 <steve@weinreich.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_payload.c

index bd689938a2e0c78810895d5bd06377fe1a0853d7..58e96a0fe0b4c5dc6e454a74c592de4632e88621 100644 (file)
@@ -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);