From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] net: Remove call of srand from eth_random_enetaddr()
Date: Wed, 09 Jan 2013 09:47:31 +0100 [thread overview]
Message-ID: <20130109084731.F1807200731@gemini.denx.de> (raw)
In-Reply-To: <CABkLObrL2BhKmjh9NCcv1UQ-cbfJisUidK8JoE8DSAOEkqiZ1g@mail.gmail.com>
Dear Christian Riesch,
In message <CABkLObrL2BhKmjh9NCcv1UQ-cbfJisUidK8JoE8DSAOEkqiZ1g@mail.gmail.com> you wrote:
>
> > I don't like this change. What exactly is wrong with using the timer
> > here? It is probably much more random that the (so-called)
> > "un-initialized" memory you suggest to use instead.
>
> On the AM1808 SoC the counter is reset to zero on power up. So using it to
> generate random numbers in code that is called interactively by the user is
> fine and will yield a random MAC address, but in my case I will get the
> same MAC address on each board at each power up.
I think the whole concept of using random MAC adresses is broken. You
should consider thinking about fixing the root cause of your problem.
> > If there is really need to use another inital valu, only this should
> > be fixed - but the srand() call itself should remain as is.
>
> For other boards it may be ok to use a counter, and for some there may be
> no SRAM or it may be already overwritten, e.g by the SPL... Therefore I am
> not changing this for all boards, but make it board specific.
I don't want to see any board specific code here. If using the timer
is not good enough, then pass a weak funtion as argument to srand()
which defaults to using the timer as we do now, and which can be
redefined in board specific code.
Other than this, the common code should not be changed.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The main thing is the play itself. I swear that greed for money has
nothing to do with it, although heaven knows I am sorely in need of
money. - Feodor Dostoyevsky
next prev parent reply other threads:[~2013-01-09 8:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1357653279-29635-1-git-send-email-christian.riesch@omicron.at>
2013-01-08 13:54 ` [U-Boot] [PATCH 1/2] net: Remove call of srand from eth_random_enetaddr() Christian Riesch
2013-01-08 17:37 ` Wolfgang Denk
2013-01-09 7:05 ` Christian Riesch
2013-01-09 8:47 ` Wolfgang Denk [this message]
2013-01-08 13:54 ` [U-Boot] [PATCH 2/2] calimain: Generate random MAC address for factory tests Christian Riesch
2013-01-08 17:39 ` Wolfgang Denk
2013-01-09 8:34 ` Christian Riesch
2013-01-09 9:04 ` Wolfgang Denk
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=20130109084731.F1807200731@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.