mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-08 10:25:20 +02:00
netfilter: nf_tables: Carry s_idx in nft_obj_dump_ctx
[ Upstream commit2eda95cfa2
] Prep work for moving the context into struct netlink_callback scratch area. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Stable-dep-of:bd662c4218
("netfilter: nf_tables: Add locking for NFT_MSG_GETOBJ_RESET requests") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2c6a79b94e
commit
959c9bf85f
|
@ -7718,6 +7718,7 @@ static void audit_log_obj_reset(const struct nft_table *table,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nft_obj_dump_ctx {
|
struct nft_obj_dump_ctx {
|
||||||
|
unsigned int s_idx;
|
||||||
char *table;
|
char *table;
|
||||||
u32 type;
|
u32 type;
|
||||||
};
|
};
|
||||||
|
@ -7725,14 +7726,14 @@ struct nft_obj_dump_ctx {
|
||||||
static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)
|
static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)
|
||||||
{
|
{
|
||||||
const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
|
const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
|
||||||
const struct nft_table *table;
|
|
||||||
unsigned int idx = 0, s_idx = cb->args[0];
|
|
||||||
struct nft_obj_dump_ctx *ctx = cb->data;
|
struct nft_obj_dump_ctx *ctx = cb->data;
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
int family = nfmsg->nfgen_family;
|
int family = nfmsg->nfgen_family;
|
||||||
struct nftables_pernet *nft_net;
|
struct nftables_pernet *nft_net;
|
||||||
|
const struct nft_table *table;
|
||||||
unsigned int entries = 0;
|
unsigned int entries = 0;
|
||||||
struct nft_object *obj;
|
struct nft_object *obj;
|
||||||
|
unsigned int idx = 0;
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
@ -7751,7 +7752,7 @@ static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)
|
||||||
list_for_each_entry_rcu(obj, &table->objects, list) {
|
list_for_each_entry_rcu(obj, &table->objects, list) {
|
||||||
if (!nft_is_active(net, obj))
|
if (!nft_is_active(net, obj))
|
||||||
goto cont;
|
goto cont;
|
||||||
if (idx < s_idx)
|
if (idx < ctx->s_idx)
|
||||||
goto cont;
|
goto cont;
|
||||||
if (ctx->table && strcmp(ctx->table, table->name))
|
if (ctx->table && strcmp(ctx->table, table->name))
|
||||||
goto cont;
|
goto cont;
|
||||||
|
@ -7781,7 +7782,7 @@ cont:
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
cb->args[0] = idx;
|
ctx->s_idx = idx;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user