#include <isc/mutex.h>
#include <isc/print.h>
#include <isc/random.h>
+#include <isc/shuffle.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/time.h>
unsigned int qid_increment; /*%< id increment on collision */
isc_mutex_t lock;
dns_displist_t *qid_table; /*%< the table itself */
+ isc_shuffle_t qid_shuffle; /*%< state generator info */
} dns_qid_t;
/* ARC4 Random generator state */
qid->qid_nbuckets = buckets;
qid->qid_increment = increment;
qid->magic = QID_MAGIC;
+ isc_shuffle_init(&qid->qid_shuffle);
*qidp = qid;
return (ISC_R_SUCCESS);
}
/*
* Try somewhat hard to find an unique ID.
*/
- id = (dns_messageid_t)dispatch_arc4random(disp->mgr);
qid = DNS_QID(disp);
+ id = (dns_messageid_t)isc_shuffle_generate16(&qid->qid_shuffle);
LOCK(&qid->lock);
bucket = dns_hash(qid, dest, id, disp->localport);
ok = ISC_FALSE;