summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-24 19:41:25 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-24 21:21:01 +0100
commitaf7441a66d1e3cfb43e0a00785b1636b927f40e6 (patch)
tree30aa4d9a444369de527435ade72ee3397ec942fa /src
parent64b5f41e1723a034fab8eee45931e1aa8b50e104 (diff)
downloadouroboros-af7441a66d1e3cfb43e0a00785b1636b927f40e6.tar.gz
ouroboros-af7441a66d1e3cfb43e0a00785b1636b927f40e6.zip
ipcpd: Use high resolution seed for flat policy
This avoids normal ipcps using the flat address policy having a high probability for picking the same address when created from a script.
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/normal/pol/flat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ipcpd/normal/pol/flat.c b/src/ipcpd/normal/pol/flat.c
index 0ab1e604..8a0570f8 100644
--- a/src/ipcpd/normal/pol/flat.c
+++ b/src/ipcpd/normal/pol/flat.c
@@ -133,9 +133,12 @@ int flat_init(void)
{
struct ro_attr rattr;
pthread_condattr_t cattr;
+ struct timespec t;
char * name;
- srand(time(NULL));
+ clock_gettime(CLOCK_REALTIME, &t);
+
+ srand(t.tv_nsec);
flat.addr_in_use = false;
ro_attr_init(&rattr);