diff options
author | Gao Feng <fgao@ikuai8.com> | 2016-09-18 10:52:25 +0800 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-09-23 09:30:36 +0200 |
commit | 7bdc66242de7f9cbe8dbb01757042dd18744d800 (patch) | |
tree | 6994143546494084ca28057c9af41b9a0dd079f4 /net/netfilter/xt_RATEEST.c | |
parent | a20877b5edec4d2b62560b5245199af04846476c (diff) | |
download | talos-op-linux-7bdc66242de7f9cbe8dbb01757042dd18744d800.tar.gz talos-op-linux-7bdc66242de7f9cbe8dbb01757042dd18744d800.zip |
netfilter: Enhance the codes used to get random once
There are some codes which are used to get one random once in netfilter.
We could use net_get_random_once to simplify these codes.
Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/xt_RATEEST.c')
-rw-r--r-- | net/netfilter/xt_RATEEST.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c index 515131f9e021..dbd6c4a12b97 100644 --- a/net/netfilter/xt_RATEEST.c +++ b/net/netfilter/xt_RATEEST.c @@ -24,7 +24,6 @@ static DEFINE_MUTEX(xt_rateest_mutex); #define RATEEST_HSIZE 16 static struct hlist_head rateest_hash[RATEEST_HSIZE] __read_mostly; static unsigned int jhash_rnd __read_mostly; -static bool rnd_inited __read_mostly; static unsigned int xt_rateest_hash(const char *name) { @@ -99,10 +98,7 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par) } cfg; int ret; - if (unlikely(!rnd_inited)) { - get_random_bytes(&jhash_rnd, sizeof(jhash_rnd)); - rnd_inited = true; - } + net_get_random_once(&jhash_rnd, sizeof(jhash_rnd)); est = xt_rateest_lookup(info->name); if (est) { |