Skip to content

Commit

Permalink
netfilter: nf_tables: convert sets to u32 data pointers
Browse files Browse the repository at this point in the history
Simple conversion to use u32 pointers to the beginning of the data
area to keep follow up patches smaller.

Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
kaber authored and ummakynes committed Apr 13, 2015
1 parent e562d86 commit 8cd8937
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/net/netfilter/nf_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ struct nft_expr;
*/
struct nft_set_ops {
bool (*lookup)(const struct nft_set *set,
const struct nft_data *key,
const u32 *key,
const struct nft_set_ext **ext);
bool (*update)(struct nft_set *set,
const struct nft_data *key,
const u32 *key,
void *(*new)(struct nft_set *,
const struct nft_expr *,
struct nft_regs *),
Expand Down
11 changes: 5 additions & 6 deletions net/netfilter/nft_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct nft_hash_elem {

struct nft_hash_cmp_arg {
const struct nft_set *set;
const struct nft_data *key;
const u32 *key;
u8 genmask;
};

Expand Down Expand Up @@ -71,8 +71,7 @@ static inline int nft_hash_cmp(struct rhashtable_compare_arg *arg,
return 0;
}

static bool nft_hash_lookup(const struct nft_set *set,
const struct nft_data *key,
static bool nft_hash_lookup(const struct nft_set *set, const u32 *key,
const struct nft_set_ext **ext)
{
struct nft_hash *priv = nft_set_priv(set);
Expand All @@ -90,7 +89,7 @@ static bool nft_hash_lookup(const struct nft_set *set,
return !!he;
}

static bool nft_hash_update(struct nft_set *set, const struct nft_data *key,
static bool nft_hash_update(struct nft_set *set, const u32 *key,
void *(*new)(struct nft_set *,
const struct nft_expr *,
struct nft_regs *regs),
Expand Down Expand Up @@ -134,7 +133,7 @@ static int nft_hash_insert(const struct nft_set *set,
struct nft_hash_cmp_arg arg = {
.genmask = nft_genmask_next(read_pnet(&set->pnet)),
.set = set,
.key = &elem->key,
.key = elem->key.data,
};

return rhashtable_lookup_insert_key(&priv->ht, &arg, &he->node,
Expand All @@ -158,7 +157,7 @@ static void *nft_hash_deactivate(const struct nft_set *set,
struct nft_hash_cmp_arg arg = {
.genmask = nft_genmask_next(read_pnet(&set->pnet)),
.set = set,
.key = &elem->key,
.key = elem->key.data,
};

rcu_read_lock();
Expand Down
3 changes: 1 addition & 2 deletions net/netfilter/nft_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ struct nft_rbtree_elem {
};


static bool nft_rbtree_lookup(const struct nft_set *set,
const struct nft_data *key,
static bool nft_rbtree_lookup(const struct nft_set *set, const u32 *key,
const struct nft_set_ext **ext)
{
const struct nft_rbtree *priv = nft_set_priv(set);
Expand Down

0 comments on commit 8cd8937

Please sign in to comment.