#define TRIEDFIND(f) (((f)->attributes & FCTX_ATTR_TRIEDFIND) != 0)
#define TRIEDALT(f) (((f)->attributes & FCTX_ATTR_TRIEDALT) != 0)
+#define FCTX_ATTR_SET(f, x) do { (f)->attributes |= (x); } while (0)
+#define FCTX_ATTR_CLR(f, x) do { (f)->attributes &= ~(x); } while (0)
+
typedef struct {
dns_adbaddrinfo_t * addrinfo;
fetchctx_t * fctx;
LOCK(&res->buckets[fctx->bucketnum].lock);
fctx->state = fetchstate_done;
- fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
fctx_sendevents(fctx, result, line);
UNLOCK(&res->buckets[fctx->bucketnum].lock);
* Behave as if the idle timer has expired. For TCP
* this may not actually reflect the latest timer.
*/
- fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
result = fctx_stopidletimer(fctx);
if (result != ISC_R_SUCCESS)
fctx_done(fctx, result, __LINE__);
* Behave as if the idle timer has expired. For TCP
* connections this may not actually reflect the latest timer.
*/
- fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
result = fctx_stopidletimer(fctx);
if (result != ISC_R_SUCCESS)
fctx_done(fctx, result, __LINE__);
*/
INSIST(!fctx->shuttingdown);
if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) {
- fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
want_try = true;
} else {
fctx->findfail++;
* know the answer. There's nothing to do but
* fail the fctx.
*/
- fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
want_done = true;
}
}
* No forwarders. Move to the next find.
*/
- fctx->attributes |= FCTX_ATTR_TRIEDFIND;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_TRIEDFIND);
find = fctx->find;
if (find == NULL)
* No nameservers left. Try alternates.
*/
- fctx->attributes |= FCTX_ATTR_TRIEDALT;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_TRIEDALT);
find = fctx->altfind;
if (find == NULL)
* Sleep waiting for addresses.
*/
FCTXTRACE("addrwait");
- fctx->attributes |= FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_ADDRWAIT);
return;
} else if (result != ISC_R_SUCCESS) {
/*
FCTXTRACE("query timed out; no response");
fctx_cancelquery(&query, NULL, NULL, true, false);
}
- fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
/*
* Our timer has triggered. Reestablish the fctx lifetime
/*
* An fctx that is shutting down is no longer in ADDRWAIT mode.
*/
- fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
/*
* Cancel all pending validators. Note that this must be done
* as opposed to an error. 'node' must be non-NULL.
*/
- fctx->attributes |= FCTX_ATTR_HAVEANSWER;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_HAVEANSWER);
if (hevent != NULL) {
/*
}
if (result == ISC_R_SUCCESS && have_answer) {
- fctx->attributes |= FCTX_ATTR_HAVEANSWER;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_HAVEANSWER);
if (event != NULL) {
/*
* Negative results must be indicated in event->result.
FCTXTRACE("cache_message");
- fctx->attributes &= ~FCTX_ATTR_WANTCACHE;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_WANTCACHE);
LOCK(&fctx->res->buckets[fctx->bucketnum].lock);
FCTXTRACE("ncache_message");
- fctx->attributes &= ~FCTX_ATTR_WANTNCACHE;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_WANTNCACHE);
res = fctx->res;
need_validation = false;
goto unlock;
if (!HAVE_ANSWER(fctx)) {
- fctx->attributes |= FCTX_ATTR_HAVEANSWER;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_HAVEANSWER);
if (event != NULL) {
event->result = eresult;
if (adbp != NULL && *adbp != NULL) {
* query domain.
*/
INSIST(ns_rdataset != NULL);
- fctx->attributes |= FCTX_ATTR_GLUING;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_GLUING);
(void)dns_rdataset_additionaldata(ns_rdataset, check_related,
fctx);
#if CHECK_FOR_GLUE_IN_ANSWER
(void)dns_rdataset_additionaldata(ns_rdataset,
check_answer, fctx);
#endif
- fctx->attributes &= ~FCTX_ATTR_GLUING;
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_GLUING);
/*
* NS rdatasets with 0 TTL cause problems.
* dns_view_findzonecut() will not find them when we
result = fcount_incr(fctx, true);
if (result != ISC_R_SUCCESS)
return (result);
- fctx->attributes |= FCTX_ATTR_WANTCACHE;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_WANTCACHE);
fctx->ns_ttl_ok = false;
log_ns_ttl(fctx, "DELEGATION");
return (DNS_R_DELEGATION);
ns_name->attributes &= ~DNS_NAMEATTR_CACHE;
if (negative_response && oqname == NULL)
- fctx->attributes |= FCTX_ATTR_WANTNCACHE;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_WANTNCACHE);
return (ISC_R_SUCCESS);
}
/*
* This response is now potentially cacheable.
*/
- fctx->attributes |= FCTX_ATTR_WANTCACHE;
+ FCTX_ATTR_SET(fctx, FCTX_ATTR_WANTCACHE);
/*
* Did chaining end before we got the final answer?
/*
* Clear cache bits.
*/
- fctx->attributes &= ~(FCTX_ATTR_WANTNCACHE | FCTX_ATTR_WANTCACHE);
+ FCTX_ATTR_CLR(fctx, FCTX_ATTR_WANTNCACHE | FCTX_ATTR_WANTCACHE);
/*
* Did we get any answers?