ConnectivityFoundry / AwaLWM2M

Awa LWM2M is an implementation of the OMA Lightweight M2M protocol in C.
BSD 3-Clause "New" or "Revised" License
102 stars 66 forks source link

Contiki random port is not random #354

Open mtusnio opened 7 years ago

mtusnio commented 7 years ago

The rand() call after srand(time(NULL)) always results in 0, which means that the static API always binds itself to the port 6000. Removing the srand causes the port 18585 to be always used, so in the end I can think of 2 options:

a) assume that the application has to srand with a seed and move the responsibility to the application b) abstract the call for srand and implement seeding on every platform.