Lines Matching refs:q

22 static int reply_query_state(DnsQuery *q) {  in reply_query_state()  argument
24 assert(q); in reply_query_state()
25 assert(q->varlink_request); in reply_query_state()
27 switch (q->state) { in reply_query_state()
30 return varlink_error(q->varlink_request, "io.systemd.Resolve.NoNameServers", NULL); in reply_query_state()
33 return varlink_error(q->varlink_request, "io.systemd.Resolve.QueryTimedOut", NULL); in reply_query_state()
36 … return varlink_error(q->varlink_request, "io.systemd.Resolve.MaxAttemptsReached", NULL); in reply_query_state()
39 return varlink_error(q->varlink_request, "io.systemd.Resolve.InvalidReply", NULL); in reply_query_state()
42 return varlink_error_errno(q->varlink_request, q->answer_errno); in reply_query_state()
45 return varlink_error(q->varlink_request, "io.systemd.Resolve.QueryAborted", NULL); in reply_query_state()
48 … return varlink_errorb(q->varlink_request, "io.systemd.Resolve.DNSSECValidationFailed", in reply_query_state()
49 …_OBJECT(JSON_BUILD_PAIR("result", JSON_BUILD_STRING(dnssec_result_to_string(q->answer_dnssec_resul… in reply_query_state()
52 return varlink_error(q->varlink_request, "io.systemd.Resolve.NoTrustAnchor", NULL); in reply_query_state()
55 …return varlink_error(q->varlink_request, "io.systemd.Resolve.ResourceRecordTypeUnsupported", NULL); in reply_query_state()
58 return varlink_error(q->varlink_request, "io.systemd.Resolve.NetworkDown", NULL); in reply_query_state()
61 return varlink_error(q->varlink_request, "io.systemd.Resolve.NoSource", NULL); in reply_query_state()
64 return varlink_error(q->varlink_request, "io.systemd.Resolve.StubLoop", NULL); in reply_query_state()
69 return varlink_errorb(q->varlink_request, "io.systemd.Resolve.DNSError", in reply_query_state()
73 return varlink_errorb(q->varlink_request, "io.systemd.Resolve.DNSError", in reply_query_state()
74 … JSON_BUILD_OBJECT(JSON_BUILD_PAIR("rcode", JSON_BUILD_INTEGER(q->answer_rcode)))); in reply_query_state()
86 DnsQuery *q; in vl_on_disconnect() local
91 q = varlink_get_userdata(link); in vl_on_disconnect()
92 if (!q) in vl_on_disconnect()
95 if (!DNS_TRANSACTION_IS_LIVE(q->state)) in vl_on_disconnect()
99 dns_query_complete(q, DNS_TRANSACTION_ABORTED); in vl_on_disconnect()
149 _cleanup_(dns_query_freep) DnsQuery *q = query; in vl_method_resolve_hostname_complete()
155 assert(q); in vl_method_resolve_hostname_complete()
157 if (q->state != DNS_TRANSACTION_SUCCESS) { in vl_method_resolve_hostname_complete()
158 r = reply_query_state(q); in vl_method_resolve_hostname_complete()
162 r = dns_query_process_cname_many(q); in vl_method_resolve_hostname_complete()
164 r = varlink_error(q->varlink_request, "io.systemd.Resolve.CNAMELoop", NULL); in vl_method_resolve_hostname_complete()
171 TAKE_PTR(q); in vl_method_resolve_hostname_complete()
175 question = dns_query_question_for_protocol(q, q->answer_protocol); in vl_method_resolve_hostname_complete()
177 DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) { in vl_method_resolve_hostname_complete()
182 … r = dns_question_matches_rr(question, rr, DNS_SEARCH_DOMAIN_NAME(q->answer_search_domain)); in vl_method_resolve_hostname_complete()
216 … r = varlink_error(q->varlink_request, "io.systemd.Resolve.NoSuchResourceRecord", NULL); in vl_method_resolve_hostname_complete()
225 r = varlink_replyb(q->varlink_request, in vl_method_resolve_hostname_complete()
229 … JSON_BUILD_PAIR("flags", JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))))); in vl_method_resolve_hostname_complete()
233 r = varlink_error_errno(q->varlink_request, r); in vl_method_resolve_hostname_complete()
289 _cleanup_(dns_query_freep) DnsQuery *q = NULL; in vl_method_resolve_hostname()
332 … r = dns_query_new(m, &q, question_utf8, question_idna ?: question_utf8, NULL, p.ifindex, p.flags); in vl_method_resolve_hostname()
336 q->varlink_request = varlink_ref(link); in vl_method_resolve_hostname()
337 varlink_set_userdata(link, q); in vl_method_resolve_hostname()
338 q->request_family = p.family; in vl_method_resolve_hostname()
339 q->complete = vl_method_resolve_hostname_complete; in vl_method_resolve_hostname()
341 r = dns_query_go(q); in vl_method_resolve_hostname()
345 TAKE_PTR(q); in vl_method_resolve_hostname()
386 _cleanup_(dns_query_freep) DnsQuery *q = query; in vl_method_resolve_address_complete()
391 assert(q); in vl_method_resolve_address_complete()
393 if (q->state != DNS_TRANSACTION_SUCCESS) { in vl_method_resolve_address_complete()
394 r = reply_query_state(q); in vl_method_resolve_address_complete()
398 r = dns_query_process_cname_many(q); in vl_method_resolve_address_complete()
400 r = varlink_error(q->varlink_request, "io.systemd.Resolve.CNAMELoop", NULL); in vl_method_resolve_address_complete()
407 TAKE_PTR(q); in vl_method_resolve_address_complete()
411 question = dns_query_question_for_protocol(q, q->answer_protocol); in vl_method_resolve_address_complete()
413 DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) { in vl_method_resolve_address_complete()
440 … r = varlink_error(q->varlink_request, "io.systemd.Resolve.NoSuchResourceRecord", NULL); in vl_method_resolve_address_complete()
444 r = varlink_replyb(q->varlink_request, in vl_method_resolve_address_complete()
447 … JSON_BUILD_PAIR("flags", JSON_BUILD_INTEGER(dns_query_reply_flags_make(q))))); in vl_method_resolve_address_complete()
451 r = varlink_error_errno(q->varlink_request, r); in vl_method_resolve_address_complete()
468 _cleanup_(dns_query_freep) DnsQuery *q = NULL; in vl_method_resolve_address()
500 … r = dns_query_new(m, &q, question, question, NULL, p.ifindex, p.flags|SD_RESOLVED_NO_SEARCH); in vl_method_resolve_address()
504 q->varlink_request = varlink_ref(link); in vl_method_resolve_address()
505 varlink_set_userdata(link, q); in vl_method_resolve_address()
507 q->request_family = p.family; in vl_method_resolve_address()
508 q->request_address = p.address; in vl_method_resolve_address()
509 q->complete = vl_method_resolve_address_complete; in vl_method_resolve_address()
511 r = dns_query_go(q); in vl_method_resolve_address()
515 TAKE_PTR(q); in vl_method_resolve_address()