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_connlimit.c | |
parent | a20877b5edec4d2b62560b5245199af04846476c (diff) | |
download | op-kernel-dev-7bdc66242de7f9cbe8dbb01757042dd18744d800.zip op-kernel-dev-7bdc66242de7f9cbe8dbb01757042dd18744d800.tar.gz |
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_connlimit.c')
-rw-r--r-- | net/netfilter/xt_connlimit.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c index 99bbc82..b6dc322 100644 --- a/net/netfilter/xt_connlimit.c +++ b/net/netfilter/xt_connlimit.c @@ -366,14 +366,8 @@ static int connlimit_mt_check(const struct xt_mtchk_param *par) unsigned int i; int ret; - if (unlikely(!connlimit_rnd)) { - u_int32_t rand; + net_get_random_once(&connlimit_rnd, sizeof(connlimit_rnd)); - do { - get_random_bytes(&rand, sizeof(rand)); - } while (!rand); - cmpxchg(&connlimit_rnd, 0, rand); - } ret = nf_ct_l3proto_try_module_get(par->family); if (ret < 0) { pr_info("cannot load conntrack support for " |