mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-20 07:09:58 +00:00
netfilter: nf_tables: Carry s_idx in nft_rule_dump_ctx
In order to move the context into struct netlink_callback's scratch area, the latter must be unused first. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
This commit is contained in:
parent
405c8fd62d
commit
8194d599bc
@ -3441,6 +3441,7 @@ static void audit_log_rule_reset(const struct nft_table *table,
|
||||
}
|
||||
|
||||
struct nft_rule_dump_ctx {
|
||||
unsigned int s_idx;
|
||||
char *table;
|
||||
char *chain;
|
||||
bool reset;
|
||||
@ -3455,7 +3456,6 @@ static int __nf_tables_dump_rules(struct sk_buff *skb,
|
||||
struct nft_rule_dump_ctx *ctx = cb->data;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
const struct nft_rule *rule, *prule;
|
||||
unsigned int s_idx = cb->args[0];
|
||||
unsigned int entries = 0;
|
||||
int ret = 0;
|
||||
u64 handle;
|
||||
@ -3464,7 +3464,7 @@ static int __nf_tables_dump_rules(struct sk_buff *skb,
|
||||
list_for_each_entry_rcu(rule, &chain->rules, list) {
|
||||
if (!nft_is_active(net, rule))
|
||||
goto cont_skip;
|
||||
if (*idx < s_idx)
|
||||
if (*idx < ctx->s_idx)
|
||||
goto cont;
|
||||
if (prule)
|
||||
handle = prule->handle;
|
||||
@ -3498,7 +3498,7 @@ static int nf_tables_dump_rules(struct sk_buff *skb,
|
||||
struct netlink_callback *cb)
|
||||
{
|
||||
const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
|
||||
const struct nft_rule_dump_ctx *ctx = cb->data;
|
||||
struct nft_rule_dump_ctx *ctx = cb->data;
|
||||
struct nft_table *table;
|
||||
const struct nft_chain *chain;
|
||||
unsigned int idx = 0;
|
||||
@ -3547,7 +3547,7 @@ static int nf_tables_dump_rules(struct sk_buff *skb,
|
||||
done:
|
||||
rcu_read_unlock();
|
||||
|
||||
cb->args[0] = idx;
|
||||
ctx->s_idx = idx;
|
||||
return skb->len;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user