Skip to content

Commit

Permalink
netfilter: nf_tables: deconstify walk callback function
Browse files Browse the repository at this point in the history
The flush operation needs to modify set and element objects, so let's
deconstify this.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
ummakynes committed Jan 24, 2017
1 parent 35d0ac9 commit de70185
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions include/net/netfilter/nf_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ struct nft_set_iter {
unsigned int skip;
int err;
int (*fn)(const struct nft_ctx *ctx,
const struct nft_set *set,
struct nft_set *set,
const struct nft_set_iter *iter,
const struct nft_set_elem *elem);
struct nft_set_elem *elem);
};

/**
Expand Down Expand Up @@ -301,7 +301,7 @@ struct nft_set_ops {
void (*remove)(const struct nft_set *set,
const struct nft_set_elem *elem);
void (*walk)(const struct nft_ctx *ctx,
const struct nft_set *set,
struct nft_set *set,
struct nft_set_iter *iter);

unsigned int (*privsize)(const struct nlattr * const nla[]);
Expand Down
24 changes: 12 additions & 12 deletions net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3087,9 +3087,9 @@ static int nf_tables_delset(struct net *net, struct sock *nlsk,
}

static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx,
const struct nft_set *set,
struct nft_set *set,
const struct nft_set_iter *iter,
const struct nft_set_elem *elem)
struct nft_set_elem *elem)
{
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
enum nft_registers dreg;
Expand Down Expand Up @@ -3308,9 +3308,9 @@ struct nft_set_dump_args {
};

static int nf_tables_dump_setelem(const struct nft_ctx *ctx,
const struct nft_set *set,
struct nft_set *set,
const struct nft_set_iter *iter,
const struct nft_set_elem *elem)
struct nft_set_elem *elem)
{
struct nft_set_dump_args *args;

Expand All @@ -3322,7 +3322,7 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
u8 genmask = nft_genmask_cur(net);
const struct nft_set *set;
struct nft_set *set;
struct nft_set_dump_args args;
struct nft_ctx ctx;
struct nlattr *nla[NFTA_SET_ELEM_LIST_MAX + 1];
Expand Down Expand Up @@ -3890,9 +3890,9 @@ static int nft_del_setelem(struct nft_ctx *ctx, struct nft_set *set,
}

static int nft_flush_set(const struct nft_ctx *ctx,
const struct nft_set *set,
struct nft_set *set,
const struct nft_set_iter *iter,
const struct nft_set_elem *elem)
struct nft_set_elem *elem)
{
struct nft_trans *trans;
int err;
Expand All @@ -3907,8 +3907,8 @@ static int nft_flush_set(const struct nft_ctx *ctx,
goto err1;
}

nft_trans_elem_set(trans) = (struct nft_set *)set;
nft_trans_elem(trans) = *((struct nft_set_elem *)elem);
nft_trans_elem_set(trans) = set;
nft_trans_elem(trans) = *elem;
list_add_tail(&trans->list, &ctx->net->nft.commit_list);

return 0;
Expand Down Expand Up @@ -5019,9 +5019,9 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
const struct nft_chain *chain);

static int nf_tables_loop_check_setelem(const struct nft_ctx *ctx,
const struct nft_set *set,
struct nft_set *set,
const struct nft_set_iter *iter,
const struct nft_set_elem *elem)
struct nft_set_elem *elem)
{
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
const struct nft_data *data;
Expand All @@ -5045,7 +5045,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
{
const struct nft_rule *rule;
const struct nft_expr *expr, *last;
const struct nft_set *set;
struct nft_set *set;
struct nft_set_binding *binding;
struct nft_set_iter iter;

Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/nft_set_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static void nft_hash_remove(const struct nft_set *set,
rhashtable_remove_fast(&priv->ht, &he->node, nft_hash_params);
}

static void nft_hash_walk(const struct nft_ctx *ctx, const struct nft_set *set,
static void nft_hash_walk(const struct nft_ctx *ctx, struct nft_set *set,
struct nft_set_iter *iter)
{
struct nft_hash *priv = nft_set_priv(set);
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/nft_set_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static void *nft_rbtree_deactivate(const struct net *net,
}

static void nft_rbtree_walk(const struct nft_ctx *ctx,
const struct nft_set *set,
struct nft_set *set,
struct nft_set_iter *iter)
{
const struct nft_rbtree *priv = nft_set_priv(set);
Expand Down

0 comments on commit de70185

Please sign in to comment.