Skip to content

Commit 860e874

Browse files
committed
netfilter: nft_last: copy content when cloning expression
If the ruleset contains last timestamps, restore them accordingly. Otherwise, listing after restoration shows never used items. Fixes: 33a24de ("netfilter: nft_last: move stateful fields out of expression data") Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 2067e7a commit 860e874

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/netfilter/nft_last.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ static void nft_last_destroy(const struct nft_ctx *ctx,
105105
static int nft_last_clone(struct nft_expr *dst, const struct nft_expr *src)
106106
{
107107
struct nft_last_priv *priv_dst = nft_expr_priv(dst);
108+
struct nft_last_priv *priv_src = nft_expr_priv(src);
108109

109110
priv_dst->last = kzalloc(sizeof(*priv_dst->last), GFP_ATOMIC);
110111
if (!priv_dst->last)
111112
return -ENOMEM;
112113

114+
priv_dst->last->set = priv_src->last->set;
115+
priv_dst->last->jiffies = priv_src->last->jiffies;
116+
113117
return 0;
114118
}
115119

0 commit comments

Comments
 (0)