From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
netdev@vger.kernel.org
Subject: [PATCH 24/29] net/ipv6: rename net_random() to prandom_u32()
Date: Mon, 24 Dec 2012 11:14:11 +0900 [thread overview]
Message-ID: <1356315256-6572-25-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: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org
---
net/ipv6/addrconf.c | 4 ++--
net/ipv6/ip6_flowlabel.c | 2 +-
net/ipv6/mcast.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 408cac4a..314b134 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3038,7 +3038,7 @@ static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
if (ifp->flags & IFA_F_OPTIMISTIC)
rand_num = 0;
else
- rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
+ rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1);
ifp->probes = idev->cnf.dad_transmits;
addrconf_mod_timer(ifp, AC_DAD, rand_num);
@@ -3051,7 +3051,7 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp)
addrconf_join_solict(dev, &ifp->addr);
- net_srandom(ifp->addr.s6_addr32[3]);
+ prandom_seed((__force u32)ifp->addr.s6_addr32[3]);
read_lock_bh(&idev->lock);
spin_lock(&ifp->lock);
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 29124b7..313f8bf 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -191,7 +191,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net,
write_lock_bh(&ip6_fl_lock);
if (label == 0) {
for (;;) {
- fl->label = htonl(net_random())&IPV6_FLOWLABEL_MASK;
+ fl->label = htonl(prandom_u32()) & IPV6_FLOWLABEL_MASK;
if (fl->label) {
lfl = __fl_lookup(net, fl->label);
if (lfl == NULL)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 28dfa5f..71af892 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1006,7 +1006,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
static void mld_gq_start_timer(struct inet6_dev *idev)
{
- int tv = net_random() % idev->mc_maxdelay;
+ int tv = prandom_u32() % idev->mc_maxdelay;
idev->mc_gq_running = 1;
if (!mod_timer(&idev->mc_gq_timer, jiffies+tv+2))
@@ -1015,7 +1015,7 @@ static void mld_gq_start_timer(struct inet6_dev *idev)
static void mld_ifc_start_timer(struct inet6_dev *idev, int delay)
{
- int tv = net_random() % delay;
+ int tv = prandom_u32() % delay;
if (!mod_timer(&idev->mc_ifc_timer, jiffies+tv+2))
in6_dev_hold(idev);
@@ -1041,7 +1041,7 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime)
if (delay >= resptime) {
if (resptime)
- delay = net_random() % resptime;
+ delay = prandom_u32() % resptime;
else
delay = 1;
}
@@ -2102,7 +2102,7 @@ static void igmp6_join_group(struct ifmcaddr6 *ma)
igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT);
- delay = net_random() % IGMP6_UNSOLICITED_IVAL;
+ delay = prandom_u32() % IGMP6_UNSOLICITED_IVAL;
spin_lock_bh(&ma->mca_lock);
if (del_timer(&ma->mca_timer)) {
--
1.7.11.7
next prev parent reply other threads:[~2012-12-24 2:15 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 ` Akinobu Mita [this message]
2012-12-24 2:14 ` [PATCH 25/29] net/netfilter: rename random32() and " Akinobu Mita
2012-12-24 2:14 ` [PATCH 26/29] net/core: " 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-25-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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).