Skip to content

Commit 2eda95c

Browse files
Phil Sutterummakynes
authored andcommitted
netfilter: nf_tables: Carry s_idx in nft_obj_dump_ctx
Prep work for moving the context into struct netlink_callback scratch area. Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent ecf49ca commit 2eda95c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7682,21 +7682,22 @@ static void audit_log_obj_reset(const struct nft_table *table,
76827682
}
76837683

76847684
struct nft_obj_dump_ctx {
7685+
unsigned int s_idx;
76857686
char *table;
76867687
u32 type;
76877688
};
76887689

76897690
static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)
76907691
{
76917692
const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
7692-
const struct nft_table *table;
7693-
unsigned int idx = 0, s_idx = cb->args[0];
76947693
struct nft_obj_dump_ctx *ctx = cb->data;
76957694
struct net *net = sock_net(skb->sk);
76967695
int family = nfmsg->nfgen_family;
76977696
struct nftables_pernet *nft_net;
7697+
const struct nft_table *table;
76987698
unsigned int entries = 0;
76997699
struct nft_object *obj;
7700+
unsigned int idx = 0;
77007701
bool reset = false;
77017702
int rc = 0;
77027703

@@ -7715,7 +7716,7 @@ static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)
77157716
list_for_each_entry_rcu(obj, &table->objects, list) {
77167717
if (!nft_is_active(net, obj))
77177718
goto cont;
7718-
if (idx < s_idx)
7719+
if (idx < ctx->s_idx)
77197720
goto cont;
77207721
if (ctx->table && strcmp(ctx->table, table->name))
77217722
goto cont;
@@ -7745,7 +7746,7 @@ static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)
77457746
}
77467747
rcu_read_unlock();
77477748

7748-
cb->args[0] = idx;
7749+
ctx->s_idx = idx;
77497750
return skb->len;
77507751
}
77517752

0 commit comments

Comments
 (0)