Skip to content

Commit

Permalink
netfilter: ipset: make possible to hash some part of the data element…
Browse files Browse the repository at this point in the history
… only

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Jozsef Kadlecsik authored and Patrick McHardy committed Jul 21, 2011
1 parent 97d32cf commit a6a7b75
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions include/linux/netfilter/ipset/ip_set_ahash.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,16 @@ ip_set_hash_destroy(struct ip_set *set)
set->data = NULL;
}

#define HKEY(data, initval, htable_bits) \
(jhash2((u32 *)(data), sizeof(struct type_pf_elem)/sizeof(u32), initval) \
& jhash_mask(htable_bits))

#endif /* _IP_SET_AHASH_H */

#ifndef HKEY_DATALEN
#define HKEY_DATALEN sizeof(struct type_pf_elem)
#endif

#define HKEY(data, initval, htable_bits) \
(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \
& jhash_mask(htable_bits))

#define CONCAT(a, b, c) a##b##c
#define TOKEN(a, b, c) CONCAT(a, b, c)

Expand Down Expand Up @@ -1054,6 +1058,8 @@ type_pf_gc_init(struct ip_set *set)
IPSET_GC_PERIOD(h->timeout));
}

#undef HKEY_DATALEN
#undef HKEY
#undef type_pf_data_equal
#undef type_pf_data_isnull
#undef type_pf_data_copy
Expand Down

0 comments on commit a6a7b75

Please sign in to comment.