Skip to content

Commit a6a7b75

Browse files
Jozsef Kadlecsikkaber
authored andcommitted
netfilter: ipset: make possible to hash some part of the data element only
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> Signed-off-by: Patrick McHardy <kaber@trash.net>
1 parent 97d32cf commit a6a7b75

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎include/linux/netfilter/ipset/ip_set_ahash.h‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,16 @@ ip_set_hash_destroy(struct ip_set *set)
211211
set->data = NULL;
212212
}
213213

214-
#define HKEY(data, initval, htable_bits) \
215-
(jhash2((u32 *)(data), sizeof(struct type_pf_elem)/sizeof(u32), initval) \
216-
& jhash_mask(htable_bits))
217-
218214
#endif /* _IP_SET_AHASH_H */
219215

216+
#ifndef HKEY_DATALEN
217+
#define HKEY_DATALEN sizeof(struct type_pf_elem)
218+
#endif
219+
220+
#define HKEY(data, initval, htable_bits) \
221+
(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \
222+
& jhash_mask(htable_bits))
223+
220224
#define CONCAT(a, b, c) a##b##c
221225
#define TOKEN(a, b, c) CONCAT(a, b, c)
222226

@@ -1054,6 +1058,8 @@ type_pf_gc_init(struct ip_set *set)
10541058
IPSET_GC_PERIOD(h->timeout));
10551059
}
10561060

1061+
#undef HKEY_DATALEN
1062+
#undef HKEY
10571063
#undef type_pf_data_equal
10581064
#undef type_pf_data_isnull
10591065
#undef type_pf_data_copy

0 commit comments

Comments
 (0)