diff options
| author | Patrick McHardy <kaber@trash.net> | 2015-04-10 21:27:35 -0400 |
|---|---|---|
| committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-04-13 11:17:27 -0400 |
| commit | 8cd8937ac0d68435b4ca9bd3c987c3cfea269b4f (patch) | |
| tree | f3ac8d3a164db637028fc52458c53a503c6379d6 | |
| parent | e562d860d7c8ad28f83dc4c9094fd3ae648ea0d6 (diff) | |
netfilter: nf_tables: convert sets to u32 data pointers
Simple conversion to use u32 pointers to the beginning of the data
area to keep follow up patches smaller.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
| -rw-r--r-- | include/net/netfilter/nf_tables.h | 4 | ||||
| -rw-r--r-- | net/netfilter/nft_hash.c | 11 | ||||
| -rw-r--r-- | net/netfilter/nft_rbtree.c | 3 |
3 files changed, 8 insertions, 10 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index fca0b5def629..efcf46ddd1d5 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
| @@ -231,10 +231,10 @@ struct nft_expr; | |||
| 231 | */ | 231 | */ |
| 232 | struct nft_set_ops { | 232 | struct nft_set_ops { |
| 233 | bool (*lookup)(const struct nft_set *set, | 233 | bool (*lookup)(const struct nft_set *set, |
| 234 | const struct nft_data *key, | 234 | const u32 *key, |
| 235 | const struct nft_set_ext **ext); | 235 | const struct nft_set_ext **ext); |
| 236 | bool (*update)(struct nft_set *set, | 236 | bool (*update)(struct nft_set *set, |
| 237 | const struct nft_data *key, | 237 | const u32 *key, |
| 238 | void *(*new)(struct nft_set *, | 238 | void *(*new)(struct nft_set *, |
| 239 | const struct nft_expr *, | 239 | const struct nft_expr *, |
| 240 | struct nft_regs *), | 240 | struct nft_regs *), |
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index 26ba4e192121..767df41d28ea 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c | |||
| @@ -36,7 +36,7 @@ struct nft_hash_elem { | |||
| 36 | 36 | ||
| 37 | struct nft_hash_cmp_arg { | 37 | struct nft_hash_cmp_arg { |
| 38 | const struct nft_set *set; | 38 | const struct nft_set *set; |
| 39 | const struct nft_data *key; | 39 | const u32 *key; |
| 40 | u8 genmask; | 40 | u8 genmask; |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| @@ -71,8 +71,7 @@ static inline int nft_hash_cmp(struct rhashtable_compare_arg *arg, | |||
| 71 | return 0; | 71 | return 0; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static bool nft_hash_lookup(const struct nft_set *set, | 74 | static bool nft_hash_lookup(const struct nft_set *set, const u32 *key, |
| 75 | const struct nft_data *key, | ||
| 76 | const struct nft_set_ext **ext) | 75 | const struct nft_set_ext **ext) |
| 77 | { | 76 | { |
| 78 | struct nft_hash *priv = nft_set_priv(set); | 77 | struct nft_hash *priv = nft_set_priv(set); |
| @@ -90,7 +89,7 @@ static bool nft_hash_lookup(const struct nft_set *set, | |||
| 90 | return !!he; | 89 | return !!he; |
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | static bool nft_hash_update(struct nft_set *set, const struct nft_data *key, | 92 | static bool nft_hash_update(struct nft_set *set, const u32 *key, |
| 94 | void *(*new)(struct nft_set *, | 93 | void *(*new)(struct nft_set *, |
| 95 | const struct nft_expr *, | 94 | const struct nft_expr *, |
| 96 | struct nft_regs *regs), | 95 | struct nft_regs *regs), |
| @@ -134,7 +133,7 @@ static int nft_hash_insert(const struct nft_set *set, | |||
| 134 | struct nft_hash_cmp_arg arg = { | 133 | struct nft_hash_cmp_arg arg = { |
| 135 | .genmask = nft_genmask_next(read_pnet(&set->pnet)), | 134 | .genmask = nft_genmask_next(read_pnet(&set->pnet)), |
| 136 | .set = set, | 135 | .set = set, |
| 137 | .key = &elem->key, | 136 | .key = elem->key.data, |
| 138 | }; | 137 | }; |
| 139 | 138 | ||
| 140 | return rhashtable_lookup_insert_key(&priv->ht, &arg, &he->node, | 139 | return rhashtable_lookup_insert_key(&priv->ht, &arg, &he->node, |
| @@ -158,7 +157,7 @@ static void *nft_hash_deactivate(const struct nft_set *set, | |||
| 158 | struct nft_hash_cmp_arg arg = { | 157 | struct nft_hash_cmp_arg arg = { |
| 159 | .genmask = nft_genmask_next(read_pnet(&set->pnet)), | 158 | .genmask = nft_genmask_next(read_pnet(&set->pnet)), |
| 160 | .set = set, | 159 | .set = set, |
| 161 | .key = &elem->key, | 160 | .key = elem->key.data, |
| 162 | }; | 161 | }; |
| 163 | 162 | ||
| 164 | rcu_read_lock(); | 163 | rcu_read_lock(); |
diff --git a/net/netfilter/nft_rbtree.c b/net/netfilter/nft_rbtree.c index b398f1a856d5..b888e0cdf1e2 100644 --- a/net/netfilter/nft_rbtree.c +++ b/net/netfilter/nft_rbtree.c | |||
| @@ -30,8 +30,7 @@ struct nft_rbtree_elem { | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | static bool nft_rbtree_lookup(const struct nft_set *set, | 33 | static bool nft_rbtree_lookup(const struct nft_set *set, const u32 *key, |
| 34 | const struct nft_data *key, | ||
| 35 | const struct nft_set_ext **ext) | 34 | const struct nft_set_ext **ext) |
| 36 | { | 35 | { |
| 37 | const struct nft_rbtree *priv = nft_set_priv(set); | 36 | const struct nft_rbtree *priv = nft_set_priv(set); |
