haukepetersen opened a new pull request #856:
URL: https://github.com/apache/mynewt-nimble/pull/856


   This one took me a long time to find and it had devastating effects: the 
STDLIBs pseudo random number generator was not properly seeded by the 
controller. As the comment in the code, wisely starting with `XXX`, perfectly 
stated: `This really doesn't belong here, as the address probably has not been 
set yet.`. At least when using the NimBLE controller with RIOT, that comment is 
absolutely true... So when running multiple nodes, all use the same seed making 
their random number identical.
   
   When running my deployment using 15 nRF52xxx nodes in a multi-hop network, I 
observed the following faulty behaviors:
   - application data was duplicated and received on nodes that did not have a 
direct connection to nodes sending this data
   - L2CAP COC flow control getting out of sync: RX or TX credit counts 
exceeding their initial limits
   
   As far as I can tell by now, this was all caused by multiple connections 
using the same access addresses, in term caused by all nodes using the same 
seed value.
   
   Now this PR fixes the seeding issue by simply using the hardware random 
number generator to seed the pseudo random number generator. This way it should 
be guaranteed, that nodes always use different seed values. Also the 
runtime-overhead should be acceptable, since this is only called once during 
controller initialization.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to