From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Patrick McHardy <kaber@trash.net>,
netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
coreteam@netfilter.org, "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: [PATCH 25/29] net/netfilter: rename random32() and net_random() to prandom_u32()
Date: Mon, 24 Dec 2012 11:14:12 +0900 [thread overview]
Message-ID: <1356315256-6572-26-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Cc: netfilter@vger.kernel.org
Cc: coreteam@netfilter.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
net/netfilter/ipvs/ip_vs_conn.c | 2 +-
net/netfilter/nf_conntrack_core.c | 4 ++--
net/netfilter/xt_statistic.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 30e764a..870dff6 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1200,7 +1200,7 @@ void ip_vs_random_dropentry(struct net *net)
* Randomly scan 1/32 of the whole table every second
*/
for (idx = 0; idx < (ip_vs_conn_tab_size>>5); idx++) {
- unsigned int hash = net_random() & ip_vs_conn_tab_mask;
+ unsigned int hash = prandom_u32() & ip_vs_conn_tab_mask;
struct hlist_node *n;
/*
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 08cdc71..a8f5c7a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -263,7 +263,7 @@ static void death_by_event(unsigned long ul_conntrack)
if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) {
/* bad luck, let's retry again */
ecache->timeout.expires = jiffies +
- (random32() % net->ct.sysctl_events_retry_timeout);
+ (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(&ecache->timeout);
return;
}
@@ -282,7 +282,7 @@ void nf_ct_dying_timeout(struct nf_conn *ct)
/* set a new timer to retry event delivery */
setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct);
ecache->timeout.expires = jiffies +
- (random32() % net->ct.sysctl_events_retry_timeout);
+ (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(&ecache->timeout);
}
EXPORT_SYMBOL_GPL(nf_ct_dying_timeout);
diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c
index 4fe4fb4..11de55e 100644
--- a/net/netfilter/xt_statistic.c
+++ b/net/netfilter/xt_statistic.c
@@ -37,7 +37,7 @@ statistic_mt(const struct sk_buff *skb, struct xt_action_param *par)
switch (info->mode) {
case XT_STATISTIC_MODE_RANDOM:
- if ((net_random() & 0x7FFFFFFF) < info->u.random.probability)
+ if ((prandom_u32() & 0x7FFFFFFF) < info->u.random.probability)
ret = !ret;
break;
case XT_STATISTIC_MODE_NTH:
--
1.7.11.7
next prev parent reply other threads:[~2012-12-24 2:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-24 2:13 [PATCH 00/29] rename random32 and net_random to prandom Akinobu Mita
2012-12-24 2:14 ` [PATCH 18/29] drivers/net: rename random32() to prandom_u32() Akinobu Mita
2012-12-24 2:14 ` [PATCH 19/29] batman-adv: fix random jitter calculation Akinobu Mita
[not found] ` <1356315256-6572-20-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-25 11:26 ` Antonio Quartulli
[not found] ` <20121225112657.GC2604-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>
2012-12-25 21:35 ` Akinobu Mita
[not found] ` <CAC5umyh1d9XxH2We4e2rjV-OYhbP2ObGC_iwrDeff2hphJ7TzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-25 21:37 ` David Miller
2012-12-24 2:14 ` [PATCH 20/29] batman-adv: rename random32() to prandom_u32() Akinobu Mita
[not found] ` <1356315256-6572-21-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-25 11:30 ` Antonio Quartulli
[not found] ` <20121225113036.GD2604-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>
2013-01-02 11:52 ` Marek Lindner
2012-12-24 2:14 ` [PATCH 21/29] net/sunrpc: rename random32() and net_random() " Akinobu Mita
2012-12-24 2:14 ` [PATCH 22/29] net/sched: " Akinobu Mita
2012-12-24 2:14 ` [PATCH 23/29] net/ipv4: rename " Akinobu Mita
2012-12-24 2:14 ` [PATCH 24/29] net/ipv6: " Akinobu Mita
2012-12-24 2:14 ` Akinobu Mita [this message]
2012-12-24 2:14 ` [PATCH 26/29] net/core: rename random32() and " Akinobu Mita
2012-12-24 2:14 ` [PATCH 27/29] net/core: remove duplicate statements by do-while loop Akinobu Mita
[not found] ` <1356315256-6572-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-24 2:14 ` [PATCH 28/29] net/: rename net_random() to prandom_u32() Akinobu Mita
2012-12-25 0:21 ` Neil Horman
2012-12-25 11:47 ` Akinobu Mita
2012-12-26 0:42 ` Neil Horman
2012-12-24 2:14 ` [PATCH 29/29] remove unused net_random(), net_srandom(), random32(), and srandom32() Akinobu Mita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356315256-6572-26-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=netfilter@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).