aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--resolv/res_init.c5
-rw-r--r--resolv/res_mkquery.c12
3 files changed, 11 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 54dc010..644f5ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-04 Jakub Jelinek <jakub@redhat.com>
+
+ * resolv/res_mkquery.c (res_nmkquery): Set hp->id to statp->id after
+ randomization rather than before.
+ * resolv/res_init.c (res_randomid): Don't call gettimeofday here.
+
2006-08-31 Jakub Jelinek <jakub@redhat.com>
* dlfcn/Makefile (LDLIBS-bug-atexit3-lib.so): Add
diff --git a/resolv/res_init.c b/resolv/res_init.c
index f881060..b5a03d1 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -537,10 +537,7 @@ net_mask(in) /* XXX - should really use system's version of this */
u_int
res_randomid(void) {
- struct timeval now;
-
- __gettimeofday(&now, NULL);
- return (0xffff & (now.tv_sec ^ now.tv_usec ^ __getpid()));
+ return 0xffff & __getpid();
}
#ifdef _LIBC
libc_hidden_def (__res_randomid)
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 4d98b8c..fd80569 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -124,24 +124,20 @@ res_nmkquery(res_state statp,
incremented by one after the initial randomization which
still predictable if the application does multiple
requests. */
-#if 0
- hp->id = htons(++statp->id);
-#else
- hp->id = htons(statp->id);
int randombits;
do
{
-# ifdef RANDOM_BITS
+#ifdef RANDOM_BITS
RANDOM_BITS (randombits);
-# else
+#else
struct timeval tv;
__gettimeofday (&tv, NULL);
randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
-# endif
+#endif
}
while ((randombits & 0xffff) == 0);
statp->id = (statp->id + randombits) & 0xffff;
-#endif
+ hp->id = statp->id;
hp->opcode = op;
hp->rd = (statp->options & RES_RECURSE) != 0;
hp->rcode = NOERROR;