Skip to content

Commit

Permalink
netfilter: nf_tables: use rhashtable_lookup() instead of rhashtable_l…
Browse files Browse the repository at this point in the history
…ookup_fast()

Internally, rhashtable_lookup_fast() calls rcu_read_lock() then,
calls rhashtable_lookup(). so that in places where are guaranteed
by rcu read lock, rhashtable_lookup() is enough.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Taehee Yoo authored and Pablo Neira Ayuso committed Sep 28, 2018
1 parent 28c5ed2 commit a2d8818
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nf_flow_table_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ flow_offload_lookup(struct nf_flowtable *flow_table,
struct flow_offload *flow;
int dir;

tuplehash = rhashtable_lookup_fast(&flow_table->rhashtable, tuple,
nf_flow_offload_rhash_params);
tuplehash = rhashtable_lookup(&flow_table->rhashtable, tuple,
nf_flow_offload_rhash_params);
if (!tuplehash)
return NULL;

Expand Down
8 changes: 4 additions & 4 deletions net/netfilter/nft_set_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static bool nft_rhash_lookup(const struct net *net, const struct nft_set *set,
.key = key,
};

he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
if (he != NULL)
*ext = &he->ext;

Expand All @@ -106,7 +106,7 @@ static void *nft_rhash_get(const struct net *net, const struct nft_set *set,
.key = elem->key.val.data,
};

he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
if (he != NULL)
return he;

Expand All @@ -129,7 +129,7 @@ static bool nft_rhash_update(struct nft_set *set, const u32 *key,
.key = key,
};

he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
if (he != NULL)
goto out;

Expand Down Expand Up @@ -217,7 +217,7 @@ static void *nft_rhash_deactivate(const struct net *net,
};

rcu_read_lock();
he = rhashtable_lookup_fast(&priv->ht, &arg, nft_rhash_params);
he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
if (he != NULL &&
!nft_rhash_flush(net, set, he))
he = NULL;
Expand Down

0 comments on commit a2d8818

Please sign in to comment.