aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2015-03-25 09:07:45 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2015-03-25 12:18:33 -0400
commit49f7b33e63fec9d16e7ee62ba8f8ab4159cbdc26 (patch)
tree63ebd033f56bab0eb9f6fe3ebda773b87ddda1ea /include
parent14d14a5d2957a4a047b4dbabb6d5ef28a7a70b33 (diff)
rhashtable: provide len to obj_hashfn
nftables sets will be converted to use so called setextensions, moving the key to a non-fixed position. To hash it, the obj_hashfn must be used, however it so far doesn't receive the length parameter. Pass the key length to obj_hashfn() and convert existing users. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/rhashtable.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 99f2e49a8a07..e23d242d1230 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -88,7 +88,7 @@ struct rhashtable_compare_arg {
88}; 88};
89 89
90typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); 90typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
91typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 seed); 91typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed);
92typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg, 92typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg,
93 const void *obj); 93 const void *obj);
94 94
@@ -242,7 +242,9 @@ static inline unsigned int rht_head_hashfn(
242 const char *ptr = rht_obj(ht, he); 242 const char *ptr = rht_obj(ht, he);
243 243
244 return likely(params.obj_hashfn) ? 244 return likely(params.obj_hashfn) ?
245 rht_bucket_index(tbl, params.obj_hashfn(ptr, tbl->hash_rnd)) : 245 rht_bucket_index(tbl, params.obj_hashfn(ptr, params.key_len ?:
246 ht->p.key_len,
247 tbl->hash_rnd)) :
246 rht_key_hashfn(ht, tbl, ptr + params.key_offset, params); 248 rht_key_hashfn(ht, tbl, ptr + params.key_offset, params);
247} 249}
248 250