aboutsummaryrefslogtreecommitdiff
path: root/resolv/res_query.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-06-24 18:16:41 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-06-24 18:18:44 +0200
commitf282cdbe7f436c75864e5640a409a10485e9abb2 (patch)
tree82983c97f959dd19508b1ef3c89f2aa1b8e8db30 /resolv/res_query.c
parent62a321b12d0e397af88fa422db65079332f971dc (diff)
downloadglibc-f282cdbe7f436c75864e5640a409a10485e9abb2.zip
glibc-f282cdbe7f436c75864e5640a409a10485e9abb2.tar.gz
glibc-f282cdbe7f436c75864e5640a409a10485e9abb2.tar.bz2
resolv: Implement no-aaaa stub resolver option
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'resolv/res_query.c')
-rw-r--r--resolv/res_query.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 3b5c604..049de91b 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -204,10 +204,26 @@ __res_context_query (struct resolv_context *ctx, const char *name,
free (buf);
return (n);
}
- assert (answerp == NULL || (void *) *answerp == (void *) answer);
- n = __res_context_send (ctx, query1, nquery1, query2, nquery2, answer,
- anslen, answerp, answerp2, nanswerp2, resplen2,
- answerp2_malloced);
+
+ /* Suppress AAAA lookups if required. __res_handle_no_aaaa
+ checks RES_NOAAAA first, so avoids parsing the
+ just-generated query packet in most cases. nss_dns avoids
+ using T_QUERY_A_AND_AAAA in RES_NOAAAA mode, so there is no
+ need to handle it here. */
+ if (type == T_AAAA && __res_handle_no_aaaa (ctx, query1, nquery1,
+ answer, anslen, &n))
+ /* There must be no second query for AAAA queries. The code
+ below is still needed to translate NODATA responses. */
+ assert (query2 == NULL);
+ else
+ {
+ assert (answerp == NULL || (void *) *answerp == (void *) answer);
+ n = __res_context_send (ctx, query1, nquery1, query2, nquery2,
+ answer, anslen,
+ answerp, answerp2, nanswerp2, resplen2,
+ answerp2_malloced);
+ }
+
if (use_malloc)
free (buf);
if (n < 0) {