diff options
Diffstat (limited to 'src/lib/libc/net/res_send.c')
-rw-r--r-- | src/lib/libc/net/res_send.c | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/src/lib/libc/net/res_send.c b/src/lib/libc/net/res_send.c index 51fa777142..04eb268d90 100644 --- a/src/lib/libc/net/res_send.c +++ b/src/lib/libc/net/res_send.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: res_send.c,v 1.16 2004/11/17 01:42:26 itojun Exp $ */ | 1 | /* $OpenBSD: res_send.c,v 1.17 2005/03/25 13:24:12 otto Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ++Copyright++ 1985, 1989, 1993 | 4 | * ++Copyright++ 1985, 1989, 1993 |
@@ -60,7 +60,7 @@ | |||
60 | static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; | 60 | static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; |
61 | static char rcsid[] = "$From: res_send.c,v 8.12 1996/10/08 04:51:06 vixie Exp $"; | 61 | static char rcsid[] = "$From: res_send.c,v 8.12 1996/10/08 04:51:06 vixie Exp $"; |
62 | #else | 62 | #else |
63 | static char rcsid[] = "$OpenBSD: res_send.c,v 1.16 2004/11/17 01:42:26 itojun Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_send.c,v 1.17 2005/03/25 13:24:12 otto Exp $"; |
64 | #endif | 64 | #endif |
65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ |
66 | 66 | ||
@@ -128,11 +128,7 @@ static void Aerror(FILE *, char *, int, struct sockaddr *); | |||
128 | static void Perror(FILE *, char *, int); | 128 | static void Perror(FILE *, char *, int); |
129 | 129 | ||
130 | static void | 130 | static void |
131 | Aerror(file, string, error, address) | 131 | Aerror(FILE *file, char *string, int error, struct sockaddr *address) |
132 | FILE *file; | ||
133 | char *string; | ||
134 | int error; | ||
135 | struct sockaddr *address; | ||
136 | { | 132 | { |
137 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | 133 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); |
138 | int save = errno; | 134 | int save = errno; |
@@ -149,10 +145,7 @@ static void Perror(FILE *, char *, int); | |||
149 | errno = save; | 145 | errno = save; |
150 | } | 146 | } |
151 | static void | 147 | static void |
152 | Perror(file, string, error) | 148 | Perror(FILE *file, char *string, int error) |
153 | FILE *file; | ||
154 | char *string; | ||
155 | int error; | ||
156 | { | 149 | { |
157 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | 150 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); |
158 | int save = errno; | 151 | int save = errno; |
@@ -169,16 +162,14 @@ static res_send_qhook Qhook = NULL; | |||
169 | static res_send_rhook Rhook = NULL; | 162 | static res_send_rhook Rhook = NULL; |
170 | 163 | ||
171 | void | 164 | void |
172 | res_send_setqhook(hook) | 165 | res_send_setqhook(res_send_qhook hook) |
173 | res_send_qhook hook; | ||
174 | { | 166 | { |
175 | 167 | ||
176 | Qhook = hook; | 168 | Qhook = hook; |
177 | } | 169 | } |
178 | 170 | ||
179 | void | 171 | void |
180 | res_send_setrhook(hook) | 172 | res_send_setrhook(res_send_rhook hook) |
181 | res_send_rhook hook; | ||
182 | { | 173 | { |
183 | 174 | ||
184 | Rhook = hook; | 175 | Rhook = hook; |
@@ -191,8 +182,7 @@ static struct sockaddr * get_nsaddr(size_t); | |||
191 | * pick appropriate nsaddr_list for use. see res_init() for initialization. | 182 | * pick appropriate nsaddr_list for use. see res_init() for initialization. |
192 | */ | 183 | */ |
193 | static struct sockaddr * | 184 | static struct sockaddr * |
194 | get_nsaddr(n) | 185 | get_nsaddr(size_t n) |
195 | size_t n; | ||
196 | { | 186 | { |
197 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | 187 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); |
198 | struct __res_state_ext *_res_extp = _THREAD_PRIVATE(_res_ext, _res_ext, | 188 | struct __res_state_ext *_res_extp = _THREAD_PRIVATE(_res_ext, _res_ext, |
@@ -228,8 +218,7 @@ get_nsaddr(n) | |||
228 | * paul vixie, 29may94 | 218 | * paul vixie, 29may94 |
229 | */ | 219 | */ |
230 | int | 220 | int |
231 | res_isourserver(inp) | 221 | res_isourserver(const struct sockaddr_in *inp) |
232 | const struct sockaddr_in *inp; | ||
233 | { | 222 | { |
234 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | 223 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); |
235 | #ifdef INET6 | 224 | #ifdef INET6 |
@@ -284,17 +273,15 @@ res_isourserver(inp) | |||
284 | * paul vixie, 29may94 | 273 | * paul vixie, 29may94 |
285 | */ | 274 | */ |
286 | int | 275 | int |
287 | res_nameinquery(name, type, class, buf, eom) | 276 | res_nameinquery(const char *name, int type, int class, const u_char *buf, |
288 | const char *name; | 277 | const u_char *eom) |
289 | register int type, class; | ||
290 | const u_char *buf, *eom; | ||
291 | { | 278 | { |
292 | register const u_char *cp = buf + HFIXEDSZ; | 279 | const u_char *cp = buf + HFIXEDSZ; |
293 | int qdcount = ntohs(((HEADER*)buf)->qdcount); | 280 | int qdcount = ntohs(((HEADER*)buf)->qdcount); |
294 | 281 | ||
295 | while (qdcount-- > 0) { | 282 | while (qdcount-- > 0) { |
296 | char tname[MAXDNAME+1]; | 283 | char tname[MAXDNAME+1]; |
297 | register int n, ttype, tclass; | 284 | int n, ttype, tclass; |
298 | 285 | ||
299 | n = dn_expand(buf, eom, cp, tname, sizeof tname); | 286 | n = dn_expand(buf, eom, cp, tname, sizeof tname); |
300 | if (n < 0) | 287 | if (n < 0) |
@@ -322,18 +309,17 @@ res_nameinquery(name, type, class, buf, eom) | |||
322 | * paul vixie, 29may94 | 309 | * paul vixie, 29may94 |
323 | */ | 310 | */ |
324 | int | 311 | int |
325 | res_queriesmatch(buf1, eom1, buf2, eom2) | 312 | res_queriesmatch(const u_char *buf1, const u_char *eom1, const u_char *buf2, |
326 | const u_char *buf1, *eom1; | 313 | const u_char *eom2) |
327 | const u_char *buf2, *eom2; | ||
328 | { | 314 | { |
329 | register const u_char *cp = buf1 + HFIXEDSZ; | 315 | const u_char *cp = buf1 + HFIXEDSZ; |
330 | int qdcount = ntohs(((HEADER*)buf1)->qdcount); | 316 | int qdcount = ntohs(((HEADER*)buf1)->qdcount); |
331 | 317 | ||
332 | if (qdcount != ntohs(((HEADER*)buf2)->qdcount)) | 318 | if (qdcount != ntohs(((HEADER*)buf2)->qdcount)) |
333 | return (0); | 319 | return (0); |
334 | while (qdcount-- > 0) { | 320 | while (qdcount-- > 0) { |
335 | char tname[MAXDNAME+1]; | 321 | char tname[MAXDNAME+1]; |
336 | register int n, ttype, tclass; | 322 | int n, ttype, tclass; |
337 | 323 | ||
338 | n = dn_expand(buf1, eom1, cp, tname, sizeof tname); | 324 | n = dn_expand(buf1, eom1, cp, tname, sizeof tname); |
339 | if (n < 0) | 325 | if (n < 0) |
@@ -348,17 +334,13 @@ res_queriesmatch(buf1, eom1, buf2, eom2) | |||
348 | } | 334 | } |
349 | 335 | ||
350 | int | 336 | int |
351 | res_send(buf, buflen, ans, anssiz) | 337 | res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) |
352 | const u_char *buf; | ||
353 | int buflen; | ||
354 | u_char *ans; | ||
355 | int anssiz; | ||
356 | { | 338 | { |
357 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); | 339 | struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res); |
358 | HEADER *hp = (HEADER *) buf; | 340 | HEADER *hp = (HEADER *) buf; |
359 | HEADER *anhp = (HEADER *) ans; | 341 | HEADER *anhp = (HEADER *) ans; |
360 | int gotsomewhere, connreset, terrno, try, v_circuit, resplen, ns; | 342 | int gotsomewhere, connreset, terrno, try, v_circuit, resplen, ns; |
361 | register int n; | 343 | int n; |
362 | u_int badns; /* XXX NSMAX can't exceed #/bits in this var */ | 344 | u_int badns; /* XXX NSMAX can't exceed #/bits in this var */ |
363 | 345 | ||
364 | if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { | 346 | if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { |
@@ -885,7 +867,7 @@ read_len: | |||
885 | * This routine is not expected to be user visible. | 867 | * This routine is not expected to be user visible. |
886 | */ | 868 | */ |
887 | void | 869 | void |
888 | res_close() | 870 | res_close(void) |
889 | { | 871 | { |
890 | if (s >= 0) { | 872 | if (s >= 0) { |
891 | (void) close(s); | 873 | (void) close(s); |