summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr/gethostnamadr_async.c
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2019-06-27 05:26:37 +0000
committermartijn <martijn@openbsd.org>2019-06-27 05:26:37 +0000
commite45d70c8b6187efbf0d77c599b98c0621570709a (patch)
tree280d5802457c1fe714b5deb91926b8752f756b49 /lib/libc/asr/gethostnamadr_async.c
parentAllow filters to log information through stderr. This simplifies and (diff)
downloadwireguard-openbsd-e45d70c8b6187efbf0d77c599b98c0621570709a.tar.xz
wireguard-openbsd-e45d70c8b6187efbf0d77c599b98c0621570709a.zip
If we don't receive a reply packet the res_send subquery will already have
set subq_h_errno and ar_count. Remove the ar_datalen == -1 check, so we set ar_h_errno and don't have to (wrongly) guess that ar_h_errno = HOST_NOT_FOUND. This makes sure that if no nameserver responds the h_errno value is set to TRY_AGAIN instead of HOST_NOT_FOUND. OK eric@, deraadt@
Diffstat (limited to 'lib/libc/asr/gethostnamadr_async.c')
-rw-r--r--lib/libc/asr/gethostnamadr_async.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libc/asr/gethostnamadr_async.c b/lib/libc/asr/gethostnamadr_async.c
index 1c30c08a0df..ecda0ffb5d4 100644
--- a/lib/libc/asr/gethostnamadr_async.c
+++ b/lib/libc/asr/gethostnamadr_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gethostnamadr_async.c,v 1.44 2018/04/28 15:16:49 schwarze Exp $ */
+/* $OpenBSD: gethostnamadr_async.c,v 1.45 2019/06/27 05:26:37 martijn Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -289,12 +289,10 @@ gethostnamadr_async_run(struct asr_query *as, struct asr_result *ar)
/* Done. */
as->as_subq = NULL;
- if (ar->ar_datalen == -1) {
- async_set_state(as, ASR_STATE_NEXT_DB);
- break;
- }
-
- /* If we got a packet but no anwser, use the next DB. */
+ /*
+ * We either got no packet or a packet without an answer.
+ * Saveguard the h_errno and use the next DB.
+ */
if (ar->ar_count == 0) {
free(ar->ar_data);
as->as.hostnamadr.subq_h_errno = ar->ar_h_errno;