
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 ;)