]> granicus.if.org Git - pdns/commitdiff
further randomisation improvements
authorBert Hubert <bert.hubert@netherlabs.nl>
Fri, 25 Apr 2008 09:02:49 +0000 (09:02 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Fri, 25 Apr 2008 09:02:49 +0000 (09:02 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1179 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/aes/dns_random.cc
pdns/pdns_recursor.cc

index e5aa0cbe2d1f337d74eb5f1db237c3cdfb51bbcb..36389f67d93f992e44688c33e4e20cf78f4b984c 100644 (file)
@@ -23,8 +23,7 @@ void dns_random_init(const char data[16])
   memcpy(g_counter, &now.tv_usec, sizeof(now.tv_usec));
   memcpy(g_counter+sizeof(now.tv_usec), &now.tv_sec, sizeof(now.tv_sec));
   g_in = getpid() | (getppid()<<16);
-
-  srandom(now.tv_usec);
+  srandom(dns_random(numeric_limits<uint32_t>::max()));
 }
 
 static void counterIncrement(unsigned char* counter)
index 74c5a977121d762465f44b75266492831989f5b4..5554465211ad141c8ed7847600da43f48e71a0b5 100644 (file)
@@ -271,7 +271,7 @@ public:
     
     int tries=10;
     while(--tries) {
-      uint16_t port=1025+Utility::random()%64510;
+      uint16_t port=1025+dns_random(64510);
       if(tries==1)  // fall back to kernel 'random'
        port=0;