Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: nft_numgen: cancel register tracking

Random and increment are stateful, each invocation results in fresh output.
Cancel register tracking for these two expressions.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

+22
+22
net/netfilter/nft_numgen.c
··· 85 85 return err; 86 86 } 87 87 88 + static bool nft_ng_inc_reduce(struct nft_regs_track *track, 89 + const struct nft_expr *expr) 90 + { 91 + const struct nft_ng_inc *priv = nft_expr_priv(expr); 92 + 93 + nft_reg_track_cancel(track, priv->dreg, NFT_REG32_SIZE); 94 + 95 + return false; 96 + } 97 + 88 98 static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg, 89 99 u32 modulus, enum nft_ng_types type, u32 offset) 90 100 { ··· 182 172 priv->offset); 183 173 } 184 174 175 + static bool nft_ng_random_reduce(struct nft_regs_track *track, 176 + const struct nft_expr *expr) 177 + { 178 + const struct nft_ng_random *priv = nft_expr_priv(expr); 179 + 180 + nft_reg_track_cancel(track, priv->dreg, NFT_REG32_SIZE); 181 + 182 + return false; 183 + } 184 + 185 185 static struct nft_expr_type nft_ng_type; 186 186 static const struct nft_expr_ops nft_ng_inc_ops = { 187 187 .type = &nft_ng_type, ··· 200 180 .init = nft_ng_inc_init, 201 181 .destroy = nft_ng_inc_destroy, 202 182 .dump = nft_ng_inc_dump, 183 + .reduce = nft_ng_inc_reduce, 203 184 }; 204 185 205 186 static const struct nft_expr_ops nft_ng_random_ops = { ··· 209 188 .eval = nft_ng_random_eval, 210 189 .init = nft_ng_random_init, 211 190 .dump = nft_ng_random_dump, 191 + .reduce = nft_ng_random_reduce, 212 192 }; 213 193 214 194 static const struct nft_expr_ops *