+5993. [cleanup] Store dns_name_t attributes as boolean members of
+ the structure. Remove DNS_NAMEATTR_* macros.
+ Fix latent attribute handling bug in RBT. [GL !6902]
+
5992. [func] Introduce the new isc_mem_*x() APIs that takes extra
flags as the last argument. Currently ISC_MEM_ZERO
and ISC_MEM_ALIGN(n) flags have been implemented that
/* Windows doesn't like the tsig name to be compressed. */
if (updatemsg->tsigname) {
- updatemsg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
+ updatemsg->tsigname->attributes.nocompress = true;
}
result = dns_request_create(
}
/* Windows doesn't recognize name compression in the key name. */
- keyname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
+ keyname->attributes.nocompress = true;
rmsg = NULL;
dns_message_create(gmctx, DNS_MESSAGE_INTENTRENDER, &rmsg);
node->name.length = node->r.length;
node->name.ndata = node->r.base;
node->name.labels = tname.labels;
- node->name.attributes = DNS_NAMEATTR_ABSOLUTE;
+ node->name.attributes =
+ (struct dns_name_attrs){ .absolute = true };
node->next = cctx->table[i];
cctx->table[i] = node;
start++;
unsigned char *ndata;
unsigned int length;
unsigned int labels;
- unsigned int attributes;
+ struct dns_name_attrs {
+ bool absolute : 1; /*%< Used by name.c */
+ bool readonly : 1; /*%< Used by name.c */
+ bool dynamic : 1; /*%< Used by name.c */
+ bool dynoffsets : 1; /*%< Used by name.c */
+ bool nocompress : 1; /*%< Used by name.c */
+ bool cache : 1; /*%< Used by resolver. */
+ bool answer : 1; /*%< Used by resolver. */
+ bool ncache : 1; /*%< Used by resolver. */
+ bool chaining : 1; /*%< Used by resolver. */
+ bool chase : 1; /*%< Used by resolver. */
+ bool wildcard : 1; /*%< Used by server. */
+ bool prerequisite : 1; /*%< Used by client. */
+ bool update : 1; /*%< Used by client. */
+ bool hasupdaterec : 1; /*%< Used by client. */
+ } attributes;
unsigned char *offsets;
isc_buffer_t *buffer;
ISC_LINK(dns_name_t) link;
#define DNS_NAME_MAGIC ISC_MAGIC('D', 'N', 'S', 'n')
-#define DNS_NAMEATTR_ABSOLUTE 0x00000001
-#define DNS_NAMEATTR_READONLY 0x00000002
-#define DNS_NAMEATTR_DYNAMIC 0x00000004
-#define DNS_NAMEATTR_DYNOFFSETS 0x00000008
-#define DNS_NAMEATTR_NOCOMPRESS 0x00000010
-/*
- * Attributes below 0x0100 reserved for name.c usage.
- */
-#define DNS_NAMEATTR_CACHE 0x00000100 /*%< Used by resolver. */
-#define DNS_NAMEATTR_ANSWER 0x00000200 /*%< Used by resolver. */
-#define DNS_NAMEATTR_NCACHE 0x00000400 /*%< Used by resolver. */
-#define DNS_NAMEATTR_CHAINING 0x00000800 /*%< Used by resolver. */
-#define DNS_NAMEATTR_CHASE 0x00001000 /*%< Used by resolver. */
-#define DNS_NAMEATTR_WILDCARD 0x00002000 /*%< Used by server. */
-#define DNS_NAMEATTR_PREREQUISITE 0x00004000 /*%< Used by client. */
-#define DNS_NAMEATTR_UPDATE 0x00008000 /*%< Used by client. */
-#define DNS_NAMEATTR_HASUPDATEREC 0x00010000 /*%< Used by client. */
-
/*
* Various flags.
*/
#define DNS_NAME_INITNONABSOLUTE(A, B) \
{ \
DNS_NAME_MAGIC, A, (sizeof(A) - 1), sizeof(B), \
- DNS_NAMEATTR_READONLY, B, NULL, \
+ { .readonly = true }, B, NULL, \
{ (void *)-1, (void *)-1 }, { \
NULL, NULL \
} \
}
-#define DNS_NAME_INITABSOLUTE(A, B) \
- { \
- DNS_NAME_MAGIC, A, sizeof(A), sizeof(B), \
- DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE, B, \
- NULL, { (void *)-1, (void *)-1 }, { \
- NULL, NULL \
- } \
+#define DNS_NAME_INITABSOLUTE(A, B) \
+ { \
+ DNS_NAME_MAGIC, A, sizeof(A), sizeof(B), \
+ { .readonly = true, .absolute = true }, B, NULL, \
+ { (void *)-1, (void *)-1 }, { \
+ NULL, NULL \
+ } \
}
-#define DNS_NAME_INITEMPTY \
- { \
- DNS_NAME_MAGIC, NULL, 0, 0, 0, NULL, NULL, \
- { (void *)-1, (void *)-1 }, { \
- NULL, NULL \
- } \
+#define DNS_NAME_INITEMPTY \
+ { \
+ DNS_NAME_MAGIC, NULL, 0, 0, {}, NULL, NULL, \
+ { (void *)-1, (void *)-1 }, { \
+ NULL, NULL \
+ } \
}
/*%
* is retained but the buffer itself is cleared.
*
* \li + Of the attributes associated with 'name', all are retained except
- * DNS_NAMEATTR_ABSOLUTE.
+ * the absolute flag.
*
* Requires:
* \li 'name' is a valid name.
* WARNING: No assertion checking is done for these macros.
*/
-#define DNS_NAME_INIT(n, o) \
- do { \
- dns_name_t *_n = (n); \
- /* memset(_n, 0, sizeof(*_n)); */ \
- _n->magic = DNS_NAME_MAGIC; \
- _n->ndata = NULL; \
- _n->length = 0; \
- _n->labels = 0; \
- _n->attributes = 0; \
- _n->offsets = (o); \
- _n->buffer = NULL; \
- ISC_LINK_INIT(_n, link); \
- ISC_LIST_INIT(_n->list); \
+#define DNS_NAME_INIT(n, o) \
+ do { \
+ dns_name_t *_n = (n); \
+ /* memset(_n, 0, sizeof(*_n)); */ \
+ _n->magic = DNS_NAME_MAGIC; \
+ _n->ndata = NULL; \
+ _n->length = 0; \
+ _n->labels = 0; \
+ _n->attributes = (struct dns_name_attrs){}; \
+ _n->offsets = (o); \
+ _n->buffer = NULL; \
+ ISC_LINK_INIT(_n, link); \
+ ISC_LIST_INIT(_n->list); \
} while (0)
-#define DNS_NAME_RESET(n) \
- do { \
- (n)->ndata = NULL; \
- (n)->length = 0; \
- (n)->labels = 0; \
- (n)->attributes &= ~DNS_NAMEATTR_ABSOLUTE; \
- if ((n)->buffer != NULL) \
- isc_buffer_clear((n)->buffer); \
+#define DNS_NAME_RESET(n) \
+ do { \
+ (n)->ndata = NULL; \
+ (n)->length = 0; \
+ (n)->labels = 0; \
+ (n)->attributes.absolute = false; \
+ if ((n)->buffer != NULL) \
+ isc_buffer_clear((n)->buffer); \
} while (0)
#define DNS_NAME_SETBUFFER(n, b) (n)->buffer = (b)
-#define DNS_NAME_ISABSOLUTE(n) \
- (((n)->attributes & DNS_NAMEATTR_ABSOLUTE) != 0 ? true : false)
-
#define DNS_NAME_COUNTLABELS(n) ((n)->labels)
#define DNS_NAME_TOREGION(n, r) \
#define dns_name_reset(n) DNS_NAME_RESET(n)
#define dns_name_setbuffer(n, b) DNS_NAME_SETBUFFER(n, b)
#define dns_name_countlabels(n) DNS_NAME_COUNTLABELS(n)
-#define dns_name_isabsolute(n) DNS_NAME_ISABSOLUTE(n)
+#define dns_name_isabsolute(n) ((n)->attributes.absolute)
#define dns_name_toregion(n, r) DNS_NAME_TOREGION(n, r)
#define dns_name_split(n, l, p, s) DNS_NAME_SPLIT(n, l, p, s)
* \li name->offsets == NULL
*
* Ensures:
- * \li 'name' is DNS_NAMEATTR_READONLY.
+ * \li 'name' is readonly.
*
* \li 'name' will point directly to the labels stored after the
* dns_rbtnode_t struct.
/*
* Windows doesn't like TSIG names to be compressed.
*/
- msg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
+ msg->tsigname->attributes.nocompress = true;
rdataset = NULL;
free_rdataset = false;
free_name = false;
* Note: If additional attributes are added that should not be set for
* empty names, MAKE_EMPTY() must be changed so it clears them.
*/
-#define MAKE_EMPTY(name) \
- do { \
- name->ndata = NULL; \
- name->length = 0; \
- name->labels = 0; \
- name->attributes &= ~DNS_NAMEATTR_ABSOLUTE; \
+#define MAKE_EMPTY(name) \
+ do { \
+ name->ndata = NULL; \
+ name->length = 0; \
+ name->labels = 0; \
+ name->attributes.absolute = false; \
} while (0);
/*%
* A name is "bindable" if it can be set to point to a new value, i.e.
* name->ndata and name->length may be changed.
*/
-#define BINDABLE(name) \
- ((name->attributes & \
- (DNS_NAMEATTR_READONLY | DNS_NAMEATTR_DYNAMIC)) == 0)
+#define BINDABLE(name) (!name->attributes.readonly && !name->attributes.dynamic)
/*%
* Note that the name data must be a char array, not a string
name->ndata = NULL;
name->length = 0;
name->labels = 0;
- name->attributes = 0;
+ name->attributes = (struct dns_name_attrs){};
name->offsets = NULL;
name->buffer = NULL;
ISC_LINK_INIT(name, link);
REQUIRE(VALID_NAME(name));
- if ((name->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
- return (true);
- }
- return (false);
+ return name->attributes.absolute;
}
#define hyphenchar(c) ((c) == 0x2d)
REQUIRE(VALID_NAME(name));
REQUIRE(name->labels > 0);
- REQUIRE(name->attributes & DNS_NAMEATTR_ABSOLUTE);
+ REQUIRE(name->attributes.absolute);
/*
* Root label.
REQUIRE(VALID_NAME(name));
REQUIRE(name->labels > 0);
- REQUIRE(name->attributes & DNS_NAMEATTR_ABSOLUTE);
+ REQUIRE(name->attributes.absolute);
/*
* Root label.
/*
* Either name1 is absolute and name2 is absolute, or neither is.
*/
- REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) ==
- (name2->attributes & DNS_NAMEATTR_ABSOLUTE));
+ REQUIRE((name1->attributes.absolute) == (name2->attributes.absolute));
if (name1 == name2) {
*orderp = 0;
/*
* Either name1 is absolute and name2 is absolute, or neither is.
*/
- REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) ==
- (name2->attributes & DNS_NAMEATTR_ABSOLUTE));
+ REQUIRE((name1->attributes.absolute) == (name2->attributes.absolute));
if (name1 == name2) {
return (true);
/*
* Either name1 is absolute and name2 is absolute, or neither is.
*/
- REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) ==
- (name2->attributes & DNS_NAMEATTR_ABSOLUTE));
+ REQUIRE((name1->attributes.absolute) == (name2->attributes.absolute));
if (name1->length != name2->length) {
return (false);
REQUIRE(VALID_NAME(name1));
REQUIRE(name1->labels > 0);
- REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) != 0);
+ REQUIRE(name1->attributes.absolute);
REQUIRE(VALID_NAME(name2));
REQUIRE(name2->labels > 0);
- REQUIRE((name2->attributes & DNS_NAMEATTR_ABSOLUTE) != 0);
+ REQUIRE(name2->attributes.absolute);
/* label lengths are < 64 so tolower() does not affect them */
return (isc_ascii_lowercmp(name1->ndata, name2->ndata,
target->ndata = &source->ndata[firstoffset];
target->length = endoffset - firstoffset;
- if (first + n == source->labels && n > 0 &&
- (source->attributes & DNS_NAMEATTR_ABSOLUTE) != 0)
+ if (first + n == source->labels && n > 0 && source->attributes.absolute)
{
- target->attributes |= DNS_NAMEATTR_ABSOLUTE;
+ target->attributes.absolute = true;
} else {
- target->attributes &= ~DNS_NAMEATTR_ABSOLUTE;
+ target->attributes.absolute = false;
}
target->labels = n;
target->ndata = source->ndata;
target->length = source->length;
target->labels = source->labels;
- target->attributes = source->attributes &
- (unsigned int)~(DNS_NAMEATTR_READONLY |
- DNS_NAMEATTR_DYNAMIC |
- DNS_NAMEATTR_DYNOFFSETS);
+ target->attributes = source->attributes;
+ target->attributes.readonly = false;
+ target->attributes.dynamic = false;
+ target->attributes.dynoffsets = false;
if (target->offsets != NULL && source->labels > 0) {
if (source->offsets != NULL) {
memmove(target->offsets, source->offsets,
set_offsets(name, offsets, name);
} else {
name->labels = 0;
- name->attributes &= ~DNS_NAMEATTR_ABSOLUTE;
+ name->attributes.absolute = false;
}
if (name->buffer != NULL) {
offsets[labels] = nused;
}
}
- if ((origin->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
- name->attributes |= DNS_NAMEATTR_ABSOLUTE;
+ if (origin->attributes.absolute) {
+ name->attributes.absolute = true;
}
}
} else {
- name->attributes |= DNS_NAMEATTR_ABSOLUTE;
+ name->attributes.absolute = true;
}
name->ndata = (unsigned char *)target->base + target->used;
* wire format.
*/
REQUIRE(VALID_NAME(name));
- REQUIRE((name->attributes & DNS_NAMEATTR_ABSOLUTE) != 0);
+ REQUIRE(name->attributes.absolute);
REQUIRE(ISC_BUFFER_VALID(target));
ndata = name->ndata;
REQUIRE(VALID_NAME(source));
REQUIRE(VALID_NAME(name));
if (source == name) {
- REQUIRE((name->attributes & DNS_NAMEATTR_READONLY) == 0);
+ REQUIRE(!name->attributes.readonly);
isc_buffer_init(&buffer, source->ndata, source->length);
target = &buffer;
ndata = source->ndata;
if (source != name) {
name->labels = source->labels;
name->length = source->length;
- if ((source->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
- name->attributes = DNS_NAMEATTR_ABSOLUTE;
- } else {
- name->attributes = 0;
- }
+ name->attributes = (struct dns_name_attrs){
+ .absolute = source->attributes.absolute
+ };
if (name->labels > 0 && name->offsets != NULL) {
set_offsets(name, name->offsets, NULL);
}
set_name->labels = nlabels;
set_name->length = offset;
- if (absolute) {
- set_name->attributes |= DNS_NAMEATTR_ABSOLUTE;
- } else {
- set_name->attributes &= ~DNS_NAMEATTR_ABSOLUTE;
- }
+ set_name->attributes.absolute = absolute;
}
INSIST(nlabels == name->labels);
INSIST(offset == name->length);
name->ndata = (unsigned char *)target->base + target->used;
name->labels = labels;
name->length = nused;
- name->attributes |= DNS_NAMEATTR_ABSOLUTE;
+ name->attributes.absolute = true;
isc_buffer_forward(source, cused);
isc_buffer_add(target, name->length);
REQUIRE(cctx != NULL);
REQUIRE(ISC_BUFFER_VALID(target));
- compress = (name->attributes & DNS_NAMEATTR_NOCOMPRESS) == 0 &&
+ compress = !name->attributes.nocompress &&
dns_compress_getpermitted(cctx);
/*
if (suffix == NULL || suffix->labels == 0) {
copy_suffix = false;
}
- if (copy_prefix && (prefix->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
+ if (copy_prefix && prefix->attributes.absolute) {
absolute = true;
REQUIRE(!copy_suffix);
}
}
if (copy_suffix) {
- if ((suffix->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
+ if (suffix->attributes.absolute) {
absolute = true;
}
memmove(ndata + prefix_length, suffix->ndata, suffix->length);
name->ndata = ndata;
name->labels = labels;
name->length = length;
- if (absolute) {
- name->attributes = DNS_NAMEATTR_ABSOLUTE;
- } else {
- name->attributes = 0;
- }
+ name->attributes.absolute = absolute;
if (name->labels > 0 && name->offsets != NULL) {
INIT_OFFSETS(name, offsets, odata);
target->length = source->length;
target->labels = source->labels;
- target->attributes = DNS_NAMEATTR_DYNAMIC;
- if ((source->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
- target->attributes |= DNS_NAMEATTR_ABSOLUTE;
- }
+ target->attributes = (struct dns_name_attrs){ .dynamic = true };
+ target->attributes.absolute = source->attributes.absolute;
if (target->offsets != NULL) {
if (source->offsets != NULL) {
memmove(target->offsets, source->offsets,
target->length = source->length;
target->labels = source->labels;
- target->attributes = DNS_NAMEATTR_DYNAMIC | DNS_NAMEATTR_DYNOFFSETS |
- DNS_NAMEATTR_READONLY;
- if ((source->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
- target->attributes |= DNS_NAMEATTR_ABSOLUTE;
- }
+ target->attributes = (struct dns_name_attrs){ .dynamic = true,
+ .dynoffsets = true,
+ .readonly = true };
+ target->attributes.absolute = source->attributes.absolute;
target->offsets = target->ndata + source->length;
if (source->offsets != NULL) {
memmove(target->offsets, source->offsets, source->labels);
*/
REQUIRE(VALID_NAME(name));
- REQUIRE((name->attributes & DNS_NAMEATTR_DYNAMIC) != 0);
+ REQUIRE(name->attributes.dynamic);
size = name->length;
- if ((name->attributes & DNS_NAMEATTR_DYNOFFSETS) != 0) {
+ if (name->attributes.dynoffsets) {
size += name->labels;
}
isc_mem_put(mctx, name->ndata, size);
* Returns whether there is dynamic memory associated with this name.
*/
- return ((name->attributes & DNS_NAMEATTR_DYNAMIC) != 0 ? true : false);
+ return (name->attributes.dynamic);
}
isc_result_t
dest->ndata = ndata;
dest->labels = source->labels;
dest->length = source->length;
- if ((source->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) {
- dest->attributes = DNS_NAMEATTR_ABSOLUTE;
- } else {
- dest->attributes = 0;
- }
+ dest->attributes.absolute = source->attributes.absolute;
if (dest->labels > 0 && dest->offsets != NULL) {
if (source->offsets != NULL && source->labels != 0) {
while (result == ISC_R_SUCCESS) {
name = NULL;
dns_message_currentname(message, DNS_SECTION_AUTHORITY, &name);
- if ((name->attributes & DNS_NAMEATTR_NCACHE) != 0) {
+ if (name->attributes.ncache) {
for (rdataset = ISC_LIST_HEAD(name->list);
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
/*! \file */
+#define DNS_NAME_USEINLINE 1
+
#include <inttypes.h>
#include <stdbool.h>
#include <sys/stat.h>
* This define is so dns/name.h (included by dns/fixedname.h) uses more
* efficient macro calls instead of functions for a few operations.
*/
-#define DNS_NAME_USEINLINE 1
-
#include <unistd.h>
#include <isc/result.h>
name->labels = node->offsetlen;
name->ndata = NAME(node);
name->offsets = OFFSETS(node);
- name->attributes = node->absolute ? DNS_NAMEATTR_ABSOLUTE : 0;
- name->attributes |= DNS_NAMEATTR_READONLY;
+ name->attributes = (struct dns_name_attrs){ .absolute = node->absolute,
+ .readonly = true };
}
#ifdef DEBUG
/*
* Set up the new root of the next level.
* By definition it will not be the top
- * level tree, so clear DNS_NAMEATTR_ABSOLUTE.
+ * level tree, so clear the absolute flag.
*/
current->is_root = 1;
current->parent = new_current;
*/
node->oldnamelen = node->namelen = region.length;
OLDOFFSETLEN(node) = node->offsetlen = labels;
- node->absolute = (name->attributes & DNS_NAMEATTR_ABSOLUTE) != 0;
+ node->absolute = name->attributes.absolute;
memmove(NAME(node), region.base, region.length);
memmove(OFFSETS(node), name->offsets, labels);
*/
name->labels--;
name->length--;
- name->attributes &= ~DNS_NAMEATTR_ABSOLUTE;
+ name->attributes.absolute = false;
}
}
}
}
if (wild) {
- foundname->attributes |= DNS_NAMEATTR_WILDCARD;
+ foundname->attributes.wildcard = true;
}
goto node_exit;
}
}
if (wild) {
- foundname->attributes |= DNS_NAMEATTR_WILDCARD;
+ foundname->attributes.wildcard = true;
}
node_exit:
dns_rdataset_getownercase(rdataset, name);
offset = 0xffff;
- name->attributes |= owner_name->attributes & DNS_NAMEATTR_NOCOMPRESS;
+ name->attributes.nocompress |= owner_name->attributes.nocompress;
do {
/*
need_validation = secure_domain;
}
- if (((name->attributes & DNS_NAMEATTR_ANSWER) != 0) &&
- (!need_validation)) {
+ if (name->attributes.answer && !need_validation) {
have_answer = true;
event = ISC_LIST_HEAD(fctx->events);
if ((fctx->type != dns_rdatatype_any &&
fctx->type != dns_rdatatype_rrsig &&
fctx->type != dns_rdatatype_sig) ||
- (name->attributes & DNS_NAMEATTR_CHAINING) != 0)
+ name->attributes.chaining)
{
ardataset = event->rdataset;
asigrdataset = event->sigrdataset;
while (result == ISC_R_SUCCESS) {
name = NULL;
dns_message_currentname(message, section, &name);
- if ((name->attributes & DNS_NAMEATTR_CACHE) != 0) {
+ if (name->attributes.cache) {
result = cache_name(fctx, name, message,
addrinfo, now);
if (result != ISC_R_SUCCESS) {
static void
mark_related(dns_name_t *name, dns_rdataset_t *rdataset, bool external,
bool gluing) {
- name->attributes |= DNS_NAMEATTR_CACHE;
+ name->attributes.cache = true;
if (gluing) {
rdataset->trust = dns_trust_glue;
/*
* Avoid infinite loops by only marking new rdatasets.
*/
if (!CACHE(rdataset)) {
- name->attributes |= DNS_NAMEATTR_CHASE;
+ name->attributes.chase = true;
rdataset->attributes |= DNS_RDATASETATTR_CHASE;
}
rdataset->attributes |= DNS_RDATASETATTR_CACHE;
return (ISC_R_COMPLETE);
}
- rctx->aname->attributes |= DNS_NAMEATTR_CACHE;
- rctx->aname->attributes |= DNS_NAMEATTR_ANSWER;
+ rctx->aname->attributes.cache = true;
+ rctx->aname->attributes.answer = true;
rdataset->attributes |= DNS_RDATASETATTR_ANSWER;
rdataset->attributes |= DNS_RDATASETATTR_CACHE;
rdataset->trust = rctx->trust;
return (ISC_R_COMPLETE);
}
- rctx->aname->attributes |= DNS_NAMEATTR_CACHE;
- rctx->aname->attributes |= DNS_NAMEATTR_ANSWER;
+ rctx->aname->attributes.cache = true;
+ rctx->aname->attributes.answer = true;
rctx->ardataset->attributes |= DNS_RDATASETATTR_ANSWER;
rctx->ardataset->attributes |= DNS_RDATASETATTR_CACHE;
rctx->ardataset->trust = rctx->trust;
return (ISC_R_COMPLETE);
}
- rctx->cname->attributes |= DNS_NAMEATTR_CACHE;
- rctx->cname->attributes |= DNS_NAMEATTR_ANSWER;
- rctx->cname->attributes |= DNS_NAMEATTR_CHAINING;
+ rctx->cname->attributes.cache = true;
+ rctx->cname->attributes.answer = true;
+ rctx->cname->attributes.chaining = true;
rctx->crdataset->attributes |= DNS_RDATASETATTR_ANSWER;
rctx->crdataset->attributes |= DNS_RDATASETATTR_CACHE;
rctx->crdataset->attributes |= DNS_RDATASETATTR_CHAINING;
return (ISC_R_COMPLETE);
}
- rctx->dname->attributes |= DNS_NAMEATTR_CACHE;
- rctx->dname->attributes |= DNS_NAMEATTR_ANSWER;
- rctx->dname->attributes |= DNS_NAMEATTR_CHAINING;
+ rctx->dname->attributes.cache = true;
+ rctx->dname->attributes.answer = true;
+ rctx->dname->attributes.chaining = true;
rctx->drdataset->attributes |= DNS_RDATASETATTR_ANSWER;
rctx->drdataset->attributes |= DNS_RDATASETATTR_CACHE;
rctx->drdataset->attributes |= DNS_RDATASETATTR_CHAINING;
(rdataset->type == dns_rdatatype_rrsig &&
rdataset->covers == dns_rdatatype_ns))
{
- name->attributes |= DNS_NAMEATTR_CACHE;
+ name->attributes.cache = true;
rdataset->attributes |=
DNS_RDATASETATTR_CACHE;
* NS RRs we may have found.
*/
if (rctx->ns_name != NULL) {
- rctx->ns_name->attributes &= ~DNS_NAMEATTR_CACHE;
+ rctx->ns_name->attributes.cache = false;
}
if (rctx->negative) {
rctx->ns_name = name;
rctx->ns_rdataset = rdataset;
}
- name->attributes |= DNS_NAMEATTR_CACHE;
+ name->attributes.cache = true;
rdataset->attributes |= DNS_RDATASETATTR_CACHE;
rdataset->trust = dns_trust_glue;
break;
}
rctx->soa_name = name;
}
- name->attributes |= DNS_NAMEATTR_NCACHE;
+ name->attributes.ncache = true;
rdataset->attributes |= DNS_RDATASETATTR_NCACHE;
if (rctx->aa) {
rdataset->trust =
case dns_rdatatype_nsec:
case dns_rdatatype_nsec3:
if (rctx->negative) {
- name->attributes |= DNS_NAMEATTR_NCACHE;
+ name->attributes.ncache = true;
rdataset->attributes |=
DNS_RDATASETATTR_NCACHE;
} else if (type == dns_rdatatype_nsec) {
- name->attributes |= DNS_NAMEATTR_CACHE;
+ name->attributes.cache = true;
rdataset->attributes |=
DNS_RDATASETATTR_CACHE;
}
rctx->ds_name = name;
}
- name->attributes |= DNS_NAMEATTR_CACHE;
+ name->attributes.cache = true;
rdataset->attributes |= DNS_RDATASETATTR_CACHE;
if ((fctx->options & DNS_FETCHOPT_NONTA) != 0) {
dns_rdataset_t *rdataset;
dns_message_currentname(rctx->query->rmessage,
DNS_SECTION_ADDITIONAL, &name);
- if ((name->attributes & DNS_NAMEATTR_CHASE) == 0) {
+ if (!name->attributes.chase) {
continue;
}
- name->attributes &= ~DNS_NAMEATTR_CHASE;
+ name->attributes.chase = false;
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
{
if (qname != NULL && qname->labels != 0) {
dns_name_t *origin = NULL;
- if ((qname->attributes & DNS_NAMEATTR_WILDCARD) != 0 &&
- zone != NULL && (origin = dns_zone_getorigin(zone)) != NULL)
+ if (qname->attributes.wildcard && zone != NULL &&
+ (origin = dns_zone_getorigin(zone)) != NULL)
{
dns_fixedname_t fixed;
dns_name_t *wild;
msg->tsigname = owner;
/* Windows does not like the tsig name being compressed. */
- msg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
+ msg->tsigname->attributes.nocompress = true;
return (ISC_R_SUCCESS);
dst_context_destroy(&xfr->tsigctx);
}
- if ((xfr->name.attributes & DNS_NAMEATTR_DYNAMIC) != 0) {
+ if (xfr->name.attributes.dynamic) {
dns_name_free(&xfr->name, xfr->mctx);
}
}
if (!dns_rdataset_isassociated(qctx->rdataset) &&
WANTDNSSEC(qctx->client)) {
- if ((qctx->fname->attributes & DNS_NAMEATTR_WILDCARD) == 0) {
+ if (!qctx->fname->attributes.wildcard) {
dns_name_t *found;
dns_name_t *qname;
dns_fixedname_t fixed;
INSIST(qctx->fname != NULL);
- if ((qctx->fname->attributes & DNS_NAMEATTR_WILDCARD) == 0) {
+ if (!qctx->fname->attributes.wildcard) {
query_addrrset(qctx, &qctx->fname, &qctx->rdataset,
&qctx->sigrdataset, NULL, DNS_SECTION_AUTHORITY);
return;
sigrdatasetp = &qctx->sigrdataset;
}
- if (WANTDNSSEC(qctx->client) &&
- (qctx->fname->attributes & DNS_NAMEATTR_WILDCARD) != 0)
- {
+ if (WANTDNSSEC(qctx->client) && qctx->fname->attributes.wildcard) {
dns_fixedname_init(&qctx->wildcardname);
dns_name_copy(qctx->fname,
dns_fixedname_name(&qctx->wildcardname));
sigrdatasetp = &qctx->sigrdataset;
}
- if (WANTDNSSEC(qctx->client) &&
- (qctx->fname->attributes & DNS_NAMEATTR_WILDCARD) != 0)
- {
+ if (WANTDNSSEC(qctx->client) && qctx->fname->attributes.wildcard) {
dns_fixedname_init(&qctx->wildcardname);
dns_name_copy(qctx->fname,
dns_fixedname_name(&qctx->wildcardname));
CALL_HOOK(NS_QUERY_PREP_RESPONSE_BEGIN, qctx);
- if (WANTDNSSEC(qctx->client) &&
- (qctx->fname->attributes & DNS_NAMEATTR_WILDCARD) != 0)
- {
+ if (WANTDNSSEC(qctx->client) && qctx->fname->attributes.wildcard) {
dns_fixedname_init(&qctx->wildcardname);
dns_name_copy(qctx->fname,
dns_fixedname_name(&qctx->wildcardname));
ISC_RUN_TEST_IMPL(init) {
dns_name_t name;
unsigned char offsets[1];
+ struct dns_name_attrs zeroes = {};
UNUSED(state);
assert_null(name.ndata);
assert_int_equal(name.length, 0);
assert_int_equal(name.labels, 0);
- assert_int_equal(name.attributes, 0);
+ assert_memory_equal(&name.attributes, &zeroes, sizeof(zeroes));
assert_ptr_equal(name.offsets, offsets);
assert_null(name.buffer);
}
ISC_RUN_TEST_IMPL(invalidate) {
dns_name_t name;
unsigned char offsets[1];
+ struct dns_name_attrs zeroes = {};
UNUSED(state);
assert_null(name.ndata);
assert_int_equal(name.length, 0);
assert_int_equal(name.labels, 0);
- assert_int_equal(name.attributes, 0);
+ assert_memory_equal(&name.attributes, &zeroes, sizeof(zeroes));
assert_null(name.offsets);
assert_null(name.buffer);
}