summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Schlyter <jakob@cvs.openbsd.org>2003-01-20 21:36:25 +0000
committerJakob Schlyter <jakob@cvs.openbsd.org>2003-01-20 21:36:25 +0000
commit2ba2f62de600424a7c704a20df974a1c27776b1e (patch)
tree47fd7e2c97e11c55650058caa30a2704236d805c
parentb07ad931ce67b633dbc54591667b9c42d73d275f (diff)
better id generation
-rw-r--r--usr.sbin/bind/bin/dig/dighost.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/bind/bin/dig/dighost.c b/usr.sbin/bind/bin/dig/dighost.c
index ca2eb668aa5..db7f0561fe7 100644
--- a/usr.sbin/bind/bin/dig/dighost.c
+++ b/usr.sbin/bind/bin/dig/dighost.c
@@ -54,6 +54,7 @@
#include <isc/netaddr.h>
#include <isc/netdb.h>
#include <isc/print.h>
+#include <isc/random.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/task.h>
@@ -689,7 +690,6 @@ setup_libs(void) {
* just use random() now for getting id values, but doing so
* does NOT ensure that id's can't be guessed.
*/
- srandom(getpid());
result = isc_net_probeipv4();
if (result == ISC_R_SUCCESS)
@@ -1162,6 +1162,7 @@ insert_soa(dig_lookup_t *lookup) {
void
setup_lookup(dig_lookup_t *lookup) {
isc_result_t result;
+ isc_uint32_t id;
int len;
dig_server_t *serv;
dig_query_t *query;
@@ -1275,7 +1276,8 @@ setup_lookup(dig_lookup_t *lookup) {
trying(store, lookup);
INSIST(dns_name_isabsolute(lookup->name));
- lookup->sendmsg->id = (unsigned short)(random() & 0xFFFF);
+ isc_random_get(&id);
+ lookup->sendmsg->id = (unsigned short)id & 0xFFFF;
lookup->sendmsg->opcode = dns_opcode_query;
lookup->msgcounter = 0;
/*