]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: nft_limit: Clone packet limits' cost value
authorPhil Sutter <phil@nwl.cc>
Tue, 24 May 2022 12:50:01 +0000 (14:50 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 26 May 2022 20:50:34 +0000 (22:50 +0200)
When cloning a packet-based limit expression, copy the cost value as
well. Otherwise the new limit is not functional anymore.

Fixes: 062d62c00def9 ("netfilter: nft_limit: move stateful fields out of expression data")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_limit.c

index 04ea8b9bf202855159b01e17c7033ed49047d8d1..981addb2d0515324045a6b7dbd5df09a4b75a616 100644 (file)
@@ -213,6 +213,8 @@ static int nft_limit_pkts_clone(struct nft_expr *dst, const struct nft_expr *src
        struct nft_limit_priv_pkts *priv_dst = nft_expr_priv(dst);
        struct nft_limit_priv_pkts *priv_src = nft_expr_priv(src);
 
+       priv_dst->cost = priv_src->cost;
+
        return nft_limit_clone(&priv_dst->limit, &priv_src->limit);
 }