[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110609210157.6a1f016b@nehalam.ftrdhcpuser.net>
Date: Thu, 9 Jun 2011 21:01:57 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: "Michael Chan" <mchan@...adcom.com>
Cc: "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
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.
--
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