[U-Boot] [PATCH v3 02/21] net: Move MAC-seeded rand out of bootp.c
Michael Walle
michael at walle.cc
Wed May 30 00:54:58 CEST 2012
Hi Joe,
Am Mittwoch 30 Mai 2012, 00:40:18 schrieb Joe Hershberger:
> > Ah now i get it. But which other code may run and seed the NG with the
> > timer only, while we are in the link local netloop? Shouldn't it be safe
> > to first call srand(mac+timer) and then rand() multiple times? No other
> > code can be run unless NetLoop(LINKLOCAL) returns, right?
>
> It needs to run multiple times, yes. But it will also process any
> packets that are received when executing any other net command later.
> The state machine will keep running. There can obviously be other
> commands that run in between.
i guess i have to study the netloop a bit more ;)
>
> Perhaps we can separate the state for the PRNG between the 2 cases but
> share the code.
yeah i was thinking of rand_r().
> >> The most naive way around it
> >> would be to rename the rand() in net to rand_mac() or something like
> >> that and not attempt to combine them.
> >
> > i think we should focus on combining not reinventing the wheel multiple
> > times.
>
> Agreed, but we have to solve the problem above.
fully argreeing ;)
--
michael
More information about the U-Boot
mailing list