[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1307680767.3210.5.camel@edumazet-laptop>
Date: Fri, 10 Jun 2011 06:39:27 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Stephen Hemminger <shemminger@...tta.com>
Cc: Michael Chan <mchan@...adcom.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Eddie Wai <eddie.wai@...adcom.com>
Subject: Re: [PATCH 3/5 net-next] cnic: Randomize initial TCP port for
iSCSI connections
Le jeudi 09 juin 2011 à 21:01 -0700, Stephen Hemminger a écrit :
> On Thu, 9 Jun 2011 18:08:00 -0700
> "Michael Chan" <mchan@...adcom.com> wrote:
>
> >
> > On Thu, 2011-06-09 at 08:27 -0700, Stephen Hemminger wrote:
> > > On Wed, 8 Jun 2011 22:29:34 -0700
> > > "Michael Chan" <mchan@...adcom.com> wrote:
> > >
> > > > static int cnic_cm_alloc_mem(struct cnic_dev *dev)
> > > > {
> > > > struct cnic_local *cp = dev->cnic_priv;
> > > > + u32 port_id;
> > > >
> > > > cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ,
> > > > GFP_KERNEL);
> > > > if (!cp->csk_tbl)
> > > > return -ENOMEM;
> > > >
> > > > + get_random_bytes(&port_id, sizeof(port_id));
> > >
> > > I think random32() or it's alias net_random() would be sufficient
> > > for your needs here.
> > >
> >
> > random32() is pseudo random so we can get the same number after reboot,
> > right? One scenario is that we may be booting from an iSCSI target, but
> > due to some failure, the user may be rebooting multiple times rapidly.
> > We want to use a different port during each boot.
>
> random32 is seeded off get_random_bytes at boot.
cnic_cm_alloc_mem() is apparently called one time per boot, it seems OK
to call get_random_bytes() in this case ?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists