summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2022-01-05 16:09:57 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-08 18:16:24 +0100
commitf781482034ea6452fbe27dad6b820914ae0d0e84 (patch)
tree6ad63ba03f5f0800e12c98037952fd6b0c9065d7 /net
parentc2ab8958cfbfb65340877cfe45715bdd1efd2633 (diff)
downloadlinux-f781482034ea6452fbe27dad6b820914ae0d0e84.tar.gz
linux-f781482034ea6452fbe27dad6b820914ae0d0e84.tar.bz2
linux-f781482034ea6452fbe27dad6b820914ae0d0e84.zip
netfilter: nft_payload: do not update layer 4 checksum when mangling fragments
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>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nft_payload.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index b1a9f330a51f..fd87216bc0a9 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -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);