diff options
author | provos <> | 1997-04-13 21:30:47 +0000 |
---|---|---|
committer | provos <> | 1997-04-13 21:30:47 +0000 |
commit | 8748c1e58b42a18ddefc3a3c64dcef04f063fd73 (patch) | |
tree | 0b205c7047810284d55a96e138cbef206efe861c /src/lib/libc/net/res_mkquery.c | |
parent | d4f803e80d72c0e5d6d296286646ccc5dc01c32d (diff) | |
download | openbsd-8748c1e58b42a18ddefc3a3c64dcef04f063fd73.tar.gz openbsd-8748c1e58b42a18ddefc3a3c64dcef04f063fd73.tar.bz2 openbsd-8748c1e58b42a18ddefc3a3c64dcef04f063fd73.zip |
the before mentioned random number generator.
Diffstat (limited to 'src/lib/libc/net/res_mkquery.c')
-rw-r--r-- | src/lib/libc/net/res_mkquery.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/libc/net/res_mkquery.c b/src/lib/libc/net/res_mkquery.c index 5faba01748..2c244c24fc 100644 --- a/src/lib/libc/net/res_mkquery.c +++ b/src/lib/libc/net/res_mkquery.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: res_mkquery.c,v 1.6 1997/03/13 19:07:39 downsj Exp $ */ | 1 | /* $OpenBSD: res_mkquery.c,v 1.7 1997/04/13 21:30:46 provos Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ++Copyright++ 1985, 1993 | 4 | * ++Copyright++ 1985, 1993 |
@@ -60,7 +60,7 @@ | |||
60 | static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; | 60 | static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; |
61 | static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; | 61 | static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; |
62 | #else | 62 | #else |
63 | static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.6 1997/03/13 19:07:39 downsj Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.7 1997/04/13 21:30:46 provos Exp $"; |
64 | #endif | 64 | #endif |
65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ |
66 | 66 | ||
@@ -106,12 +106,17 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) | |||
106 | #endif | 106 | #endif |
107 | /* | 107 | /* |
108 | * Initialize header fields. | 108 | * Initialize header fields. |
109 | * | ||
110 | * A special random number generator is used to create non predictable | ||
111 | * and non repeating ids over a long period. It also avoids reuse | ||
112 | * by switching between two distinct number cycles. | ||
109 | */ | 113 | */ |
114 | |||
110 | if ((buf == NULL) || (buflen < HFIXEDSZ)) | 115 | if ((buf == NULL) || (buflen < HFIXEDSZ)) |
111 | return (-1); | 116 | return (-1); |
112 | bzero(buf, HFIXEDSZ); | 117 | bzero(buf, HFIXEDSZ); |
113 | hp = (HEADER *) buf; | 118 | hp = (HEADER *) buf; |
114 | hp->id = htons(++_res.id); | 119 | hp->id = htons(_res.id=res_randomid()); |
115 | hp->opcode = op; | 120 | hp->opcode = op; |
116 | hp->rd = (_res.options & RES_RECURSE) != 0; | 121 | hp->rd = (_res.options & RES_RECURSE) != 0; |
117 | hp->rcode = NOERROR; | 122 | hp->rcode = NOERROR; |