1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2014 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 #include "alloc-util.h"
23 #include "dns-domain.h"
24 #include "hostname-util.h"
25 #include "local-addresses.h"
26 #include "resolved-dns-query.h"
27 #include "resolved-dns-synthesize.h"
28 #include "resolved-etc-hosts.h"
29 #include "string-util.h"
31 /* How long to wait for the query in total */
32 #define QUERY_TIMEOUT_USEC (30 * USEC_PER_SEC)
35 #define QUERIES_MAX 2048
36 #define AUXILIARY_QUERIES_MAX 64
38 static int dns_query_candidate_new(DnsQueryCandidate
**ret
, DnsQuery
*q
, DnsScope
*s
) {
45 c
= new0(DnsQueryCandidate
, 1);
52 LIST_PREPEND(candidates_by_query
, q
->candidates
, c
);
53 LIST_PREPEND(candidates_by_scope
, s
->query_candidates
, c
);
59 static void dns_query_candidate_stop(DnsQueryCandidate
*c
) {
64 while ((t
= set_steal_first(c
->transactions
))) {
65 set_remove(t
->notify_query_candidates
, c
);
66 dns_transaction_gc(t
);
70 DnsQueryCandidate
* dns_query_candidate_free(DnsQueryCandidate
*c
) {
75 dns_query_candidate_stop(c
);
77 set_free(c
->transactions
);
78 dns_search_domain_unref(c
->search_domain
);
81 LIST_REMOVE(candidates_by_query
, c
->query
->candidates
, c
);
84 LIST_REMOVE(candidates_by_scope
, c
->scope
->query_candidates
, c
);
91 static int dns_query_candidate_next_search_domain(DnsQueryCandidate
*c
) {
92 DnsSearchDomain
*next
= NULL
;
96 if (c
->search_domain
&& c
->search_domain
->linked
) {
97 next
= c
->search_domain
->domains_next
;
99 if (!next
) /* We hit the end of the list */
103 next
= dns_scope_get_search_domains(c
->scope
);
105 if (!next
) /* OK, there's nothing. */
109 dns_search_domain_unref(c
->search_domain
);
110 c
->search_domain
= dns_search_domain_ref(next
);
115 static int dns_query_candidate_add_transaction(DnsQueryCandidate
*c
, DnsResourceKey
*key
) {
122 t
= dns_scope_find_transaction(c
->scope
, key
, true);
124 r
= dns_transaction_new(&t
, c
->scope
, key
);
128 if (set_contains(c
->transactions
, t
))
132 r
= set_ensure_allocated(&c
->transactions
, NULL
);
136 r
= set_ensure_allocated(&t
->notify_query_candidates
, NULL
);
140 r
= set_put(t
->notify_query_candidates
, c
);
144 r
= set_put(c
->transactions
, t
);
146 (void) set_remove(t
->notify_query_candidates
, c
);
153 dns_transaction_gc(t
);
157 static int dns_query_candidate_go(DnsQueryCandidate
*c
) {
164 /* Start the transactions that are not started yet */
165 SET_FOREACH(t
, c
->transactions
, i
) {
166 if (t
->state
!= DNS_TRANSACTION_NULL
)
169 r
= dns_transaction_go(t
);
177 static DnsTransactionState
dns_query_candidate_state(DnsQueryCandidate
*c
) {
178 DnsTransactionState state
= DNS_TRANSACTION_NO_SERVERS
;
184 if (c
->error_code
!= 0)
185 return DNS_TRANSACTION_RESOURCES
;
187 SET_FOREACH(t
, c
->transactions
, i
) {
191 case DNS_TRANSACTION_NULL
:
192 /* If there's a NULL transaction pending, then
193 * this means not all transactions where
194 * started yet, and we were called from within
195 * the stackframe that is supposed to start
196 * remaining transactions. In this case,
197 * simply claim the candidate is pending. */
199 case DNS_TRANSACTION_PENDING
:
200 case DNS_TRANSACTION_VALIDATING
:
201 /* If there's one transaction currently in
202 * VALIDATING state, then this means there's
203 * also one in PENDING state, hence we can
204 * return PENDING immediately. */
205 return DNS_TRANSACTION_PENDING
;
207 case DNS_TRANSACTION_SUCCESS
:
212 if (state
!= DNS_TRANSACTION_SUCCESS
)
222 static int dns_query_candidate_setup_transactions(DnsQueryCandidate
*c
) {
223 DnsQuestion
*question
;
229 dns_query_candidate_stop(c
);
231 question
= dns_query_question_for_protocol(c
->query
, c
->scope
->protocol
);
233 /* Create one transaction per question key */
234 DNS_QUESTION_FOREACH(key
, question
) {
235 _cleanup_(dns_resource_key_unrefp
) DnsResourceKey
*new_key
= NULL
;
237 if (c
->search_domain
) {
238 r
= dns_resource_key_new_append_suffix(&new_key
, key
, c
->search_domain
->name
);
243 r
= dns_query_candidate_add_transaction(c
, new_key
?: key
);
253 dns_query_candidate_stop(c
);
257 void dns_query_candidate_notify(DnsQueryCandidate
*c
) {
258 DnsTransactionState state
;
263 state
= dns_query_candidate_state(c
);
265 if (DNS_TRANSACTION_IS_LIVE(state
))
268 if (state
!= DNS_TRANSACTION_SUCCESS
&& c
->search_domain
) {
270 r
= dns_query_candidate_next_search_domain(c
);
275 /* OK, there's another search domain to try, let's do so. */
277 r
= dns_query_candidate_setup_transactions(c
);
282 /* New transactions where queued. Start them and wait */
284 r
= dns_query_candidate_go(c
);
294 dns_query_ready(c
->query
);
298 log_warning_errno(r
, "Failed to follow search domains: %m");
300 dns_query_ready(c
->query
);
303 static void dns_query_stop(DnsQuery
*q
) {
304 DnsQueryCandidate
*c
;
308 q
->timeout_event_source
= sd_event_source_unref(q
->timeout_event_source
);
310 LIST_FOREACH(candidates_by_query
, c
, q
->candidates
)
311 dns_query_candidate_stop(c
);
314 static void dns_query_free_candidates(DnsQuery
*q
) {
317 while (q
->candidates
)
318 dns_query_candidate_free(q
->candidates
);
321 static void dns_query_reset_answer(DnsQuery
*q
) {
324 q
->answer
= dns_answer_unref(q
->answer
);
326 q
->answer_dnssec_result
= _DNSSEC_RESULT_INVALID
;
327 q
->answer_authenticated
= false;
328 q
->answer_protocol
= _DNS_PROTOCOL_INVALID
;
329 q
->answer_family
= AF_UNSPEC
;
330 q
->answer_search_domain
= dns_search_domain_unref(q
->answer_search_domain
);
333 DnsQuery
*dns_query_free(DnsQuery
*q
) {
337 while (q
->auxiliary_queries
)
338 dns_query_free(q
->auxiliary_queries
);
340 if (q
->auxiliary_for
) {
341 assert(q
->auxiliary_for
->n_auxiliary_queries
> 0);
342 q
->auxiliary_for
->n_auxiliary_queries
--;
343 LIST_REMOVE(auxiliary_queries
, q
->auxiliary_for
->auxiliary_queries
, q
);
346 dns_query_free_candidates(q
);
348 dns_question_unref(q
->question_idna
);
349 dns_question_unref(q
->question_utf8
);
351 dns_query_reset_answer(q
);
353 sd_bus_message_unref(q
->request
);
354 sd_bus_track_unref(q
->bus_track
);
356 free(q
->request_address_string
);
359 LIST_REMOVE(queries
, q
->manager
->dns_queries
, q
);
360 q
->manager
->n_dns_queries
--;
371 DnsQuestion
*question_utf8
,
372 DnsQuestion
*question_idna
,
373 int ifindex
, uint64_t flags
) {
375 _cleanup_(dns_query_freep
) DnsQuery
*q
= NULL
;
382 if (dns_question_size(question_utf8
) > 0) {
383 r
= dns_question_is_valid_for_query(question_utf8
);
392 /* If the IDNA and UTF8 questions are the same, merge their references */
393 r
= dns_question_is_equal(question_idna
, question_utf8
);
397 question_idna
= question_utf8
;
399 if (dns_question_size(question_idna
) > 0) {
400 r
= dns_question_is_valid_for_query(question_idna
);
410 if (!good
) /* don't allow empty queries */
413 if (m
->n_dns_queries
>= QUERIES_MAX
)
416 q
= new0(DnsQuery
, 1);
420 q
->question_utf8
= dns_question_ref(question_utf8
);
421 q
->question_idna
= dns_question_ref(question_idna
);
422 q
->ifindex
= ifindex
;
424 q
->answer_dnssec_result
= _DNSSEC_RESULT_INVALID
;
425 q
->answer_protocol
= _DNS_PROTOCOL_INVALID
;
426 q
->answer_family
= AF_UNSPEC
;
428 /* First dump UTF8 question */
429 DNS_QUESTION_FOREACH(key
, question_utf8
) {
430 _cleanup_free_
char *p
= NULL
;
432 r
= dns_resource_key_to_string(key
, &p
);
436 log_debug("Looking up RR for %s.", strstrip(p
));
439 /* And then dump the IDNA question, but only what hasn't been dumped already through the UTF8 question. */
440 DNS_QUESTION_FOREACH(key
, question_idna
) {
441 _cleanup_free_
char *p
= NULL
;
443 r
= dns_question_contains(question_utf8
, key
);
449 r
= dns_resource_key_to_string(key
, &p
);
453 log_debug("Looking up IDNA RR for %s.", strstrip(p
));
456 LIST_PREPEND(queries
, m
->dns_queries
, q
);
467 int dns_query_make_auxiliary(DnsQuery
*q
, DnsQuery
*auxiliary_for
) {
469 assert(auxiliary_for
);
471 /* Ensure that that the query is not auxiliary yet, and
472 * nothing else is auxiliary to it either */
473 assert(!q
->auxiliary_for
);
474 assert(!q
->auxiliary_queries
);
476 /* Ensure that the unit we shall be made auxiliary for isn't
477 * auxiliary itself */
478 assert(!auxiliary_for
->auxiliary_for
);
480 if (auxiliary_for
->n_auxiliary_queries
>= AUXILIARY_QUERIES_MAX
)
483 LIST_PREPEND(auxiliary_queries
, auxiliary_for
->auxiliary_queries
, q
);
484 q
->auxiliary_for
= auxiliary_for
;
486 auxiliary_for
->n_auxiliary_queries
++;
490 static void dns_query_complete(DnsQuery
*q
, DnsTransactionState state
) {
492 assert(!DNS_TRANSACTION_IS_LIVE(state
));
493 assert(DNS_TRANSACTION_IS_LIVE(q
->state
));
495 /* Note that this call might invalidate the query. Callers
496 * should hence not attempt to access the query or transaction
497 * after calling this function. */
506 static int on_query_timeout(sd_event_source
*s
, usec_t usec
, void *userdata
) {
507 DnsQuery
*q
= userdata
;
512 dns_query_complete(q
, DNS_TRANSACTION_TIMEOUT
);
516 static int dns_query_add_candidate(DnsQuery
*q
, DnsScope
*s
) {
517 DnsQueryCandidate
*c
;
523 r
= dns_query_candidate_new(&c
, q
, s
);
527 /* If this a single-label domain on DNS, we might append a suitable search domain first. */
528 if ((q
->flags
& SD_RESOLVED_NO_SEARCH
) == 0) {
529 r
= dns_scope_name_needs_search_domain(s
, dns_question_first_name(q
->question_idna
));
533 /* OK, we need a search domain now. Let's find one for this scope */
535 r
= dns_query_candidate_next_search_domain(c
);
536 if (r
<= 0) /* if there's no search domain, then we won't add any transaction. */
541 r
= dns_query_candidate_setup_transactions(c
);
548 dns_query_candidate_free(c
);
552 static int dns_query_synthesize_reply(DnsQuery
*q
, DnsTransactionState
*state
) {
553 _cleanup_(dns_answer_unrefp
) DnsAnswer
*answer
= NULL
;
559 /* Tries to synthesize localhost RR replies (and others) where appropriate. Note that this is done *after* the
560 * the normal lookup finished. The data from the network hence takes precedence over the data we
561 * synthesize. (But note that many scopes refuse to resolve certain domain names) */
564 DNS_TRANSACTION_RCODE_FAILURE
,
565 DNS_TRANSACTION_NO_SERVERS
,
566 DNS_TRANSACTION_TIMEOUT
,
567 DNS_TRANSACTION_ATTEMPTS_MAX_REACHED
,
568 DNS_TRANSACTION_NETWORK_DOWN
,
569 DNS_TRANSACTION_NOT_FOUND
))
572 r
= dns_synthesize_answer(
581 dns_query_reset_answer(q
);
585 q
->answer_rcode
= DNS_RCODE_SUCCESS
;
586 q
->answer_protocol
= dns_synthesize_protocol(q
->flags
);
587 q
->answer_family
= dns_synthesize_family(q
->flags
);
588 q
->answer_authenticated
= true;
590 *state
= DNS_TRANSACTION_SUCCESS
;
595 static int dns_query_try_etc_hosts(DnsQuery
*q
) {
596 _cleanup_(dns_answer_unrefp
) DnsAnswer
*answer
= NULL
;
601 /* Looks in /etc/hosts for matching entries. Note that this is done *before* the normal lookup is done. The
602 * data from /etc/hosts hence takes precedence over the network. */
604 r
= manager_etc_hosts_lookup(
611 dns_query_reset_answer(q
);
615 q
->answer_rcode
= DNS_RCODE_SUCCESS
;
616 q
->answer_protocol
= dns_synthesize_protocol(q
->flags
);
617 q
->answer_family
= dns_synthesize_family(q
->flags
);
618 q
->answer_authenticated
= true;
623 int dns_query_go(DnsQuery
*q
) {
624 DnsScopeMatch found
= DNS_SCOPE_NO
;
625 DnsScope
*s
, *first
= NULL
;
626 DnsQueryCandidate
*c
;
631 if (q
->state
!= DNS_TRANSACTION_NULL
)
634 r
= dns_query_try_etc_hosts(q
);
638 dns_query_complete(q
, DNS_TRANSACTION_SUCCESS
);
642 LIST_FOREACH(scopes
, s
, q
->manager
->dns_scopes
) {
646 name
= dns_question_first_name(dns_query_question_for_protocol(q
, s
->protocol
));
650 match
= dns_scope_good_domain(s
, q
->ifindex
, q
->flags
, name
);
654 if (match
== DNS_SCOPE_NO
)
659 if (match
== DNS_SCOPE_YES
) {
663 assert(match
== DNS_SCOPE_MAYBE
);
670 if (found
== DNS_SCOPE_NO
) {
671 DnsTransactionState state
= DNS_TRANSACTION_NO_SERVERS
;
673 dns_query_synthesize_reply(q
, &state
);
674 dns_query_complete(q
, state
);
678 r
= dns_query_add_candidate(q
, first
);
682 LIST_FOREACH(scopes
, s
, first
->scopes_next
) {
686 name
= dns_question_first_name(dns_query_question_for_protocol(q
, s
->protocol
));
690 match
= dns_scope_good_domain(s
, q
->ifindex
, q
->flags
, name
);
697 r
= dns_query_add_candidate(q
, s
);
702 q
->answer
= dns_answer_unref(q
->answer
);
704 q
->answer_family
= AF_UNSPEC
;
705 q
->answer_protocol
= _DNS_PROTOCOL_INVALID
;
707 r
= sd_event_add_time(
709 &q
->timeout_event_source
,
710 clock_boottime_or_monotonic(),
711 now(clock_boottime_or_monotonic()) + QUERY_TIMEOUT_USEC
, 0,
712 on_query_timeout
, q
);
716 (void) sd_event_source_set_description(q
->timeout_event_source
, "query-timeout");
718 q
->state
= DNS_TRANSACTION_PENDING
;
721 /* Start the transactions */
722 LIST_FOREACH(candidates_by_query
, c
, q
->candidates
) {
723 r
= dns_query_candidate_go(c
);
740 static void dns_query_accept(DnsQuery
*q
, DnsQueryCandidate
*c
) {
741 DnsTransactionState state
= DNS_TRANSACTION_NO_SERVERS
;
742 bool has_authenticated
= false, has_non_authenticated
= false;
743 DnssecResult dnssec_result_authenticated
= _DNSSEC_RESULT_INVALID
, dnssec_result_non_authenticated
= _DNSSEC_RESULT_INVALID
;
751 dns_query_synthesize_reply(q
, &state
);
752 dns_query_complete(q
, state
);
756 SET_FOREACH(t
, c
->transactions
, i
) {
760 case DNS_TRANSACTION_SUCCESS
: {
761 /* We found a successfuly reply, merge it into the answer */
762 r
= dns_answer_extend(&q
->answer
, t
->answer
);
764 dns_query_complete(q
, DNS_TRANSACTION_RESOURCES
);
768 q
->answer_rcode
= t
->answer_rcode
;
770 if (t
->answer_authenticated
) {
771 has_authenticated
= true;
772 dnssec_result_authenticated
= t
->answer_dnssec_result
;
774 has_non_authenticated
= true;
775 dnssec_result_non_authenticated
= t
->answer_dnssec_result
;
778 state
= DNS_TRANSACTION_SUCCESS
;
782 case DNS_TRANSACTION_NULL
:
783 case DNS_TRANSACTION_PENDING
:
784 case DNS_TRANSACTION_VALIDATING
:
785 case DNS_TRANSACTION_ABORTED
:
786 /* Ignore transactions that didn't complete */
790 /* Any kind of failure? Store the data away,
791 * if there's nothing stored yet. */
793 if (state
== DNS_TRANSACTION_SUCCESS
)
796 q
->answer
= dns_answer_unref(q
->answer
);
797 q
->answer_rcode
= t
->answer_rcode
;
798 q
->answer_dnssec_result
= t
->answer_dnssec_result
;
805 if (state
== DNS_TRANSACTION_SUCCESS
) {
806 q
->answer_authenticated
= has_authenticated
&& !has_non_authenticated
;
807 q
->answer_dnssec_result
= q
->answer_authenticated
? dnssec_result_authenticated
: dnssec_result_non_authenticated
;
810 q
->answer_protocol
= c
->scope
->protocol
;
811 q
->answer_family
= c
->scope
->family
;
813 dns_search_domain_unref(q
->answer_search_domain
);
814 q
->answer_search_domain
= dns_search_domain_ref(c
->search_domain
);
816 dns_query_synthesize_reply(q
, &state
);
817 dns_query_complete(q
, state
);
820 void dns_query_ready(DnsQuery
*q
) {
822 DnsQueryCandidate
*bad
= NULL
, *c
;
823 bool pending
= false;
826 assert(DNS_TRANSACTION_IS_LIVE(q
->state
));
828 /* Note that this call might invalidate the query. Callers
829 * should hence not attempt to access the query or transaction
830 * after calling this function, unless the block_ready
831 * counter was explicitly bumped before doing so. */
833 if (q
->block_ready
> 0)
836 LIST_FOREACH(candidates_by_query
, c
, q
->candidates
) {
837 DnsTransactionState state
;
839 state
= dns_query_candidate_state(c
);
842 case DNS_TRANSACTION_SUCCESS
:
843 /* One of the candidates is successful,
844 * let's use it, and copy its data out */
845 dns_query_accept(q
, c
);
848 case DNS_TRANSACTION_NULL
:
849 case DNS_TRANSACTION_PENDING
:
850 case DNS_TRANSACTION_VALIDATING
:
851 /* One of the candidates is still going on,
852 * let's maybe wait for it */
857 /* Any kind of failure */
866 dns_query_accept(q
, bad
);
869 static int dns_query_cname_redirect(DnsQuery
*q
, const DnsResourceRecord
*cname
) {
870 _cleanup_(dns_question_unrefp
) DnsQuestion
*nq_idna
= NULL
, *nq_utf8
= NULL
;
875 q
->n_cname_redirects
++;
876 if (q
->n_cname_redirects
> CNAME_MAX
)
879 r
= dns_question_cname_redirect(q
->question_idna
, cname
, &nq_idna
);
883 log_debug("Following CNAME/DNAME %s → %s.", dns_question_first_name(q
->question_idna
), dns_question_first_name(nq_idna
));
885 k
= dns_question_is_equal(q
->question_idna
, q
->question_utf8
);
889 /* Same question? Shortcut new question generation */
890 nq_utf8
= dns_question_ref(nq_idna
);
893 k
= dns_question_cname_redirect(q
->question_utf8
, cname
, &nq_utf8
);
897 log_debug("Following UTF8 CNAME/DNAME %s → %s.", dns_question_first_name(q
->question_utf8
), dns_question_first_name(nq_utf8
));
900 if (r
== 0 && k
== 0) /* No actual cname happened? */
903 dns_question_unref(q
->question_idna
);
904 q
->question_idna
= nq_idna
;
907 dns_question_unref(q
->question_utf8
);
908 q
->question_utf8
= nq_utf8
;
911 dns_query_free_candidates(q
);
912 dns_query_reset_answer(q
);
913 q
->state
= DNS_TRANSACTION_NULL
;
915 /* Turn off searching for the new name */
916 q
->flags
|= SD_RESOLVED_NO_SEARCH
;
921 int dns_query_process_cname(DnsQuery
*q
) {
922 _cleanup_(dns_resource_record_unrefp
) DnsResourceRecord
*cname
= NULL
;
923 DnsQuestion
*question
;
924 DnsResourceRecord
*rr
;
929 if (!IN_SET(q
->state
, DNS_TRANSACTION_SUCCESS
, DNS_TRANSACTION_NULL
))
930 return DNS_QUERY_NOMATCH
;
932 question
= dns_query_question_for_protocol(q
, q
->answer_protocol
);
934 DNS_ANSWER_FOREACH(rr
, q
->answer
) {
935 r
= dns_question_matches_rr(question
, rr
, DNS_SEARCH_DOMAIN_NAME(q
->answer_search_domain
));
939 return DNS_QUERY_MATCH
; /* The answer matches directly, no need to follow cnames */
941 r
= dns_question_matches_cname_or_dname(question
, rr
, DNS_SEARCH_DOMAIN_NAME(q
->answer_search_domain
));
945 cname
= dns_resource_record_ref(rr
);
949 return DNS_QUERY_NOMATCH
; /* No match and no cname to follow */
951 if (q
->flags
& SD_RESOLVED_NO_CNAME
)
954 /* OK, let's actually follow the CNAME */
955 r
= dns_query_cname_redirect(q
, cname
);
959 /* Let's see if the answer can already answer the new
960 * redirected question */
961 r
= dns_query_process_cname(q
);
962 if (r
!= DNS_QUERY_NOMATCH
)
965 /* OK, it cannot, let's begin with the new query */
970 return DNS_QUERY_RESTARTED
; /* We restarted the query for a new cname */
973 static int on_bus_track(sd_bus_track
*t
, void *userdata
) {
974 DnsQuery
*q
= userdata
;
979 log_debug("Client of active query vanished, aborting query.");
980 dns_query_complete(q
, DNS_TRANSACTION_ABORTED
);
984 int dns_query_bus_track(DnsQuery
*q
, sd_bus_message
*m
) {
991 r
= sd_bus_track_new(sd_bus_message_get_bus(m
), &q
->bus_track
, on_bus_track
, q
);
996 r
= sd_bus_track_add_sender(q
->bus_track
, m
);
1003 DnsQuestion
* dns_query_question_for_protocol(DnsQuery
*q
, DnsProtocol protocol
) {
1008 case DNS_PROTOCOL_DNS
:
1009 return q
->question_idna
;
1011 case DNS_PROTOCOL_MDNS
:
1012 case DNS_PROTOCOL_LLMNR
:
1013 return q
->question_utf8
;
1020 const char *dns_query_string(DnsQuery
*q
) {
1024 /* Returns a somewhat useful human-readable lookup key string for this query */
1026 if (q
->request_address_string
)
1027 return q
->request_address_string
;
1029 if (q
->request_address_valid
) {
1030 r
= in_addr_to_string(q
->request_family
, &q
->request_address
, &q
->request_address_string
);
1032 return q
->request_address_string
;
1035 name
= dns_question_first_name(q
->question_utf8
);
1039 return dns_question_first_name(q
->question_idna
);