Skip to content

Commit

Permalink
Merge pull request #264 from delme-imgtec/dtls
Browse files Browse the repository at this point in the history
Seed random generator in daemons
  • Loading branch information
Rory Latchem authored Jul 28, 2016
2 parents 81f6ed3 + 6c11b3d commit 223bfd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/bootstrap/lwm2m_bootstrap_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <dirent.h>
#include <errno.h>
#include <signal.h>
#include <time.h>

#include "awa_bootstrapd_cmdline.h"
#include "lwm2m_object_store.h"
Expand Down Expand Up @@ -191,6 +192,8 @@ static int Bootstrap_Start(Options * options)
ipAddress[NI_MAXHOST - 1] = '\0'; // Defensive
}

srandom((int)time(NULL)*getpid());

CoapInfo * coap = coap_Init(ipAddress, options->CoapPort, options->Secure, (options->Verbose) ? DebugLevel_Debug : DebugLevel_Info);
if (coap == NULL)
{
Expand Down
3 changes: 3 additions & 0 deletions core/src/client/lwm2m_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <dirent.h>
#include <errno.h>
#include <signal.h>
#include <time.h>

#include "awa_clientd_cmdline.h"
#include "objdefs.h"
Expand Down Expand Up @@ -221,6 +222,8 @@ static int Lwm2mClient_Start(Options * options)

Lwm2mCore_SetDefaultContentType(options->DefaultContentType);

srandom((int)time(NULL)*getpid());

CoapInfo * coap = coap_Init((options->AddressFamily == AF_INET) ? "0.0.0.0" : "::", options->CoapPort, false /* not a server */, (options->Verbose) ? DebugLevel_Debug : DebugLevel_Info);
if (coap == NULL)
{
Expand Down
3 changes: 3 additions & 0 deletions core/src/server/lwm2m_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <dirent.h>
#include <errno.h>
#include <signal.h>
#include <time.h>

#include "awa_serverd_cmdline.h"
#include "objdefs.h"
Expand Down Expand Up @@ -198,6 +199,8 @@ static int Lwm2mServer_Start(Options * options)
ipAddress[NI_MAXHOST - 1] = '\0'; // Defensive
}

srandom((int)time(NULL)*getpid());

CoapInfo * coap = coap_Init(ipAddress, options->CoapPort, options->Secure, (options->Verbose) ? DebugLevel_Debug : DebugLevel_Info);
if (coap == NULL)
{
Expand Down

0 comments on commit 223bfd4

Please sign in to comment.