1 From: Pablo Neira Ayuso <pablo@netfilter.org>
2 Date: Fri, 20 Nov 2020 13:49:13 +0100
3 Subject: [PATCH] netfilter: flowtable: add hash offset field to tuple
5 Add a placeholder field to calculate hash tuple offset. Similar to
6 2c407aca6497 ("netfilter: conntrack: avoid gcc-10 zero-length-bounds
9 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 --- a/include/net/netfilter/nf_flow_table.h
13 +++ b/include/net/netfilter/nf_flow_table.h
14 @@ -107,6 +107,10 @@ struct flow_offload_tuple {
19 + /* All members above are keys for lookups, see flow_offload_hash(). */
25 --- a/net/netfilter/nf_flow_table_core.c
26 +++ b/net/netfilter/nf_flow_table_core.c
27 @@ -191,14 +191,14 @@ static u32 flow_offload_hash(const void
29 const struct flow_offload_tuple *tuple = data;
31 - return jhash(tuple, offsetof(struct flow_offload_tuple, dir), seed);
32 + return jhash(tuple, offsetof(struct flow_offload_tuple, __hash), seed);
35 static u32 flow_offload_hash_obj(const void *data, u32 len, u32 seed)
37 const struct flow_offload_tuple_rhash *tuplehash = data;
39 - return jhash(&tuplehash->tuple, offsetof(struct flow_offload_tuple, dir), seed);
40 + return jhash(&tuplehash->tuple, offsetof(struct flow_offload_tuple, __hash), seed);
43 static int flow_offload_hash_cmp(struct rhashtable_compare_arg *arg,
44 @@ -207,7 +207,7 @@ static int flow_offload_hash_cmp(struct
45 const struct flow_offload_tuple *tuple = arg->key;
46 const struct flow_offload_tuple_rhash *x = ptr;
48 - if (memcmp(&x->tuple, tuple, offsetof(struct flow_offload_tuple, dir)))
49 + if (memcmp(&x->tuple, tuple, offsetof(struct flow_offload_tuple, __hash)))