Lines Matching defs:question

2199 mDNSlocal void FoundInstance(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
2202 request_state *req = question->QuestionContext;
2209 if (mDNSOpaque16IsZero(question->TargetQID) && (question->BrowseThreshold > 0) && (question->CurrentAnswers >= question->BrowseThreshold))
2232 req->sd, question->qname.c, DNSTypeName(question->qtype), AddRecord ? "Add" : "Rmv",
2734 mDNSlocal void resolve_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
2740 request_state *req = question->QuestionContext;
2743 LogOperation("%3d: DNSServiceResolve(%##s) %s %s", req->sd, question->qname.c, AddRecord ? "ADD" : "RMV", RRDisplayString(m, answer));
2962 mDNSlocal int AppendNewSearchDomain(mDNS *const m, DNSQuestion *question)
2969 if (question->SearchListIndex == -1)
2971 LogMsg("AppendNewSearchDomain: question %##s (%s) SearchListIndex is -1", question->qname.c, DNSTypeName(question->qtype));
2975 if (!question->AppendSearchDomains)
2977 LogMsg("AppendNewSearchDomain: question %##s (%s) AppendSearchDoamins is 0", question->qname.c, DNSTypeName(question->qtype));
2982 if (!question->qnameOrig)
2984 question->qnameOrig = mallocL("AppendNewSearchDomain", sizeof(domainname));
2985 if (!question->qnameOrig) { LogMsg("AppendNewSearchDomain: ERROR!! malloc failure"); return -1; }
2986 question->qnameOrig->c[0] = 0;
2987 AssignDomainName(question->qnameOrig, &question->qname);
2988 LogInfo("AppendSearchDomain: qnameOrig %##s", question->qnameOrig->c);
2991 sd = uDNS_GetNextSearchDomain(m, question->InterfaceID, &question->SearchListIndex, !question->AppendLocalSearchDomains);
2994 if (question->SearchListIndex == -1)
3001 if (sd && (DomainNameLength(question->qnameOrig) + DomainNameLength(sd)) > MAX_DOMAIN_NAME)
3003 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));
3007 // if there are no more search domains and we have already tried this question
3009 if (!sd && !ApplySearchDomainsFirst(question))
3011 LogInfo("AppnedNewSearchDomain: No more search domains for question with name %##s (%s), not trying anymore", question->qname.c, DNSTypeName(question->qtype));
3015 // Stop the question before changing the name as negative cache entries could be pointing at this question.
3016 // Even if we don't change the question in the case of returning 0, the caller is going to restart the
3017 // question.
3018 err = mDNS_StopQuery(&mDNSStorage, question);
3019 if (err) { LogMsg("AppendNewSearchDomain: ERROR!! %##s %s mDNS_StopQuery: %d, while retrying with search domains", question->qname.c, DNSTypeName(question->qtype), (int)err); }
3021 AssignDomainName(&question->qname, question->qnameOrig);
3024 AppendDomainName(&question->qname, sd);
3025 LogInfo("AppnedNewSearchDomain: Returning question with name %##s, SearchListIndex %d", question->qname.c, question->SearchListIndex);
3029 // Try the question as single label
3030 LogInfo("AppnedNewSearchDomain: No more search domains for question with name %##s (%s), trying one last time", question->qname.c, DNSTypeName(question->qtype));
3061 // The caller already checks that this is a dotlocal question.
3062 mDNSlocal mDNSBool ShouldDeliverNegativeResponse(mDNS *const m, DNSQuestion *question)
3066 // If the question matches the search domain exactly or the search domain is a
3067 // subdomain of the question, it is most likely a valid unicast domain and hence
3074 if (DomainInSearchList(&question->qname, mDNStrue))
3076 LogOperation("ShouldDeliverNegativeResponse: Question %##s (%s) in SearchList", question->qname.c, DNSTypeName(question->qtype));
3081 if (question->qtype != kDNSType_A && question->qtype != kDNSType_AAAA)
3083 LogOperation("ShouldDeliverNegativeResponse: Question %##s (%s) not answering local question with negative unicast response",
3084 question->qname.c, DNSTypeName(question->qtype));
3087 qtype = (question->qtype == kDNSType_A ? kDNSType_AAAA : kDNSType_A);
3088 if (!mDNS_CheckForCacheRecord(m, question, qtype))
3090 LogOperation("ShouldDeliverNegativeResponse:Question %##s (%s) not answering local question with negative unicast response"
3091 " (can't find positive record)", question->qname.c, DNSTypeName(question->qtype));
3095 question->qname.c, DNSTypeName(question->qtype));
3130 // 2. As a result of appending search domains, the question may be end up with a .local suffix even though it
3152 // Always set the QuestionContext to indicate that this question should be stopped
3212 mDNSlocal mDNSBool RetryQuestionWithSearchDomains(mDNS *const m, DNSQuestion *question, request_state *req, QC_result AddRecord)
3221 // is a valid question for appending search domains, retry by appending domains
3223 if ((AddRecord != QC_suppressed) && question->SearchListIndex != -1 && question->AppendSearchDomains)
3225 question->RetryWithSearchDomains = 0;
3226 result = AppendNewSearchDomain(m, question);
3227 // As long as the result is either zero or 1, we retry the question. If we exahaust the search
3235 err = mDNS_StartQuery(m, question);
3238 LogOperation("%3d: RetryQuestionWithSearchDomains(%##s, %s), retrying after appending search domain", req->sd, question->qname.c, DNSTypeName(question->qtype));
3239 // If the result was zero, it meant that there are no search domains and we just retried the question
3241 if (!result) question->SearchListIndex = -1;
3246 LogMsg("%3d: ERROR: RetryQuestionWithSearchDomains %##s %s mDNS_StartQuery: %d, while retrying with search domains", req->sd, question->qname.c, DNSTypeName(question->qtype), (int)err);
3248 // so that we don't call stop again when the question terminates
3249 question->QuestionContext = mDNSNULL;
3255 LogInfo("%3d: RetryQuestionWithSearchDomains: Not appending search domains - SuppressQuery %d, SearchListIndex %d, AppendSearchDomains %d", req->sd, AddRecord, question->SearchListIndex, question->AppendSearchDomains);
3260 mDNSlocal void queryrecord_result_reply(mDNS *const m, request_state *req, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord,
3273 question->qname.c, DNSTypeName(question->qtype), AddRecord ? "ADD" : "RMV", RRDisplayString(m, answer));
3287 if (question->ValidationStatus != 0)
3290 if (question->ValidationRequired && question->ValidationState == DNSSECValDone)
3292 switch (question->ValidationStatus) //Set the dnssec flags to be passed on to the Apps here
3307 LogMsg("queryrecord_result_reply unknown status %d for %##s", question->ValidationStatus, question->qname.c);
3316 // are using the /etc/hosts entries to answer a question, the InterfaceID may not be known to the
3319 // should not have existed to answer this question if the corresponding interface is not valid.
3338 // Stop the question, if we just timed out
3341 mDNS_StopQuery(m, question);
3343 question->QuestionContext = mDNSNULL;
3350 if (question->qtype == kDNSType_A)
3352 if (question->qtype == kDNSType_AAAA)
3357 if (question->qtype == kDNSType_A || question->qtype == kDNSType_AAAA)
3440 mDNSlocal void queryrecord_result_callback(mDNS *const m, DNSQuestion *question, const ResourceRecord *const answer, QC_result AddRecord)
3442 request_state *req = question->QuestionContext;
3448 // Sanity check: QuestionContext is set to NULL after we stop the question and hence we should not
3452 LogMsg("queryrecord_result_callback: ERROR!! QuestionContext NULL for %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
3455 if (req->hdr.op == query_request && question == req->u.queryrecord.q2)
3457 else if (req->hdr.op == addrinfo_request && question == req->u.addrinfo.q42)
3459 else if (req->hdr.op == addrinfo_request && question == req->u.addrinfo.q62)
3462 if (q && question->qtype != q->qtype && !SameDomainName(&question->qname, &q->qname))
3465 domainname *orig = question->qnameOrig;
3467 LogInfo("queryrecord_result_callback: Stopping q2 local %##s", question->qname.c);
3468 mDNS_StopQuery(m, question);
3469 question->QuestionContext = mDNSNULL;
3473 // appended to this question. In that case, we want to retry the question. Otherwise,
3474 // we don't want to try this question as unicast.
3477 LogInfo("queryrecord_result_callback: question %##s AppendSearchDomains zero", q->qname.c);
3483 // Note: When we copy the original question, we copy everything including the AppendSearchDomains,
3484 // RetryWithSearchDomains except for qnameOrig which can be non-NULL if the original question is
3485 // e.g., somehost and then we appended e.g., ".local" and retried that question. See comment in
3487 *question = *q;
3488 question->InterfaceID = mDNSInterface_Unicast;
3489 question->ExpectUnique = mDNStrue;
3490 question->qnameOrig = orig;
3492 LogOperation("%3d: DNSServiceQueryRecord(%##s, %s) unicast, context %p", req->sd, question->qname.c, DNSTypeName(question->qtype), question->QuestionContext);
3494 // If the original question timed out, its QuestionContext would already be set to NULL and that's what we copied above.
3496 question->QuestionContext = req;
3497 err = mDNS_StartQuery(m, question);
3498 if (err) LogMsg("%3d: ERROR: queryrecord_result_callback %##s %s mDNS_StartQuery: %d", req->sd, question->qname.c, DNSTypeName(question->qtype), (int)err);
3500 // If we got a positive response to local SOA, then try the .local question as unicast
3503 // Fall through and get the next search domain. The question is pointing at .local
3505 // search domains for the unicast question anymore.
3507 // Note: we started the question above which will be stopped immediately (never sent on the wire)
3509 // question has already started.
3510 question->AppendLocalSearchDomains = 0;
3513 if (q && AddRecord && AddRecord != QC_dnssec && (question->InterfaceID == mDNSInterface_Unicast) && !answer->rdlength)
3519 LogInfo("queryrecord_result_callback: Retrying .local question %##s (%s) as unicast after appending search domains", question->qname.c, DNSTypeName(question->qtype));
3520 if (RetryQuestionWithSearchDomains(m, question, req, AddRecord))
3522 if (question->AppendSearchDomains && !question->AppendLocalSearchDomains && IsLocalDomain(&question->qname))
3524 // If "local" is the last search domain, we need to stop the question so that we don't send the "local"
3525 // question on the wire as we got a negative response for the local SOA. But, we can't stop the question
3526 // yet as we may have to timeout the question (done by the "core") for which we need to leave the question
3528 LogInfo("queryrecord_result_callback: Disabling .local question %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
3529 question->ThisQInterval = 0;
3532 // 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
3544 LogInfo("queryrecord_result_callback: Suppressed question %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
3545 queryrecord_result_reply(m, req, question, answer, AddRecord, kDNSServiceErr_NoSuchRecord);
3551 // If this question needs to be timed out and we have reached the stop time, mark
3553 // external DNS server at the same time when this question reaches its stop time. We
3557 if (question->TimeoutQuestion)
3559 if ((m->timenow - question->StopTime) >= 0)
3561 LogInfo("queryrecord_result_callback:Question %##s (%s) timing out, InterfaceID %p", question->qname.c, DNSTypeName(question->qtype), question->InterfaceID);
3576 // Sanity check: "q" will be set only if "question" is the .local unicast query.
3579 LogMsg("queryrecord_result_callback: ERROR!! answering multicast question %s with unicast cache record",
3584 if (!ShouldDeliverNegativeResponse(m, question))
3589 LogInfo("queryrecord_result_callback:Question %##s (%s) answering local with negative unicast response", question->qname.c,
3590 DNSTypeName(question->qtype));
3596 // - if we are timing out this question
3604 // If the original question did not end in .local, we did not send an SOA query
3609 LogInfo("queryrecord_result_callback: Retrying question %##s (%s) after appending search domains", question->qname.c, DNSTypeName(question->qtype));
3610 if (RetryQuestionWithSearchDomains(m, question, req, AddRecord))
3616 err = SendAdditionalQuery(question, req, err);
3623 queryrecord_result_reply(m, req, question, answer, AddRecord, error);
3638 DNSQuestion *question = &request->u.queryrecord.q;
3639 LogInfo("queryrecord_termination_callback: question %##s (%s) already stopped, InterfaceID %p", question->qname.c, DNSTypeName(question->qtype), question->InterfaceID);
3663 DNSQuestion *question = request->u.queryrecord.q2;
3664 LogInfo("queryrecord_termination_callback: q2 %##s (%s) already stopped, InterfaceID %p", question->qname.c, DNSTypeName(question->qtype), question->InterfaceID);
3702 // requires that we zero out the uuid wherever the question is
3706 // pid in the question, we will reevaluate this strategy.
3902 DNSQuestion *const question, const ResourceRecord *const answer, QC_result AddRecord)
3905 request_state *request = question->QuestionContext;
3918 if (question == &request->u.enumeration.q_default && !AddRecord) return;
3923 if (question == &request->u.enumeration.q_default) flags |= kDNSServiceFlagsDefault;
3933 LogOperation("%3d: DNSServiceEnumerateDomains(%#2s) RESULT %s: %s", request->sd, question->qname.c, AddRecord ? "Add" : "Rmv", domain);
4179 LogMsg("DNSServiceGetPID: srcport %d, pid %d [%s] question %##s", htons(srcport), pid, req->pid_name, q->qname.c);
4198 LogMsg("DNSServiceGetPID: srcport %d, pid %d [%s], question %##s", htons(srcport), pid, "_mDNSResponder", q->qname.c);
5853 LogMsgNoIdent("%lu question%s; %lu active", CacheUsed, CacheUsed > 1 ? "s" : "", CacheActive);