summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorderaadt <>1996-09-22 02:18:44 +0000
committerderaadt <>1996-09-22 02:18:44 +0000
commit52b1de54526adaec8535e7feb5b52431ec662c22 (patch)
tree1b485910bcfe2ca63f9bd6fc789d231aab0aaac8 /src/lib
parented150626d7f9f9e2a8ed1c480bbd8bf09cfc107a (diff)
downloadopenbsd-52b1de54526adaec8535e7feb5b52431ec662c22.tar.gz
openbsd-52b1de54526adaec8535e7feb5b52431ec662c22.tar.bz2
openbsd-52b1de54526adaec8535e7feb5b52431ec662c22.zip
randomize _res.id at start; could do better i hope
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/net/res_init.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c
index 355c9ce1b0..85e0c8211e 100644
--- a/src/lib/libc/net/res_init.c
+++ b/src/lib/libc/net/res_init.c
@@ -52,7 +52,7 @@
52 */ 52 */
53 53
54#if defined(LIBC_SCCS) && !defined(lint) 54#if defined(LIBC_SCCS) && !defined(lint)
55static char rcsid[] = "$OpenBSD: res_init.c,v 1.7 1996/09/15 09:31:19 tholo Exp $"; 55static char rcsid[] = "$OpenBSD: res_init.c,v 1.8 1996/09/22 02:18:44 deraadt Exp $";
56#endif /* LIBC_SCCS and not lint */ 56#endif /* LIBC_SCCS and not lint */
57 57
58#include <sys/param.h> 58#include <sys/param.h>
@@ -68,6 +68,7 @@ static char rcsid[] = "$OpenBSD: res_init.c,v 1.7 1996/09/15 09:31:19 tholo Exp
68 68
69static void res_setoptions __P((char *, char *)); 69static void res_setoptions __P((char *, char *));
70static u_int32_t net_mask __P((struct in_addr)); 70static u_int32_t net_mask __P((struct in_addr));
71static u_int16_t res_randomid __P((void));
71 72
72/* 73/*
73 * Resolver state default settings 74 * Resolver state default settings
@@ -113,6 +114,9 @@ res_init()
113 int havesearch = 0; 114 int havesearch = 0;
114 int nsort = 0; 115 int nsort = 0;
115 116
117 if (_res.id == 0)
118 _res.id = res_randomid();
119
116 _res.nsaddr.sin_len = sizeof(struct sockaddr_in); 120 _res.nsaddr.sin_len = sizeof(struct sockaddr_in);
117 _res.nsaddr.sin_family = AF_INET; 121 _res.nsaddr.sin_family = AF_INET;
118 _res.nsaddr.sin_port = htons(NAMESERVER_PORT); 122 _res.nsaddr.sin_port = htons(NAMESERVER_PORT);
@@ -403,8 +407,8 @@ net_mask(in) /* XXX - should really use system's version of this */
403 return (htonl(IN_CLASSC_NET)); 407 return (htonl(IN_CLASSC_NET));
404} 408}
405 409
406u_int16_t 410static u_int16_t
407res_randomid() 411__res_randomid()
408{ 412{
409 struct timeval now; 413 struct timeval now;
410 414