Dear Josh, In message <55f91588.3040...@atmel.com> you wrote: > > In above commands, I have two duplicated eth addr: > 92:33:16:3f:0a:56 > d2:41:66:54:64:aa
Agreed. Randomness is really poor; for a sequence of 1000 invocations of gen_eth_addr in a shell loop I would only gt 124 different MAC addresses: -> for i in {1..1000} ; do ./gen_eth_addr ; done >/tmp/0 -> sort -u /tmp/0 >/tmp/1 ; wc -l /tmp/[01] 1000 /tmp/0 124 /tmp/1 In a second run, even only 41 :-( But without the getpid() part, it gets even worse - the same loop would produce only 15 different addresses! Changing the '|' into a '+' would reliably generate 1000 different MAC addresses. > I understand your concern. My intention is make it harder to generate > the duplicated result. I understand this, and agree that we should implement such a fix. > Maybe we can ORing the MSB of time(0)? > I'll investigate it little more. The following patch appears to work fine for me. Maybe you can test it? diff --git a/tools/gen_eth_addr.c b/tools/gen_eth_addr.c index bf9d935..834163a 100644 --- a/tools/gen_eth_addr.c +++ b/tools/gen_eth_addr.c @@ -15,7 +15,7 @@ main(int argc, char *argv[]) { unsigned long ethaddr_low, ethaddr_high; - srand(time(0) | getpid()); + srand(time(0) + getpid()); /* * setting the 2nd LSB in the most significant byte of Thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de I think that all right-thinking people in this country are sick and tired of being told that ordinary decent people are fed up in this country with being sick and tired. I'm certainly not. But I'm sick and tired of being told that I am. - Monty Python _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot