Lines Matching defs:question

1734 mDNSlocal void FoundInstance(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
1737 request_state *req = question->QuestionContext;
1762 req->sd, question->qname.c, DNSTypeName(question->qtype), AddRecord ? "Add" : "Rmv",
2225 mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
2231 request_state *req = question->QuestionContext;
2234 LogOperation("%3d: DNSServiceResolve(%##s) %s %s", req->sd, question->qname.c, AddRecord ? "ADD" : "RMV", RRDisplayString(m, answer));
2404 mDNSlocal int AppendNewSearchDomain(mDNS *const m, DNSQuestion *question)
2411 if (question->SearchListIndex == -1)
2413 LogMsg("AppendNewSearchDomain: question %##s (%s) SearchListIndex is -1", question->qname.c, DNSTypeName(question->qtype));
2417 if (!question->AppendSearchDomains)
2419 LogMsg("AppendNewSearchDomain: question %##s (%s) AppendSearchDoamins is 0", question->qname.c, DNSTypeName(question->qtype));
2424 if (!question->qnameOrig)
2426 question->qnameOrig = mallocL("AppendNewSearchDomain", sizeof(domainname));
2427 if (!question->qnameOrig) { LogMsg("AppendNewSearchDomain: ERROR!! malloc failure"); return -1; }
2428 question->qnameOrig->c[0] = 0;
2429 AssignDomainName(question->qnameOrig, &question->qname);
2430 LogInfo("AppendSearchDomain: qnameOrig %##s", question->qnameOrig->c);
2433 sd = uDNS_GetNextSearchDomain(m, question->InterfaceID, &question->SearchListIndex, !question->AppendLocalSearchDomains);
2436 if (question->SearchListIndex == -1)
2443 if (sd && (DomainNameLength(question->qnameOrig) + DomainNameLength(sd)) > MAX_DOMAIN_NAME)
2445 LogMsg("AppendNewSearchDomain: ERROR!! exceeding max domain length for %##s (%s) SearchDomain %##s length %d, Question name length %d", question->qnameOrig->c, DNSTypeName(question->qtype), sd->c, DomainNameLength(question->qnameOrig), DomainNameLength(sd));
2449 // if there are no more search domains and we have already tried this question
2451 if (!sd && !ApplySearchDomainsFirst(question))
2453 LogInfo("AppnedNewSearchDomain: No more search domains for question with name %##s (%s), not trying anymore", question->qname.c, DNSTypeName(question->qtype));
2457 // Stop the question before changing the name as negative cache entries could be pointing at this question.
2458 // Even if we don't change the question in the case of returning 0, the caller is going to restart the
2459 // question.
2460 err = mDNS_StopQuery(&mDNSStorage, question);
2461 if (err) { LogMsg("AppendNewSearchDomain: ERROR!! %##s %s mDNS_StopQuery: %d, while retrying with search domains", question->qname.c, DNSTypeName(question->qtype), (int)err); }
2463 AssignDomainName(&question->qname, question->qnameOrig);
2466 AppendDomainName(&question->qname, sd);
2467 LogInfo("AppnedNewSearchDomain: Returning question with name %##s, SearchListIndex %d", question->qname.c, question->SearchListIndex);
2471 // Try the question as single label
2472 LogInfo("AppnedNewSearchDomain: No more search domains for question with name %##s (%s), trying one last time", question->qname.c, DNSTypeName(question->qtype));
2516 // 2. As a result of appending search domains, the question may be end up with a .local suffix even though it
2585 mDNSlocal mDNSBool RetryQuestionWithSearchDomains(mDNS *const m, DNSQuestion *question, request_state *req)
2594 // is a valid question for appending search domains, retry by appending domains
2596 if (!question->SuppressQuery && question->SearchListIndex != -1 && question->AppendSearchDomains)
2598 question->RetryWithSearchDomains = 0;
2599 result = AppendNewSearchDomain(m, question);
2600 // As long as the result is either zero or 1, we retry the question. If we exahaust the search
2608 err = mDNS_StartQuery(m, question);
2611 LogOperation("%3d: RetryQuestionWithSearchDomains(%##s, %s), retrying after appending search domain", req->sd, question->qname.c, DNSTypeName(question->qtype));
2612 // If the result was zero, it meant that there are no search domains and we just retried the question
2614 if (!result) question->SearchListIndex = -1;
2619 LogMsg("%3d: ERROR: RetryQuestionWithSearchDomains %##s %s mDNS_StartQuery: %d, while retrying with search domains", req->sd, question->qname.c, DNSTypeName(question->qtype), (int)err);
2621 // so that we don't call stop again when the question terminates
2622 question->QuestionContext = mDNSNULL;
2628 LogInfo("%3d: RetryQuestionWithSearchDomains: Not appending search domains - SuppressQuery %d, SearchListIndex %d, AppendSearchDomains %d", req->sd, question->SuppressQuery, question->SearchListIndex, question->AppendSearchDomains);
2633 mDNSlocal void queryrecord_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
2636 request_state *req = question->QuestionContext;
2645 // Sanity check: QuestionContext is set to NULL after we stop the question and hence we should not
2649 LogMsg("queryrecord_result_callback: ERROR!! QuestionContext NULL for %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
2652 if (req->hdr.op == query_request && question == req->u.queryrecord.q2)
2654 else if (req->hdr.op == addrinfo_request && question == req->u.addrinfo.q42)
2656 else if (req->hdr.op == addrinfo_request && question == req->u.addrinfo.q62)
2659 if (q && question->qtype != q->qtype && !SameDomainName(&question->qname, &q->qname))
2662 domainname *orig = question->qnameOrig;
2664 LogInfo("queryrecord_result_callback: Stopping q2 local %##s", question->qname.c);
2665 mDNS_StopQuery(m, question);
2666 question->QuestionContext = mDNSNULL;
2670 // appended to this question. In that case, we want to retry the question. Otherwise,
2671 // we don't want to try this question as unicast.
2674 LogInfo("queryrecord_result_callback: question %##s AppendSearchDomains zero", q->qname.c);
2680 // Note: When we copy the original question, we copy everything including the AppendSearchDomains,
2681 // RetryWithSearchDomains except for qnameOrig which can be non-NULL if the original question is
2682 // e.g., somehost and then we appended e.g., ".local" and retried that question. See comment in
2684 *question = *q;
2685 question->InterfaceID = mDNSInterface_Unicast;
2686 question->ExpectUnique = mDNStrue;
2687 question->qnameOrig = orig;
2689 LogOperation("%3d: DNSServiceQueryRecord(%##s, %s) unicast, context %p", req->sd, question->qname.c, DNSTypeName(question->qtype), question->QuestionContext);
2691 // If the original question timed out, its QuestionContext would already be set to NULL and that's what we copied above.
2693 question->QuestionContext = req;
2694 err = mDNS_StartQuery(m, question);
2695 if (err) LogMsg("%3d: ERROR: queryrecord_result_callback %##s %s mDNS_StartQuery: %d", req->sd, question->qname.c, DNSTypeName(question->qtype), (int)err);
2697 // If we got a positive response to local SOA, then try the .local question as unicast
2700 // Fall through and get the next search domain. The question is pointing at .local
2702 // search domains for the unicast question anymore.
2704 // Note: we started the question above which will be stopped immediately (never sent on the wire)
2706 // question has already started.
2707 question->AppendLocalSearchDomains = 0;
2710 if (q && AddRecord && (question->InterfaceID == mDNSInterface_Unicast) && !answer->rdlength)
2716 LogInfo("queryrecord_result_callback: Retrying .local question %##s (%s) as unicast after appending search domains", question->qname.c, DNSTypeName(question->qtype));
2717 if (RetryQuestionWithSearchDomains(m, question, req))
2719 if (question->AppendSearchDomains && !question->AppendLocalSearchDomains && IsLocalDomain(&question->qname))
2721 // If "local" is the last search domain, we need to stop the question so that we don't send the "local"
2722 // question on the wire as we got a negative response for the local SOA. But, we can't stop the question
2723 // yet as we may have to timeout the question (done by the "core") for which we need to leave the question
2725 LogInfo("queryrecord_result_callback: Disabling .local question %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
2726 question->ThisQInterval = 0;
2729 // If we are here it means that either "question" is not "q2" OR we got a positive response for "q2" OR we have no more search
2736 // If this question needs to be timed out and we have reached the stop time, mark
2738 // external DNS server at the same time when this question reaches its stop time. We
2742 if (question->TimeoutQuestion)
2744 if ((m->timenow - question->StopTime) >= 0)
2746 LogInfo("queryrecord_result_callback:Question %##s (%s) timing out, InterfaceID %p", question->qname.c, DNSTypeName(question->qtype), question->InterfaceID);
2761 LogInfo("queryrecord_result_callback:Question %##s (%s) answering local with unicast", question->qname.c, DNSTypeName(question->qtype));
2769 // - if we are timing out this question
2776 // If the original question did not end in .local, we did not send an SOA query
2781 LogInfo("queryrecord_result_callback: Retrying question %##s (%s) after appending search domains", question->qname.c, DNSTypeName(question->qtype));
2782 if (RetryQuestionWithSearchDomains(m, question, req))
2788 err = SendAdditionalQuery(question, req, err);
2800 question->qname.c, DNSTypeName(question->qtype), AddRecord ? "ADD" : "RMV", RRDisplayString(m, answer));
2816 // are using the /etc/hosts entries to answer a question, the InterfaceID may not be known to the
2819 // should not have existed to answer this question if the corresponding interface is not valid.
2838 // Stop the question, if we just timed out
2841 mDNS_StopQuery(m, question);
2843 question->QuestionContext = mDNSNULL;
2929 DNSQuestion *question = &request->u.queryrecord.q;
2930 LogInfo("queryrecord_termination_callback: question %##s (%s) already stopped, InterfaceID %p", question->qname.c, DNSTypeName(question->qtype), question->InterfaceID);
2952 DNSQuestion *question = request->u.queryrecord.q2;
2953 LogInfo("queryrecord_termination_callback: q2 %##s (%s) already stopped, InterfaceID %p", question->qname.c, DNSTypeName(question->qtype), question->InterfaceID);
3089 DNSQuestion *const question, const ResourceRecord *const answer, QC_result AddRecord)
3092 request_state *request = question->QuestionContext;
3105 if (question == &request->u.enumeration.q_default && !AddRecord) return;
3110 if (question == &request->u.enumeration.q_default) flags |= kDNSServiceFlagsDefault;
3120 LogOperation("%3d: DNSServiceEnumerateDomains(%#2s) RESULT %s: %s", request->sd, question->qname.c, AddRecord ? "Add" : "Rmv", domain);
4404 LogMsgNoIdent("%lu question%s; %lu active", CacheUsed, CacheUsed > 1 ? "s" : "", CacheActive);