+4654. [cleanup] Don't use C++ keywords delete, new and namespace.
+ [RT #45538]
+
4653. [bug] Reorder includes to move @DST_OPENSSL_INC@ and
@ISC_OPENSSL_INC@ after shipped include directories.
[RT #45581]
check_result(result, "dns_message_gettempname");
dns_name_init(lookup->name, NULL);
- isc_buffer_init(&lookup->namebuf, lookup->namespace,
- sizeof(lookup->namespace));
- isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
- sizeof(lookup->onamespace));
+ isc_buffer_init(&lookup->namebuf, lookup->name_space,
+ sizeof(lookup->name_space));
+ isc_buffer_init(&lookup->onamebuf, lookup->oname_space,
+ sizeof(lookup->oname_space));
#ifdef WITH_IDN
/*
dns_rdataclass_t rdclass;
isc_boolean_t rdtypeset;
isc_boolean_t rdclassset;
- char namespace[BUFSIZE];
- char onamespace[BUFSIZE];
+ char name_space[BUFSIZE];
+ char oname_space[BUFSIZE];
isc_buffer_t namebuf;
isc_buffer_t onamebuf;
isc_buffer_t renderbuf;
char *label = NULL;
dns_ttl_t ttl = 0;
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
- isc_stdtime_t inactive = 0, delete = 0;
+ isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
if (setdel || unsetdel)
fatal("-D specified more than once");
- delete = strtotime(isc_commandline_argument,
- now, now, &setdel);
+ deltime = strtotime(isc_commandline_argument,
+ now, now, &setdel);
unsetdel = !setdel;
break;
case 'S':
dst_key_settime(key, DST_TIME_INACTIVE, inactive);
if (setdel)
- dst_key_settime(key, DST_TIME_DELETE, delete);
+ dst_key_settime(key, DST_TIME_DELETE, deltime);
if (setsyncadd)
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
if (setsyncdel)
dns_ttl_t ttl = 0;
isc_boolean_t use_default = ISC_FALSE, use_nsec3 = ISC_FALSE;
isc_stdtime_t publish = 0, activate = 0, revokekey = 0;
- isc_stdtime_t inactive = 0, delete = 0;
+ isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
if (setdel || unsetdel)
fatal("-D specified more than once");
- delete = strtotime(isc_commandline_argument,
- now, now, &setdel);
+ deltime = strtotime(isc_commandline_argument,
+ now, now, &setdel);
unsetdel = !setdel;
break;
case 'S':
inactive);
if (setdel) {
- if (setinact && delete < inactive)
+ if (setinact && deltime < inactive)
fprintf(stderr, "%s: warning: Key is "
"scheduled to be deleted "
"before it is scheduled to be "
"made inactive.\n",
program);
- dst_key_settime(key, DST_TIME_DELETE, delete);
+ dst_key_settime(key, DST_TIME_DELETE, deltime);
}
if (setsyncadd)
/* Grow lists? */
if (listcount == l) {
- void * new;
+ void * tmp;
isc_uint32_t newlen = listcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*lists);
oldsize = listcount * sizeof(*lists);
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
if (listcount != 0) {
- memmove(new, lists, oldsize);
+ memmove(tmp, lists, oldsize);
isc_mem_put(mctx, lists, oldsize);
}
- lists = new;
+ lists = tmp;
listcount = newlen;
}
/* Seen? */
lists[l++].name = listname;
/* Grow stack? */
if (stackcount == pushed) {
- void * new;
+ void * tmp;
isc_uint32_t newlen = stackcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*stack);
oldsize = stackcount * sizeof(*stack);
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
if (stackcount != 0) {
- memmove(new, stack, oldsize);
+ memmove(tmp, stack, oldsize);
isc_mem_put(mctx, stack, oldsize);
}
- stack = new;
+ stack = tmp;
stackcount = newlen;
}
/*
}
if (i == addrcount) {
- void * new;
+ void * tmp;
isc_uint32_t newlen = addrcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(isc_sockaddr_t);
oldsize = addrcount * sizeof(isc_sockaddr_t);
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
if (addrcount != 0) {
- memmove(new, addrs, oldsize);
+ memmove(tmp, addrs, oldsize);
isc_mem_put(mctx, addrs, oldsize);
}
- addrs = new;
+ addrs = tmp;
addrcount = newlen;
newsize = newlen * sizeof(isc_dscp_t);
oldsize = dscpcount * sizeof(isc_dscp_t);
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
if (dscpcount != 0) {
- memmove(new, dscps, oldsize);
+ memmove(tmp, dscps, oldsize);
isc_mem_put(mctx, dscps, oldsize);
}
- dscps = new;
+ dscps = tmp;
dscpcount = newlen;
newsize = newlen * sizeof(dns_name_t *);
oldsize = keycount * sizeof(dns_name_t *);
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
if (keycount != 0) {
- memmove(new, keys, oldsize);
+ memmove(tmp, keys, oldsize);
isc_mem_put(mctx, keys, oldsize);
}
- keys = new;
+ keys = tmp;
keycount = newlen;
}
goto resume;
}
if (i < addrcount) {
- void * new;
+ void * tmp;
size_t newsize, oldsize;
newsize = i * sizeof(isc_sockaddr_t);
oldsize = addrcount * sizeof(isc_sockaddr_t);
if (i != 0) {
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
- memmove(new, addrs, newsize);
+ memmove(tmp, addrs, newsize);
} else
- new = NULL;
+ tmp = NULL;
isc_mem_put(mctx, addrs, oldsize);
- addrs = new;
+ addrs = tmp;
addrcount = i;
newsize = i * sizeof(isc_dscp_t);
oldsize = dscpcount * sizeof(isc_dscp_t);
if (i != 0) {
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
- memmove(new, dscps, newsize);
+ memmove(tmp, dscps, newsize);
} else
- new = NULL;
+ tmp = NULL;
isc_mem_put(mctx, dscps, oldsize);
- dscps = new;
+ dscps = tmp;
dscpcount = i;
newsize = i * sizeof(dns_name_t *);
oldsize = keycount * sizeof(dns_name_t *);
if (i != 0) {
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ tmp = isc_mem_get(mctx, newsize);
+ if (tmp == NULL)
goto cleanup;
- memmove(new, keys, newsize);
+ memmove(tmp, keys, newsize);
} else
- new = NULL;
+ tmp = NULL;
isc_mem_put(mctx, keys, oldsize);
- keys = new;
+ keys = tmp;
keycount = i;
}
main(int argc, char **argv) {
isc_result_t result;
char *origin, *file1, *file2, *journal;
- dns_db_t *old = NULL, *new = NULL;
+ dns_db_t *olddb = NULL, *newdb = NULL;
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
dns_result_register();
- result = loadzone(&old, origin, file1);
+ result = loadzone(&olddb, origin, file1);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "Couldn't load %s: ", file1);
goto cleanup;
}
- result = loadzone(&new, origin, file2);
+ result = loadzone(&newdb, origin, file2);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "Couldn't load %s: ", file2);
goto cleanup;
}
- result = dns_db_diff(mctx, new, NULL, old, NULL, journal);
+ result = dns_db_diff(mctx, newdb, NULL, olddb, NULL, journal);
cleanup:
if (result != ISC_R_SUCCESS)
fprintf(stderr, "%s\n", isc_result_totext(result));
- if (new != NULL)
- dns_db_detach(&new);
- if (old != NULL)
- dns_db_detach(&old);
+ if (newdb != NULL)
+ dns_db_detach(&newdb);
+ if (olddb != NULL)
+ dns_db_detach(&olddb);
if (lctx != NULL)
isc_log_destroy(&lctx);
}
/* Grow stack? */
if (stackcount == pushed) {
- void * new;
+ void * newstack;
isc_uint32_t newlen = stackcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*stack);
oldsize = stackcount * sizeof(*stack);
- new = isc_mem_get(mctx, newsize);
- if (new == NULL)
+ newstack = isc_mem_get(mctx, newsize);
+ if (newstack == NULL)
goto cleanup;
if (stackcount != 0) {
void *ptr;
DE_CONST(stack, ptr);
- memmove(new, stack, oldsize);
+ memmove(newstack, stack, oldsize);
isc_mem_put(mctx, ptr, oldsize);
}
- stack = new;
+ stack = newstack;
stackcount = newlen;
}
stack[pushed++] = cfg_list_next(element);
isc_result_t
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
- const dns_name_t *namespace, isc_sockaddrlist_t *addrs)
+ const dns_name_t *name_space, isc_sockaddrlist_t *addrs)
{
isc_result_t result;
dns_view_t *view = NULL;
REQUIRE(DNS_CLIENT_VALID(client));
REQUIRE(addrs != NULL);
- if (namespace == NULL)
- namespace = dns_rootname;
+ if (name_space == NULL)
+ name_space = dns_rootname;
LOCK(&client->lock);
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
}
UNLOCK(&client->lock);
- result = dns_fwdtable_add(view->fwdtable, namespace, addrs,
+ result = dns_fwdtable_add(view->fwdtable, name_space, addrs,
dns_fwdpolicy_only);
dns_view_detach(&view);
isc_result_t
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
- const dns_name_t *namespace)
+ const dns_name_t *name_space)
{
isc_result_t result;
dns_view_t *view = NULL;
REQUIRE(DNS_CLIENT_VALID(client));
- if (namespace == NULL)
- namespace = dns_rootname;
+ if (name_space == NULL)
+ name_space = dns_rootname;
LOCK(&client->lock);
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
}
UNLOCK(&client->lock);
- result = dns_fwdtable_delete(view->fwdtable, namespace);
+ result = dns_fwdtable_delete(view->fwdtable, name_space);
dns_view_detach(&view);
dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
unsigned int prefixlen, const isc_netaddr_t *suffix,
dns_acl_t *clients, dns_acl_t *mapped, dns_acl_t *excluded,
- unsigned int flags, dns_dns64_t **dns64)
+ unsigned int flags, dns_dns64_t **dns64p)
{
- dns_dns64_t *new;
+ dns_dns64_t *dns64;
unsigned int nbytes = 16;
REQUIRE(prefix != NULL && prefix->family == AF_INET6);
REQUIRE(prefixlen == 32 || prefixlen == 40 || prefixlen == 48 ||
prefixlen == 56 || prefixlen == 64 || prefixlen == 96);
REQUIRE(isc_netaddr_prefixok(prefix, prefixlen) == ISC_R_SUCCESS);
- REQUIRE(dns64 != NULL && *dns64 == NULL);
+ REQUIRE(dns64p != NULL && *dns64p == NULL);
if (suffix != NULL) {
static const unsigned char zeros[16];
REQUIRE(memcmp(suffix->type.in6.s6_addr, zeros, nbytes) == 0);
}
- new = isc_mem_get(mctx, sizeof(dns_dns64_t));
- if (new == NULL)
+ dns64 = isc_mem_get(mctx, sizeof(dns_dns64_t));
+ if (dns64 == NULL)
return (ISC_R_NOMEMORY);
- memset(new->bits, 0, sizeof(new->bits));
- memmove(new->bits, prefix->type.in6.s6_addr, prefixlen / 8);
+ memset(dns64->bits, 0, sizeof(dns64->bits));
+ memmove(dns64->bits, prefix->type.in6.s6_addr, prefixlen / 8);
if (suffix != NULL)
- memmove(new->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
+ memmove(dns64->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
16 - nbytes);
- new->clients = NULL;
+ dns64->clients = NULL;
if (clients != NULL)
- dns_acl_attach(clients, &new->clients);
- new->mapped = NULL;
+ dns_acl_attach(clients, &dns64->clients);
+ dns64->mapped = NULL;
if (mapped != NULL)
- dns_acl_attach(mapped, &new->mapped);
- new->excluded = NULL;
+ dns_acl_attach(mapped, &dns64->mapped);
+ dns64->excluded = NULL;
if (excluded != NULL)
- dns_acl_attach(excluded, &new->excluded);
- new->prefixlen = prefixlen;
- new->flags = flags;
- ISC_LINK_INIT(new, link);
- new->mctx = NULL;
- isc_mem_attach(mctx, &new->mctx);
- *dns64 = new;
+ dns_acl_attach(excluded, &dns64->excluded);
+ dns64->prefixlen = prefixlen;
+ dns64->flags = flags;
+ ISC_LINK_INIT(dns64, link);
+ dns64->mctx = NULL;
+ isc_mem_attach(mctx, &dns64->mctx);
+ *dns64p = dns64;
return (ISC_R_SUCCESS);
}
isc_boolean_t
dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) {
isc_result_t result;
- isc_stdtime_t publish, active, revoke, inactive, delete;
+ isc_stdtime_t publish, active, revoke, inactive, deltime;
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
isc_boolean_t delset = ISC_FALSE;
if (result == ISC_R_SUCCESS)
inactset = ISC_TRUE;
- result = dst_key_gettime(key, DST_TIME_DELETE, &delete);
+ result = dst_key_gettime(key, DST_TIME_DELETE, &deltime);
if (result == ISC_R_SUCCESS)
delset = ISC_TRUE;
- if ((inactset && inactive <= now) || (delset && delete <= now))
+ if ((inactset && inactive <= now) || (delset && deltime <= now))
return (ISC_FALSE);
if (revset && revoke <= now && pubset && publish <= now)
static void
get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
isc_result_t result;
- isc_stdtime_t publish, active, revoke, inactive, delete;
+ isc_stdtime_t publish, active, revoke, inactive, deltime;
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
isc_boolean_t delset = ISC_FALSE;
if (result == ISC_R_SUCCESS)
inactset = ISC_TRUE;
- result = dst_key_gettime(key->key, DST_TIME_DELETE, &delete);
+ result = dst_key_gettime(key->key, DST_TIME_DELETE, &deltime);
if (result == ISC_R_SUCCESS)
delset = ISC_TRUE;
/*
* Metadata says delete, so don't publish this key or sign with it.
*/
- if (delset && delete <= now) {
+ if (delset && deltime <= now) {
key->hint_publish = ISC_FALSE;
key->hint_sign = ISC_FALSE;
key->hint_remove = ISC_TRUE;
}
static isc_result_t
-delete(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
- dns_ttl_t ttl, isc_mem_t *mctx)
+delrdata(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
+ dns_ttl_t ttl, isc_mem_t *mctx)
{
isc_result_t result;
dns_difftuple_t *tuple = NULL;
if (dns_rdataset_isassociated(cds) &&
syncdelete(key->key, now)) {
if (exists(cds, &cdsrdata1))
- RETERR(delete(&cdsrdata1, diff, origin,
- cds->ttl, mctx));
+ RETERR(delrdata(&cdsrdata1, diff, origin,
+ cds->ttl, mctx));
if (exists(cds, &cdsrdata2))
- RETERR(delete(&cdsrdata2, diff, origin,
- cds->ttl, mctx));
+ RETERR(delrdata(&cdsrdata2, diff, origin,
+ cds->ttl, mctx));
}
if (dns_rdataset_isassociated(cdnskey) &&
syncdelete(key->key, now)) {
if (exists(cdnskey, &cdnskeyrdata))
- RETERR(delete(&cdnskeyrdata, diff, origin,
- cdnskey->ttl, mctx));
+ RETERR(delrdata(&cdnskeyrdata, diff, origin,
+ cdnskey->ttl, mctx));
}
}
DNS_DSDIGEST_SHA256, dsbuf2,
&cdsrdata2));
if (exists(cds, &cdsrdata1))
- RETERR(delete(&cdsrdata1, diff, origin,
- cds->ttl, mctx));
+ RETERR(delrdata(&cdsrdata1, diff, origin,
+ cds->ttl, mctx));
if (exists(cds, &cdsrdata2))
- RETERR(delete(&cdsrdata2, diff, origin,
- cds->ttl, mctx));
+ RETERR(delrdata(&cdsrdata2, diff, origin,
+ cds->ttl, mctx));
}
if (dns_rdataset_isassociated(cdnskey)) {
if (exists(cdnskey, &cdnskeyrdata))
- RETERR(delete(&cdnskeyrdata, diff, origin,
- cdnskey->ttl, mctx));
+ RETERR(delrdata(&cdnskeyrdata, diff, origin,
+ cdnskey->ttl, mctx));
}
}
isc_result_t
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
- const dns_name_t *namespace, isc_sockaddrlist_t *addrs);
+ const dns_name_t *name_space, isc_sockaddrlist_t *addrs);
/*%<
* Specify a list of addresses of recursive name servers that the client will
* use for name resolution. A view for the 'rdclass' class must be created
- * beforehand. If 'namespace' is non NULL, the specified server will be used
- * if and only if the query name is a subdomain of 'namespace'. When servers
- * for multiple 'namespace's are provided, and a query name is covered by
- * more than one 'namespace', the servers for the best (longest) matching
- * namespace will be used. If 'namespace' is NULL, it works as if
+ * beforehand. If 'name_space' is non NULL, the specified server will be used
+ * if and only if the query name is a subdomain of 'name_space'. When servers
+ * for multiple 'name_space's are provided, and a query name is covered by
+ * more than one 'name_space', the servers for the best (longest) matching
+ * name_space will be used. If 'name_space' is NULL, it works as if
* dns_rootname (.) were specified.
*
* Requires:
*
*\li 'client' is a valid client.
*
- *\li 'namespace' is NULL or a valid name.
+ *\li 'name_space' is NULL or a valid name.
*
*\li 'addrs' != NULL.
*
isc_result_t
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
- const dns_name_t *namespace);
+ const dns_name_t *name_space);
/*%<
- * Remove configured recursive name servers for the 'rdclass' and 'namespace'
+ * Remove configured recursive name servers for the 'rdclass' and 'name_space'
* from the client. See the description of dns_client_setservers() for
- * the requirements about 'rdclass' and 'namespace'.
+ * the requirements about 'rdclass' and 'name_space'.
*
* Requires:
*
*\li 'client' is a valid client.
*
- *\li 'namespace' is NULL or a valid name.
+ *\li 'name_space' is NULL or a valid name.
*
* Returns:
*
unsigned int i;
journal_pos_t best_guess;
journal_pos_t current_pos;
- dns_journal_t *j = NULL;
- dns_journal_t *new = NULL;
+ dns_journal_t *j1 = NULL;
+ dns_journal_t *j2 = NULL;
journal_rawheader_t rawheader;
unsigned int copy_length;
size_t namelen;
if (result != ISC_R_SUCCESS)
return (result);
- result = journal_open(mctx, filename, ISC_FALSE, ISC_FALSE, &j);
+ result = journal_open(mctx, filename, ISC_FALSE, ISC_FALSE, &j1);
if (result == ISC_R_NOTFOUND) {
is_backup = ISC_TRUE;
- result = journal_open(mctx, backup, ISC_FALSE, ISC_FALSE, &j);
+ result = journal_open(mctx, backup, ISC_FALSE, ISC_FALSE, &j1);
}
if (result != ISC_R_SUCCESS)
return (result);
- if (JOURNAL_EMPTY(&j->header)) {
- dns_journal_destroy(&j);
+ if (JOURNAL_EMPTY(&j1->header)) {
+ dns_journal_destroy(&j1);
return (ISC_R_SUCCESS);
}
- if (DNS_SERIAL_GT(j->header.begin.serial, serial) ||
- DNS_SERIAL_GT(serial, j->header.end.serial)) {
- dns_journal_destroy(&j);
+ if (DNS_SERIAL_GT(j1->header.begin.serial, serial) ||
+ DNS_SERIAL_GT(serial, j1->header.end.serial)) {
+ dns_journal_destroy(&j1);
return (ISC_R_RANGE);
}
* Cope with very small target sizes.
*/
indexend = sizeof(journal_rawheader_t) +
- j->header.index_size * sizeof(journal_rawpos_t);
+ j1->header.index_size * sizeof(journal_rawpos_t);
if (target_size < DNS_JOURNAL_SIZE_MIN)
target_size = DNS_JOURNAL_SIZE_MIN;
if (target_size < indexend * 2)
/*
* See if there is any work to do.
*/
- if ((isc_uint32_t) j->header.end.offset < target_size) {
- dns_journal_destroy(&j);
+ if ((isc_uint32_t) j1->header.end.offset < target_size) {
+ dns_journal_destroy(&j1);
return (ISC_R_SUCCESS);
}
- CHECK(journal_open(mctx, newname, ISC_TRUE, ISC_TRUE, &new));
+ CHECK(journal_open(mctx, newname, ISC_TRUE, ISC_TRUE, &j2));
/*
* Remove overhead so space test below can succeed.
/*
* Find if we can create enough free space.
*/
- best_guess = j->header.begin;
- for (i = 0; i < j->header.index_size; i++) {
- if (POS_VALID(j->index[i]) &&
- DNS_SERIAL_GE(serial, j->index[i].serial) &&
- ((isc_uint32_t)(j->header.end.offset - j->index[i].offset)
+ best_guess = j1->header.begin;
+ for (i = 0; i < j1->header.index_size; i++) {
+ if (POS_VALID(j1->index[i]) &&
+ DNS_SERIAL_GE(serial, j1->index[i].serial) &&
+ ((isc_uint32_t)(j1->header.end.offset - j1->index[i].offset)
>= target_size / 2) &&
- j->index[i].offset > best_guess.offset)
- best_guess = j->index[i];
+ j1->index[i].offset > best_guess.offset)
+ best_guess = j1->index[i];
}
current_pos = best_guess;
while (current_pos.serial != serial) {
- CHECK(journal_next(j, ¤t_pos));
- if (current_pos.serial == j->header.end.serial)
+ CHECK(journal_next(j1, ¤t_pos));
+ if (current_pos.serial == j1->header.end.serial)
break;
if (DNS_SERIAL_GE(serial, current_pos.serial) &&
- ((isc_uint32_t)(j->header.end.offset - current_pos.offset)
+ ((isc_uint32_t)(j1->header.end.offset - current_pos.offset)
>= (target_size / 2)) &&
current_pos.offset > best_guess.offset)
best_guess = current_pos;
break;
}
- INSIST(best_guess.serial != j->header.end.serial);
+ INSIST(best_guess.serial != j1->header.end.serial);
if (best_guess.serial != serial)
- CHECK(journal_next(j, &best_guess));
+ CHECK(journal_next(j1, &best_guess));
/*
* We should now be roughly half target_size provided
* we did not reach 'serial'. If not we will just copy
* all uncommitted deltas regardless of the size.
*/
- copy_length = j->header.end.offset - best_guess.offset;
+ copy_length = j1->header.end.offset - best_guess.offset;
if (copy_length != 0) {
/*
goto failure;
}
- CHECK(journal_seek(j, best_guess.offset));
- CHECK(journal_seek(new, indexend));
+ CHECK(journal_seek(j1, best_guess.offset));
+ CHECK(journal_seek(j2, indexend));
for (i = 0; i < copy_length; i += size) {
unsigned int len = (copy_length - i) > size ? size :
(copy_length - i);
- CHECK(journal_read(j, buf, len));
- CHECK(journal_write(new, buf, len));
+ CHECK(journal_read(j1, buf, len));
+ CHECK(journal_write(j2, buf, len));
}
- CHECK(journal_fsync(new));
+ CHECK(journal_fsync(j2));
/*
* Compute new header.
*/
- new->header.begin.serial = best_guess.serial;
- new->header.begin.offset = indexend;
- new->header.end.serial = j->header.end.serial;
- new->header.end.offset = indexend + copy_length;
- new->header.sourceserial = j->header.sourceserial;
- new->header.serialset = j->header.serialset;
+ j2->header.begin.serial = best_guess.serial;
+ j2->header.begin.offset = indexend;
+ j2->header.end.serial = j1->header.end.serial;
+ j2->header.end.offset = indexend + copy_length;
+ j2->header.sourceserial = j1->header.sourceserial;
+ j2->header.serialset = j1->header.serialset;
/*
* Update the journal header.
*/
- journal_header_encode(&new->header, &rawheader);
- CHECK(journal_seek(new, 0));
- CHECK(journal_write(new, &rawheader, sizeof(rawheader)));
- CHECK(journal_fsync(new));
+ journal_header_encode(&j2->header, &rawheader);
+ CHECK(journal_seek(j2, 0));
+ CHECK(journal_write(j2, &rawheader, sizeof(rawheader)));
+ CHECK(journal_fsync(j2));
/*
* Build new index.
*/
- current_pos = new->header.begin;
- while (current_pos.serial != new->header.end.serial) {
- index_add(new, ¤t_pos);
- CHECK(journal_next(new, ¤t_pos));
+ current_pos = j2->header.begin;
+ while (current_pos.serial != j2->header.end.serial) {
+ index_add(j2, ¤t_pos);
+ CHECK(journal_next(j2, ¤t_pos));
}
/*
* Write index.
*/
- CHECK(index_to_disk(new));
- CHECK(journal_fsync(new));
+ CHECK(index_to_disk(j2));
+ CHECK(journal_fsync(j2));
- indexend = new->header.end.offset;
+ indexend = j2->header.end.offset;
POST(indexend);
}
* Close both journals before trying to rename files (this is
* necessary on WIN32).
*/
- dns_journal_destroy(&j);
- dns_journal_destroy(&new);
+ dns_journal_destroy(&j1);
+ dns_journal_destroy(&j2);
/*
* With a UFS file system this should just succeed and be atomic.
(void)isc_file_remove(newname);
if (buf != NULL)
isc_mem_put(mctx, buf, size);
- if (j != NULL)
- dns_journal_destroy(&j);
- if (new != NULL)
- dns_journal_destroy(&new);
+ if (j1 != NULL)
+ dns_journal_destroy(&j1);
+ if (j2 != NULL)
+ dns_journal_destroy(&j2);
return (result);
}
pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) {
isc_result_t result;
dns_incctx_t *ictx;
- dns_incctx_t *new = NULL;
+ dns_incctx_t *newctx = NULL;
isc_region_t r;
int new_in_use;
ictx = lctx->inc;
lctx->seen_include = ISC_TRUE;
- result = incctx_create(lctx->mctx, origin, &new);
+ result = incctx_create(lctx->mctx, origin, &newctx);
if (result != ISC_R_SUCCESS)
return (result);
/*
* Push origin_changed.
*/
- new->origin_changed = ictx->origin_changed;
+ newctx->origin_changed = ictx->origin_changed;
/* Set current domain. */
if (ictx->glue != NULL || ictx->current != NULL) {
for (new_in_use = 0; new_in_use < NBUFS; new_in_use++)
- if (!new->in_use[new_in_use])
+ if (!newctx->in_use[new_in_use])
break;
INSIST(new_in_use < NBUFS);
- new->current_in_use = new_in_use;
- new->current =
- dns_fixedname_name(&new->fixed[new->current_in_use]);
- new->in_use[new->current_in_use] = ISC_TRUE;
+ newctx->current_in_use = new_in_use;
+ newctx->current =
+ dns_fixedname_name(&newctx->fixed[newctx->current_in_use]);
+ newctx->in_use[newctx->current_in_use] = ISC_TRUE;
dns_name_toregion((ictx->glue != NULL) ?
ictx->glue : ictx->current, &r);
- dns_name_fromregion(new->current, &r);
- new->drop = ictx->drop;
+ dns_name_fromregion(newctx->current, &r);
+ newctx->drop = ictx->drop;
}
result = (lctx->openfile)(lctx, master_file);
if (result != ISC_R_SUCCESS)
goto cleanup;
- new->parent = ictx;
- lctx->inc = new;
+ newctx->parent = ictx;
+ lctx->inc = newctx;
if (lctx->include_cb != NULL)
lctx->include_cb(master_file, lctx->include_arg);
return (ISC_R_SUCCESS);
cleanup:
- incctx_destroy(lctx->mctx, new);
+ incctx_destroy(lctx->mctx, newctx);
return (result);
}
* Re-link glue and current list.
*/
static dns_rdatalist_t *
-grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
+grow_rdatalist(int new_len, dns_rdatalist_t *oldlist, int old_len,
rdatalist_head_t *current, rdatalist_head_t *glue,
isc_mem_t *mctx)
{
- dns_rdatalist_t *new;
+ dns_rdatalist_t *newlist;
int rdlcount = 0;
ISC_LIST(dns_rdatalist_t) save;
dns_rdatalist_t *this;
- new = isc_mem_get(mctx, new_len * sizeof(*new));
- if (new == NULL)
+ newlist = isc_mem_get(mctx, new_len * sizeof(*newlist));
+ if (newlist == NULL)
return (NULL);
ISC_LIST_INIT(save);
while ((this = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, this, link);
INSIST(rdlcount < new_len);
- new[rdlcount] = *this;
- ISC_LIST_APPEND(*current, &new[rdlcount], link);
+ newlist[rdlcount] = *this;
+ ISC_LIST_APPEND(*current, &newlist[rdlcount], link);
rdlcount++;
}
while ((this = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, this, link);
INSIST(rdlcount < new_len);
- new[rdlcount] = *this;
- ISC_LIST_APPEND(*glue, &new[rdlcount], link);
+ newlist[rdlcount] = *this;
+ ISC_LIST_APPEND(*glue, &newlist[rdlcount], link);
rdlcount++;
}
INSIST(rdlcount == old_len);
- if (old != NULL)
- isc_mem_put(mctx, old, old_len * sizeof(*old));
- return (new);
+ if (oldlist != NULL)
+ isc_mem_put(mctx, oldlist, old_len * sizeof(*oldlist));
+ return (newlist);
}
/*
* Re-link the current and glue chains.
*/
static dns_rdata_t *
-grow_rdata(int new_len, dns_rdata_t *old, int old_len,
+grow_rdata(int new_len, dns_rdata_t *oldlist, int old_len,
rdatalist_head_t *current, rdatalist_head_t *glue,
isc_mem_t *mctx)
{
- dns_rdata_t *new;
+ dns_rdata_t *newlist;
int rdcount = 0;
ISC_LIST(dns_rdata_t) save;
dns_rdatalist_t *this;
dns_rdata_t *rdata;
- new = isc_mem_get(mctx, new_len * sizeof(*new));
- if (new == NULL)
+ newlist = isc_mem_get(mctx, new_len * sizeof(*newlist));
+ if (newlist == NULL)
return (NULL);
- memset(new, 0, new_len * sizeof(*new));
+ memset(newlist, 0, new_len * sizeof(*newlist));
/*
* Copy current relinking.
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, rdata, link);
INSIST(rdcount < new_len);
- new[rdcount] = *rdata;
- ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
+ newlist[rdcount] = *rdata;
+ ISC_LIST_APPEND(this->rdata, &newlist[rdcount], link);
rdcount++;
}
this = ISC_LIST_NEXT(this, link);
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
ISC_LIST_UNLINK(save, rdata, link);
INSIST(rdcount < new_len);
- new[rdcount] = *rdata;
- ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
+ newlist[rdcount] = *rdata;
+ ISC_LIST_APPEND(this->rdata, &newlist[rdcount], link);
rdcount++;
}
this = ISC_LIST_NEXT(this, link);
}
INSIST(rdcount == old_len || rdcount == 0);
- if (old != NULL)
- isc_mem_put(mctx, old, old_len * sizeof(*old));
- return (new);
+ if (oldlist != NULL)
+ isc_mem_put(mctx, oldlist, old_len * sizeof(*oldlist));
+ return (newlist);
}
static isc_uint32_t
* change in "diff".
*/
static isc_result_t
-delete(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
- const dns_rdata_nsec3param_t *nsec3param, dns_diff_t *diff)
+delnsec3(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
+ const dns_rdata_nsec3param_t *nsec3param, dns_diff_t *diff)
{
dns_dbnode_t *node = NULL ;
dns_difftuple_t *tuple = NULL;
/*
* Delete the old previous NSEC3.
*/
- CHECK(delete(db, version, prev, nsec3param, diff));
+ CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
/*
* Delete the old NSEC3 and record the change.
*/
- CHECK(delete(db, version, hashname, nsec3param, diff));
+ CHECK(delnsec3(db, version, hashname, nsec3param, diff));
/*
* Add the new NSEC3 and record the change.
*/
/*
* Delete the old previous NSEC3.
*/
- CHECK(delete(db, version, prev, nsec3param, diff));
+ CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
/*
* Delete the old NSEC3 and record the change.
*/
- CHECK(delete(db, version, hashname, nsec3param, diff));
+ CHECK(delnsec3(db, version, hashname, nsec3param, diff));
/*
* Add the new NSEC3 and record the change.
/*
* Delete the old previous NSEC3.
*/
- CHECK(delete(db, version, prev, nsec3param, diff));
+ CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
/*
* Delete the old NSEC3 and record the change.
*/
- CHECK(delete(db, version, hashname, nsec3param, diff));
+ CHECK(delnsec3(db, version, hashname, nsec3param, diff));
/*
* Delete NSEC3 records for now non active nodes.
/*
* Delete the old previous NSEC3.
*/
- CHECK(delete(db, version, prev, nsec3param, diff));
+ CHECK(delnsec3(db, version, prev, nsec3param, diff));
/*
* Fixup the previous NSEC3.
/*
* Delete the old NSEC3 and record the change.
*/
- CHECK(delete(db, version, hashname, nsec3param, diff));
+ CHECK(delnsec3(db, version, hashname, nsec3param, diff));
} while (1);
success:
* Caller must hold a write lock on rwlock.
*/
static isc_result_t
-delete(dns_ntatable_t *ntatable, const dns_name_t *name) {
+deletenode(dns_ntatable_t *ntatable, const dns_name_t *name) {
isc_result_t result;
dns_rbtnode_t *node = NULL;
isc_result_t result;
RWLOCK(&ntatable->rwlock, isc_rwlocktype_write);
- result = delete(ntatable, name);
+ result = deletenode(ntatable, name);
RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_write);
return (result);
isc_timer_detach(&nta->timer);
}
- result = delete(ntatable, foundname);
+ result = deletenode(ntatable, foundname);
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSSEC,
DNS_LOGMODULE_NTA, ISC_LOG_INFO,
unsigned char newbuf[DNS_NSEC3PARAM_BUFFERSIZE];
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdata_nsec3param_t nsec3param;
- isc_boolean_t delete, init, nonsec;
+ isc_boolean_t del, init, nonsec;
isc_buffer_t b;
if (!dns_nsec3param_fromprivate(private, &rdata, nsec3buf,
CHECK(dns_rdata_tostruct(&rdata, &nsec3param, NULL));
- delete = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_REMOVE) != 0);
+ del = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_REMOVE) != 0);
init = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_INITIAL) != 0);
nonsec = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_NONSEC) != 0);
if (init)
isc_buffer_putstr(buf, "Pending NSEC3 chain ");
- else if (delete)
+ else if (del)
isc_buffer_putstr(buf, "Removing NSEC3 chain ");
else
isc_buffer_putstr(buf, "Creating NSEC3 chain ");
CHECK(dns_rdata_totext(&rdata, NULL, buf));
- if (delete && !nonsec)
+ if (del && !nonsec)
isc_buffer_putstr(buf, " / creating NSEC chain");
} else if (private->length == 5) {
unsigned char alg = private->data[0];
dns_keytag_t keyid = (private->data[2] | private->data[1] << 8);
char keybuf[BUFSIZ], algbuf[DNS_SECALG_FORMATSIZE];
- isc_boolean_t delete = ISC_TF(private->data[3] != 0);
+ isc_boolean_t del = ISC_TF(private->data[3] != 0);
isc_boolean_t complete = ISC_TF(private->data[4] != 0);
- if (delete && complete)
+ if (del && complete)
isc_buffer_putstr(buf, "Done removing signatures for ");
- else if (delete)
+ else if (del)
isc_buffer_putstr(buf, "Removing signatures for ");
else if (complete)
isc_buffer_putstr(buf, "Done signing with ");
dns_rbtnode_t **rootp);
static void
-deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp);
+deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp);
static isc_result_t
treefix(dns_rbt_t *rbt, void *base, size_t size,
* true red/black tree on a single level.
*/
static void
-deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
+deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp) {
dns_rbtnode_t *child, *sibling, *parent;
dns_rbtnode_t *successor;
- REQUIRE(delete != NULL);
+ REQUIRE(item != NULL);
/*
* Verify that the parent history is (apparently) correct.
*/
- INSIST((IS_ROOT(delete) && *rootp == delete) ||
- (! IS_ROOT(delete) &&
- (LEFT(PARENT(delete)) == delete ||
- RIGHT(PARENT(delete)) == delete)));
+ INSIST((IS_ROOT(item) && *rootp == item) ||
+ (! IS_ROOT(item) &&
+ (LEFT(PARENT(item)) == item ||
+ RIGHT(PARENT(item)) == item)));
child = NULL;
- if (LEFT(delete) == NULL) {
- if (RIGHT(delete) == NULL) {
- if (IS_ROOT(delete)) {
+ if (LEFT(item) == NULL) {
+ if (RIGHT(item) == NULL) {
+ if (IS_ROOT(item)) {
/*
* This is the only item in the tree.
*/
/*
* This node has one child, on the right.
*/
- child = RIGHT(delete);
+ child = RIGHT(item);
- } else if (RIGHT(delete) == NULL)
+ } else if (RIGHT(item) == NULL)
/*
* This node has one child, on the left.
*/
- child = LEFT(delete);
+ child = LEFT(item);
else {
dns_rbtnode_t holder, *tmp = &holder;
* move it to this location, then do the deletion at the
* old site of the successor.
*/
- successor = RIGHT(delete);
+ successor = RIGHT(item);
while (LEFT(successor) != NULL)
successor = LEFT(successor);
*/
memmove(tmp, successor, sizeof(dns_rbtnode_t));
- if (IS_ROOT(delete)) {
+ if (IS_ROOT(item)) {
*rootp = successor;
successor->is_root = ISC_TRUE;
- delete->is_root = ISC_FALSE;
+ item->is_root = ISC_FALSE;
} else
- if (LEFT(PARENT(delete)) == delete)
- LEFT(PARENT(delete)) = successor;
+ if (LEFT(PARENT(item)) == item)
+ LEFT(PARENT(item)) = successor;
else
- RIGHT(PARENT(delete)) = successor;
+ RIGHT(PARENT(item)) = successor;
- PARENT(successor) = PARENT(delete);
- LEFT(successor) = LEFT(delete);
- RIGHT(successor) = RIGHT(delete);
- COLOR(successor) = COLOR(delete);
+ PARENT(successor) = PARENT(item);
+ LEFT(successor) = LEFT(item);
+ RIGHT(successor) = RIGHT(item);
+ COLOR(successor) = COLOR(item);
if (LEFT(successor) != NULL)
PARENT(LEFT(successor)) = successor;
* successor's previous tree location. PARENT(tmp)
* is the successor's original parent.
*/
- INSIST(! IS_ROOT(delete));
+ INSIST(! IS_ROOT(item));
- if (PARENT(tmp) == delete) {
+ if (PARENT(tmp) == item) {
/*
* Node being deleted was successor's parent.
*/
- RIGHT(successor) = delete;
- PARENT(delete) = successor;
+ RIGHT(successor) = item;
+ PARENT(item) = successor;
} else {
- LEFT(PARENT(tmp)) = delete;
- PARENT(delete) = PARENT(tmp);
+ LEFT(PARENT(tmp)) = item;
+ PARENT(item) = PARENT(tmp);
}
/*
* Original location of successor node has no left.
*/
- LEFT(delete) = NULL;
- RIGHT(delete) = RIGHT(tmp);
- COLOR(delete) = COLOR(tmp);
+ LEFT(item) = NULL;
+ RIGHT(item) = RIGHT(tmp);
+ COLOR(item) = COLOR(tmp);
}
/*
* Remove the node by removing the links from its parent.
*/
- if (! IS_ROOT(delete)) {
- if (LEFT(PARENT(delete)) == delete)
- LEFT(PARENT(delete)) = child;
+ if (! IS_ROOT(item)) {
+ if (LEFT(PARENT(item)) == item)
+ LEFT(PARENT(item)) = child;
else
- RIGHT(PARENT(delete)) = child;
+ RIGHT(PARENT(item)) = child;
if (child != NULL)
- PARENT(child) = PARENT(delete);
+ PARENT(child) = PARENT(item);
} else {
/*
*/
*rootp = child;
child->is_root = 1;
- PARENT(child) = PARENT(delete);
+ PARENT(child) = PARENT(item);
}
/*
* Fix color violations.
*/
- if (IS_BLACK(delete)) {
- parent = PARENT(delete);
+ if (IS_BLACK(item)) {
+ parent = PARENT(item);
while (child != *rootp && IS_BLACK(child)) {
INSIST(child == NULL || ! IS_ROOT(child));
dns_rbtnodechain_t *current;
dns_rbtnode_t *node;
dns_rbtnode_t *deletions[DELETION_BATCH_MAX];
- int delete;
+ int delcnt;
isc_boolean_t nsec3only;
isc_boolean_t nonsec3;
} rbtdb_dbiterator_t;
unsigned int interval;
isc_uint64_t usecs;
isc_time_t end;
- unsigned int new;
+ unsigned int nodes;
if (pps < 100)
pps = 100;
old = 1000;
return (old);
}
- new = old * interval;
- new /= (unsigned int)usecs;
- if (new == 0)
- new = 1;
- else if (new > 1000)
- new = 1000;
+ nodes = old * interval;
+ nodes /= (unsigned int)usecs;
+ if (nodes == 0)
+ nodes = 1;
+ else if (nodes > 1000)
+ nodes = 1000;
/* Smooth */
- new = (new + old * 3) / 4;
+ nodes = (nodes + old * 3) / 4;
- if (new != old)
+ if (nodes != old)
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG(1),
- "adjust_quantum: old=%d, new=%d", old, new);
+ "adjust_quantum: old=%d, new=%d", old, nodes);
- return (new);
+ return (nodes);
}
static void
* Update the copied values of 'next' and 'node' if they are relative.
*/
static void
-update_newheader(rdatasetheader_t *new, rdatasetheader_t *old) {
+update_newheader(rdatasetheader_t *newh, rdatasetheader_t *old) {
char *p;
if (old->next_is_relative) {
p = (char *) old;
p += (uintptr_t)old->next;
- new->next = (rdatasetheader_t *)p;
+ newh->next = (rdatasetheader_t *)p;
}
if (old->node_is_relative) {
p = (char *) old;
p += (uintptr_t)old->node;
- new->node = (dns_rbtnode_t *)p;
+ newh->node = (dns_rbtnode_t *)p;
}
if (CASESET(old)) {
isc_uint16_t attr;
- memmove(new->upper, old->upper, sizeof(old->upper));
+ memmove(newh->upper, old->upper, sizeof(old->upper));
attr = old->attributes & (RDATASET_ATTR_CASESET |
RDATASET_ATTR_CASEFULLYLOWER);
- new->attributes |= attr;
+ newh->attributes |= attr;
}
}
dns_fixedname_init(&rbtdbiter->name);
dns_fixedname_init(&rbtdbiter->origin);
rbtdbiter->node = NULL;
- rbtdbiter->delete = 0;
+ rbtdbiter->delcnt = 0;
rbtdbiter->nsec3only = ISC_TF((options & DNS_DB_NSEC3ONLY) != 0);
rbtdbiter->nonsec3 = ISC_TF((options & DNS_DB_NONSEC3) != 0);
memset(rbtdbiter->deletions, 0, sizeof(rbtdbiter->deletions));
nodelock_t *lock;
int i;
- if (rbtdbiter->delete != 0) {
+ if (rbtdbiter->delcnt != 0) {
/*
* Note that "%d node of %d in tree" can report things like
* "flush_deletions: 59 nodes of 41 in tree". This means
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG(1),
"flush_deletions: %d nodes of %d in tree",
- rbtdbiter->delete,
+ rbtdbiter->delcnt,
dns_rbt_nodecount(rbtdb->tree));
if (rbtdbiter->tree_locked == isc_rwlocktype_read) {
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
rbtdbiter->tree_locked = isc_rwlocktype_write;
- for (i = 0; i < rbtdbiter->delete; i++) {
+ for (i = 0; i < rbtdbiter->delcnt; i++) {
node = rbtdbiter->deletions[i];
lock = &rbtdb->node_locks[node->locknum].lock;
NODE_UNLOCK(lock, isc_rwlocktype_read);
}
- rbtdbiter->delete = 0;
+ rbtdbiter->delcnt = 0;
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
if (was_read_locked) {
* to expire the current node. The current node can't
* fully deleted while the iteration cursor is still on it.
*/
- if (rbtdbiter->delete == DELETION_BATCH_MAX)
+ if (rbtdbiter->delcnt == DELETION_BATCH_MAX)
flush_deletions(rbtdbiter);
expire_result = expirenode(iterator->db, *nodep, 0);
if (expire_result == ISC_R_SUCCESS && node->down == NULL) {
unsigned int refs;
- rbtdbiter->deletions[rbtdbiter->delete++] = node;
+ rbtdbiter->deletions[rbtdbiter->delcnt++] = node;
NODE_STRONGLOCK(&rbtdb->node_locks[node->locknum].lock);
dns_rbtnode_refincrement(node, &refs);
INSIST(refs != 0);
char buf[sizeof("64000")];
unsigned int flags;
unsigned char algorithm;
- unsigned long refresh, add, delete;
+ unsigned long refresh, add, deltime;
char algbuf[DNS_NAME_FORMATSIZE];
const char *keyinfo;
RETERR(str_totext(" ", target));
/* remove hold-down */
- delete = uint32_fromregion(&sr);
+ deltime = uint32_fromregion(&sr);
isc_region_consume(&sr, 4);
- RETERR(dns_time32_totext(delete, target));
+ RETERR(dns_time32_totext(deltime, target));
RETERR(str_totext(" ", target));
/* flags */
RETERR(str_totext(abuf, target));
}
- if (delete != 0U) {
+ if (deltime != 0U) {
RETERR(str_totext(tctx->linebreak, target));
RETERR(str_totext("; removal pending: ",
target));
- isc_time_set(&t, delete, 0);
+ isc_time_set(&t, deltime, 0);
isc_time_formathttptimestamp(&t, dbuf,
sizeof(dbuf));
RETERR(str_totext(dbuf, target));
unsigned int headlen;
isc_boolean_t question = ISC_FALSE;
isc_boolean_t shuffle = ISC_FALSE, sort = ISC_FALSE;
- dns_rdata_t orig_fixed[MAX_SHUFFLE];
- dns_rdata_t *orig = orig_fixed;
- struct towire_sort new_fixed[MAX_SHUFFLE];
- struct towire_sort *new = new_fixed;
+ dns_rdata_t in_fixed[MAX_SHUFFLE];
+ dns_rdata_t *in = in_fixed;
+ struct towire_sort out_fixed[MAX_SHUFFLE];
+ struct towire_sort *out = out_fixed;
dns_fixedname_t fixed;
dns_name_t *name;
}
if ((shuffle || sort) && count > MAX_SHUFFLE) {
- orig = isc_mem_get(cctx->mctx, count * sizeof(*orig));
- new = isc_mem_get(cctx->mctx, count * sizeof(*new));
- if (orig == NULL || new == NULL)
+ in = isc_mem_get(cctx->mctx, count * sizeof(*in));
+ out = isc_mem_get(cctx->mctx, count * sizeof(*out));
+ if (in == NULL || out == NULL)
shuffle = sort = ISC_FALSE;
}
i = 0;
do {
INSIST(i < count);
- dns_rdata_init(&orig[i]);
- dns_rdataset_current(rdataset, &orig[i]);
+ dns_rdata_init(&in[i]);
+ dns_rdataset_current(rdataset, &in[i]);
i++;
result = dns_rdataset_next(rdataset);
} while (result == ISC_R_SUCCESS);
isc_random_get(&val);
choice = i + (val % (count - i));
- rdata = orig[i];
- orig[i] = orig[choice];
- orig[choice] = rdata;
+ rdata = in[i];
+ in[i] = in[choice];
+ in[choice] = rdata;
if (order != NULL)
- new[i].key = (*order)(&orig[i],
+ out[i].key = (*order)(&in[i],
order_arg);
else
- new[i].key = 0; /* Unused */
- new[i].rdata = &orig[i];
+ out[i].key = 0; /* Unused */
+ out[i].rdata = &in[i];
}
} else if (WANT_CYCLIC(rdataset)) {
/*
j = val % count;
for (i = 0; i < count; i++) {
if (order != NULL)
- new[i].key = (*order)(&orig[j],
+ out[i].key = (*order)(&in[j],
order_arg);
else
- new[i].key = 0; /* Unused */
- new[i].rdata = &orig[j];
+ out[i].key = 0; /* Unused */
+ out[i].rdata = &in[j];
j++;
if (j == count)
j = 0; /* Wrap around. */
} else if (sort) {
for (i = 0; i < count; i++) {
if (order != NULL)
- new[i].key = (*order)(&orig[i], order_arg);
+ out[i].key = (*order)(&in[i], order_arg);
else
- new[i].key = 0; /* Unused */
- new[i].rdata = &orig[i];
+ out[i].key = 0; /* Unused */
+ out[i].rdata = &in[i];
}
}
* Sortlist order.
*/
if (sort) {
- qsort(new, count, sizeof(new[0]), towire_compare);
+ qsort(out, count, sizeof(out[0]), towire_compare);
}
savedbuffer = *target;
* Copy out the rdata
*/
if (shuffle || sort) {
- rdata = *(new[i].rdata);
+ rdata = *(out[i].rdata);
} else {
dns_rdata_reset(&rdata);
dns_rdataset_current(rdataset, &rdata);
*target = savedbuffer;
cleanup:
- if (new != NULL && new != new_fixed)
- isc_mem_put(cctx->mctx, new, count * sizeof(*new));
- if (orig != NULL && orig != orig_fixed)
- isc_mem_put(cctx->mctx, orig, count * sizeof(*orig));
+ if (out != NULL && out != out_fixed)
+ isc_mem_put(cctx->mctx, out, count * sizeof(*out));
+ if (in != NULL && in != in_fixed)
+ isc_mem_put(cctx->mctx, in, count * sizeof(*in));
return (result);
}
unsigned int alg)
{
unsigned int len, mask;
- unsigned char *new;
+ unsigned char *tmp;
unsigned char *algorithms;
isc_result_t result;
dns_rbtnode_t *node = NULL;
* bitfield and copy the old (smaller) bitfield
* into it if one exists.
*/
- new = isc_mem_get(resolver->mctx, len);
- if (new == NULL) {
+ tmp = isc_mem_get(resolver->mctx, len);
+ if (tmp == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
- memset(new, 0, len);
+ memset(tmp, 0, len);
if (algorithms != NULL)
- memmove(new, algorithms, *algorithms);
- new[len-1] |= mask;
- /* new[0] should contain the length of new. */
- *new = len;
- node->data = new;
+ memmove(tmp, algorithms, *algorithms);
+ tmp[len-1] |= mask;
+ /* 'tmp[0]' should contain the length of 'tmp'. */
+ *tmp = len;
+ node->data = tmp;
/* Free the older bitfield. */
if (algorithms != NULL)
isc_mem_put(resolver->mctx, algorithms,
unsigned int digest_type)
{
unsigned int len, mask;
- unsigned char *new;
+ unsigned char *tmp;
unsigned char *digests;
isc_result_t result;
dns_rbtnode_t *node = NULL;
* bitfield and copy the old (smaller) bitfield
* into it if one exists.
*/
- new = isc_mem_get(resolver->mctx, len);
- if (new == NULL) {
+ tmp = isc_mem_get(resolver->mctx, len);
+ if (tmp == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
- memset(new, 0, len);
+ memset(tmp, 0, len);
if (digests != NULL)
- memmove(new, digests, *digests);
- new[len-1] |= mask;
- /* new[0] should contain the length of new. */
- *new = len;
- node->data = new;
+ memmove(tmp, digests, *digests);
+ tmp[len-1] |= mask;
+ /* tmp[0] should contain the length of 'tmp'. */
+ *tmp = len;
+ node->data = tmp;
/* Free the older bitfield. */
if (digests != NULL)
isc_mem_put(resolver->mctx, digests,
const dns_rpz_cidr_key_t *ip, dns_rpz_prefix_t prefix,
const dns_rpz_cidr_node_t *child)
{
- dns_rpz_cidr_node_t *new;
+ dns_rpz_cidr_node_t *node;
int i, words, wlen;
- new = isc_mem_get(rpzs->mctx, sizeof(*new));
- if (new == NULL)
+ node = isc_mem_get(rpzs->mctx, sizeof(*node));
+ if (node == NULL)
return (NULL);
- memset(new, 0, sizeof(*new));
+ memset(node, 0, sizeof(*node));
if (child != NULL)
- new->sum = child->sum;
+ node->sum = child->sum;
- new->prefix = prefix;
+ node->prefix = prefix;
words = prefix / DNS_RPZ_CIDR_WORD_BITS;
wlen = prefix % DNS_RPZ_CIDR_WORD_BITS;
i = 0;
while (i < words) {
- new->ip.w[i] = ip->w[i];
+ node->ip.w[i] = ip->w[i];
++i;
}
if (wlen != 0) {
- new->ip.w[i] = ip->w[i] & DNS_RPZ_WORD_MASK(wlen);
+ node->ip.w[i] = ip->w[i] & DNS_RPZ_WORD_MASK(wlen);
++i;
}
while (i < DNS_RPZ_CIDR_WORDS)
- new->ip.w[i++] = 0;
+ node->ip.w[i++] = 0;
- return (new);
+ return (node);
}
static void
}
static isc_result_t
-expand_entries(dns_rrl_t *rrl, int new) {
+expand_entries(dns_rrl_t *rrl, int newsize) {
unsigned int bsize;
dns_rrl_block_t *b;
dns_rrl_entry_t *e;
double rate;
int i;
- if (rrl->num_entries + new >= rrl->max_entries &&
+ if (rrl->num_entries + newsize >= rrl->max_entries &&
rrl->max_entries != 0)
{
- new = rrl->max_entries - rrl->num_entries;
- if (new <= 0)
+ newsize = rrl->max_entries - rrl->num_entries;
+ if (newsize <= 0)
return (ISC_R_SUCCESS);
}
DNS_LOGMODULE_REQUEST, DNS_RRL_LOG_DROP,
"increase from %d to %d RRL entries with"
" %d bins; average search length %.1f",
- rrl->num_entries, rrl->num_entries+new,
+ rrl->num_entries, rrl->num_entries+newsize,
rrl->hash->length, rate);
}
- bsize = sizeof(dns_rrl_block_t) + (new-1)*sizeof(dns_rrl_entry_t);
+ bsize = sizeof(dns_rrl_block_t) + (newsize-1)*sizeof(dns_rrl_entry_t);
b = isc_mem_get(rrl->mctx, bsize);
if (b == NULL) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL,
b->size = bsize;
e = b->entries;
- for (i = 0; i < new; ++i, ++e) {
+ for (i = 0; i < newsize; ++i, ++e) {
ISC_LINK_INIT(e, hlink);
ISC_LIST_INITANDAPPEND(rrl->lru, e, lru);
}
- rrl->num_entries += new;
+ rrl->num_entries += newsize;
ISC_LIST_INITANDAPPEND(rrl->blocks, b, link);
return (ISC_R_SUCCESS);
#define TEST_ORIGIN "test"
static void
-test_create(const atf_tc_t *tc, dns_db_t **old, dns_db_t **new) {
+test_create(const atf_tc_t *tc, dns_db_t **old, dns_db_t **newdb) {
isc_result_t result;
result = dns_test_loaddb(old, dns_dbtype_zone, TEST_ORIGIN,
atf_tc_get_md_var(tc, "X-old"));
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- result = dns_test_loaddb(new, dns_dbtype_zone, TEST_ORIGIN,
+ result = dns_test_loaddb(newdb, dns_dbtype_zone, TEST_ORIGIN,
atf_tc_get_md_var(tc, "X-new"));
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
}
atf_tc_set_md_var(tc, "X-old", "testdata/diff/zone1.data");
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone1.data"); }
ATF_TC_BODY(diffx_same, tc) {
- dns_db_t *new = NULL, *old = NULL;
+ dns_db_t *newdb = NULL, *olddb = NULL;
isc_result_t result;
dns_diff_t diff;
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- test_create(tc, &old, &new);
+ test_create(tc, &olddb, &newdb);
dns_diff_init(mctx, &diff);
- result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
+ result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_TRUE);
dns_diff_clear(&diff);
- dns_db_detach(&new);
- dns_db_detach(&old);
+ dns_db_detach(&newdb);
+ dns_db_detach(&olddb);
dns_test_end();
}
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone2.data");
}
ATF_TC_BODY(diffx_add, tc) {
- dns_db_t *new = NULL, *old = NULL;
+ dns_db_t *newdb = NULL, *olddb = NULL;
dns_difftuple_t *tuple;
isc_result_t result;
dns_diff_t diff;
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- test_create(tc, &old, &new);
+ test_create(tc, &olddb, &newdb);
dns_diff_init(mctx, &diff);
- result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
+ result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE);
ATF_REQUIRE_EQ(count, 1);
dns_diff_clear(&diff);
- dns_db_detach(&new);
- dns_db_detach(&old);
+ dns_db_detach(&newdb);
+ dns_db_detach(&olddb);
dns_test_end();
}
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone3.data");
}
ATF_TC_BODY(diffx_remove, tc) {
- dns_db_t *new = NULL, *old = NULL;
+ dns_db_t *newdb = NULL, *olddb = NULL;
dns_difftuple_t *tuple;
isc_result_t result;
dns_diff_t diff;
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- test_create(tc, &old, &new);
+ test_create(tc, &olddb, &newdb);
dns_diff_init(mctx, &diff);
- result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
+ result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE);
ATF_REQUIRE_EQ(count, 1);
dns_diff_clear(&diff);
- dns_db_detach(&new);
- dns_db_detach(&old);
+ dns_db_detach(&newdb);
+ dns_db_detach(&olddb);
dns_test_end();
}
}
ATF_TC_BODY(increment, tc) {
isc_uint32_t old = 50;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_increment);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK_MSG(new != 0, "new (%d) should not equal 0", new);
- ATF_REQUIRE_EQ(new, 51);
+ serial = dns_update_soaserial(old, dns_updatemethod_increment);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK_MSG(serial != 0, "serial (%d) should not equal 0", serial);
+ ATF_REQUIRE_EQ(serial, 51);
dns_test_end();
}
}
ATF_TC_BODY(increment_past_zero, tc) {
isc_uint32_t old = 0xffffffffu;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_increment);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, 1u);
+ serial = dns_update_soaserial(old, dns_updatemethod_increment);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, 1u);
dns_test_end();
}
}
ATF_TC_BODY(past_to_unix, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_unixtime);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, mystdtime);
+ serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, mystdtime);
dns_test_end();
}
}
ATF_TC_BODY(now_to_unix, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_unixtime);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, old + 1);
+ serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
}
ATF_TC_BODY(future_to_unix, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_unixtime);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, old + 1);
+ serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
}
ATF_TC_BODY(undefined_plus1_to_unix, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_unixtime);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, mystdtime);
+ serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, mystdtime);
dns_test_end();
}
}
ATF_TC_BODY(undefined_minus1_to_unix, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_unixtime);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, old + 1);
+ serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
}
ATF_TC_BODY(undefined_to_unix, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_unixtime);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, old + 1);
+ serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
}
ATF_TC_BODY(unixtime_zero, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_unixtime);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, old + 1);
+ serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, old + 1);
dns_test_end();
}
atf_tc_set_md_var(tc, "descr", "past to date");
}
ATF_TC_BODY(past_to_date, tc) {
- isc_uint32_t old, new;
+ isc_uint32_t old, serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_date);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, 2014040100);
+ serial = dns_update_soaserial(old, dns_updatemethod_date);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, 2014040100);
dns_test_end();
}
}
ATF_TC_BODY(now_to_date, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_date);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, 2014040101);
+ serial = dns_update_soaserial(old, dns_updatemethod_date);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, 2014040101);
dns_test_end();
}
}
ATF_TC_BODY(future_to_date, tc) {
isc_uint32_t old;
- isc_uint32_t new;
+ isc_uint32_t serial;
isc_result_t result;
UNUSED(tc);
result = dns_test_begin(NULL, ISC_FALSE);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
- new = dns_update_soaserial(old, dns_updatemethod_date);
- ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
- ATF_CHECK(new != 0);
- ATF_REQUIRE_EQ(new, 2014040101);
+ serial = dns_update_soaserial(old, dns_updatemethod_date);
+ ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
+ ATF_CHECK(serial != 0);
+ ATF_REQUIRE_EQ(serial, 2014040101);
dns_test_end();
}
isc_result_t
dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) {
isc_result_t result;
- dns_name_t *new;
+ dns_name_t *item;
isc_uint32_t hash;
REQUIRE(DNS_VIEW_VALID(view));
ISC_LIST_INIT(view->delonly[hash]);
}
hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH;
- new = ISC_LIST_HEAD(view->delonly[hash]);
- while (new != NULL && !dns_name_equal(new, name))
- new = ISC_LIST_NEXT(new, link);
- if (new != NULL)
+ item = ISC_LIST_HEAD(view->delonly[hash]);
+ while (item != NULL && !dns_name_equal(item, name))
+ item = ISC_LIST_NEXT(item, link);
+ if (item != NULL)
return (ISC_R_SUCCESS);
- new = isc_mem_get(view->mctx, sizeof(*new));
- if (new == NULL)
+ item = isc_mem_get(view->mctx, sizeof(*item));
+ if (item == NULL)
return (ISC_R_NOMEMORY);
- dns_name_init(new, NULL);
- result = dns_name_dup(name, view->mctx, new);
+ dns_name_init(item, NULL);
+ result = dns_name_dup(name, view->mctx, item);
if (result == ISC_R_SUCCESS)
- ISC_LIST_APPEND(view->delonly[hash], new, link);
+ ISC_LIST_APPEND(view->delonly[hash], item, link);
else
- isc_mem_put(view->mctx, new, sizeof(*new));
+ isc_mem_put(view->mctx, item, sizeof(*item));
return (result);
}
isc_result_t
dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) {
isc_result_t result;
- dns_name_t *new;
+ dns_name_t *item;
isc_uint32_t hash;
REQUIRE(DNS_VIEW_VALID(view));
ISC_LIST_INIT(view->rootexclude[hash]);
}
hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH;
- new = ISC_LIST_HEAD(view->rootexclude[hash]);
- while (new != NULL && !dns_name_equal(new, name))
- new = ISC_LIST_NEXT(new, link);
- if (new != NULL)
+ item = ISC_LIST_HEAD(view->rootexclude[hash]);
+ while (item != NULL && !dns_name_equal(item, name))
+ item = ISC_LIST_NEXT(item, link);
+ if (item != NULL)
return (ISC_R_SUCCESS);
- new = isc_mem_get(view->mctx, sizeof(*new));
- if (new == NULL)
+ item = isc_mem_get(view->mctx, sizeof(*item));
+ if (item == NULL)
return (ISC_R_NOMEMORY);
- dns_name_init(new, NULL);
- result = dns_name_dup(name, view->mctx, new);
+ dns_name_init(item, NULL);
+ result = dns_name_dup(name, view->mctx, item);
if (result == ISC_R_SUCCESS)
- ISC_LIST_APPEND(view->rootexclude[hash], new, link);
+ ISC_LIST_APPEND(view->rootexclude[hash], item, link);
else
- isc_mem_put(view->mctx, new, sizeof(*new));
+ isc_mem_put(view->mctx, item, sizeof(*item));
return (result);
}
isc_boolean_t
dns_view_isdelegationonly(dns_view_t *view, const dns_name_t *name) {
- dns_name_t *new;
+ dns_name_t *item;
isc_uint32_t hash;
REQUIRE(DNS_VIEW_VALID(view));
if (view->rootdelonly && dns_name_countlabels(name) <= 2) {
if (view->rootexclude == NULL)
return (ISC_TRUE);
- new = ISC_LIST_HEAD(view->rootexclude[hash]);
- while (new != NULL && !dns_name_equal(new, name))
- new = ISC_LIST_NEXT(new, link);
- if (new == NULL)
+ item = ISC_LIST_HEAD(view->rootexclude[hash]);
+ while (item != NULL && !dns_name_equal(item, name))
+ item = ISC_LIST_NEXT(item, link);
+ if (item == NULL)
return (ISC_TRUE);
}
if (view->delonly == NULL)
return (ISC_FALSE);
- new = ISC_LIST_HEAD(view->delonly[hash]);
- while (new != NULL && !dns_name_equal(new, name))
- new = ISC_LIST_NEXT(new, link);
- if (new == NULL)
+ item = ISC_LIST_HEAD(view->delonly[hash]);
+ while (item != NULL && !dns_name_equal(item, name))
+ item = ISC_LIST_NEXT(item, link);
+ if (item == NULL)
return (ISC_FALSE);
return (ISC_TRUE);
}
dns_dbiterator_t *dbiterator;
dns_secalg_t algorithm;
isc_uint16_t keyid;
- isc_boolean_t delete;
+ isc_boolean_t deleteit;
isc_boolean_t done;
ISC_LINK(dns_signing_t) link;
};
static void zone_notify(dns_zone_t *zone, isc_time_t *now);
static void dump_done(void *arg, isc_result_t result);
static isc_result_t zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
- isc_uint16_t keyid, isc_boolean_t delete);
+ isc_uint16_t keyid, isc_boolean_t deleteit);
static isc_result_t delete_nsec(dns_db_t *db, dns_dbversion_t *ver,
dns_dbnode_t *node, dns_name_t *name,
dns_diff_t *diff);
isc_result_t
dns_zone_setdbtype(dns_zone_t *zone,
- unsigned int dbargc, const char * const *dbargv) {
+ unsigned int dbargc, const char * const *dbargv)
+{
isc_result_t result = ISC_R_SUCCESS;
- char **new = NULL;
+ char **argv = NULL;
unsigned int i;
REQUIRE(DNS_ZONE_VALID(zone));
LOCK_ZONE(zone);
/* Set up a new database argument list. */
- new = isc_mem_get(zone->mctx, dbargc * sizeof(*new));
- if (new == NULL)
+ argv = isc_mem_get(zone->mctx, dbargc * sizeof(*argv));
+ if (argv == NULL)
goto nomem;
for (i = 0; i < dbargc; i++)
- new[i] = NULL;
+ argv[i] = NULL;
for (i = 0; i < dbargc; i++) {
- new[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
- if (new[i] == NULL)
+ argv[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
+ if (argv[i] == NULL)
goto nomem;
}
zone_freedbargs(zone);
zone->db_argc = dbargc;
- zone->db_argv = new;
+ zone->db_argv = argv;
result = ISC_R_SUCCESS;
goto unlock;
nomem:
- if (new != NULL) {
+ if (argv != NULL) {
for (i = 0; i < dbargc; i++)
- if (new[i] != NULL)
- isc_mem_free(zone->mctx, new[i]);
- isc_mem_put(zone->mctx, new, dbargc * sizeof(*new));
+ if (argv[i] != NULL)
+ isc_mem_free(zone->mctx, argv[i]);
+ isc_mem_put(zone->mctx, argv, dbargc * sizeof(*argv));
}
result = ISC_R_NOMEMORY;
}
static isc_boolean_t
-same_addrs(const isc_sockaddr_t *old, const isc_sockaddr_t *new,
- isc_uint32_t count)
+same_addrs(isc_sockaddr_t const *oldlist, isc_sockaddr_t const *newlist,
+ isc_uint32_t count)
{
unsigned int i;
for (i = 0; i < count; i++)
- if (!isc_sockaddr_equal(&old[i], &new[i]))
+ if (!isc_sockaddr_equal(&oldlist[i], &newlist[i]))
return (ISC_FALSE);
return (ISC_TRUE);
}
static isc_boolean_t
-same_keynames(dns_name_t **old, dns_name_t **new, isc_uint32_t count) {
+same_keynames(dns_name_t * const *oldlist, dns_name_t * const *newlist,
+ isc_uint32_t count)
+{
unsigned int i;
- if (old == NULL && new == NULL)
+ if (oldlist == NULL && newlist == NULL)
return (ISC_TRUE);
- if (old == NULL || new == NULL)
+ if (oldlist == NULL || newlist == NULL)
return (ISC_FALSE);
for (i = 0; i < count; i++) {
- if (old[i] == NULL && new[i] == NULL)
+ if (oldlist[i] == NULL && newlist[i] == NULL)
continue;
- if (old[i] == NULL || new[i] == NULL ||
- !dns_name_equal(old[i], new[i]))
+ if (oldlist[i] == NULL || newlist[i] == NULL ||
+ !dns_name_equal(oldlist[i], newlist[i]))
return (ISC_FALSE);
}
return (ISC_TRUE);
continue;
}
/*
- * We have a match. If we were signing (!signing->delete)
+ * We have a match. If we were signing (!signing->deleteit)
* and we already have a record indicating that we have
* finished signing (rdata.data[4] != 0) then keep it.
* Otherwise it needs to be deleted as we have removed all
- * the signatures (signing->delete), so any record indicating
+ * the signatures (signing->deleteit), so any record indicating
* completion is now out of date, or we have finished signing
* with the new record so we no longer need to remember that
* we need to sign the zone with the matching key across a
* nameserver re-start.
*/
- if (!signing->delete && rdata.data[4] != 0) {
+ if (!signing->deleteit && rdata.data[4] != 0) {
seen_done = ISC_TRUE;
have_rr = ISC_TRUE;
} else
}
if (result == ISC_R_NOMORE)
result = ISC_R_SUCCESS;
- if (!signing->delete && !seen_done) {
+ if (!signing->deleteit && !seen_done) {
/*
* If we were signing then we need to indicate that we have
* finished signing the zone with this key. If it is already
delegation = ISC_FALSE;
- if (first && signing->delete) {
+ if (first && signing->deleteit) {
/*
* Remove the key we are deleting from consideration.
*/
dns_dbiterator_current(signing->dbiterator, &node, name);
- if (signing->delete) {
+ if (signing->deleteit) {
dns_dbiterator_pause(signing->dbiterator);
CHECK(del_sig(db, version, name, node, nkeys,
signing->algorithm, signing->keyid,
/*
* When adding look for the specific key.
*/
- if (!signing->delete &&
+ if (!signing->deleteit &&
(dst_key_alg(zone_keys[i]) != signing->algorithm ||
dst_key_id(zone_keys[i]) != signing->keyid))
continue;
* When deleting make sure we are properly signed
* with the algorithm that was being removed.
*/
- if (signing->delete &&
+ if (signing->deleteit &&
ALG(zone_keys[i]) != signing->algorithm)
continue;
* If we are adding we are done. Look for other keys
* of the same algorithm if deleting.
*/
- if (!signing->delete)
+ if (!signing->deleteit)
break;
}
dns_adbaddrinfo_t *ai;
isc_sockaddr_t dst;
isc_result_t result;
- dns_notify_t *new = NULL;
+ dns_notify_t *newnotify = NULL;
unsigned int flags;
isc_boolean_t startup;
continue;
if (notify_isself(notify->zone, &dst))
continue;
- new = NULL;
+ newnotify = NULL;
flags = notify->flags & DNS_NOTIFY_NOSOA;
- result = notify_create(notify->mctx, flags, &new);
+ result = notify_create(notify->mctx, flags, &newnotify);
if (result != ISC_R_SUCCESS)
goto cleanup;
- zone_iattach(notify->zone, &new->zone);
- ISC_LIST_APPEND(new->zone->notifies, new, link);
- new->dst = dst;
+ zone_iattach(notify->zone, &newnotify->zone);
+ ISC_LIST_APPEND(newnotify->zone->notifies, newnotify, link);
+ newnotify->dst = dst;
startup = ISC_TF((notify->flags & DNS_NOTIFY_STARTUP) != 0);
- result = notify_send_queue(new, startup);
+ result = notify_send_queue(newnotify, startup);
if (result != ISC_R_SUCCESS)
goto cleanup;
- new = NULL;
+ newnotify = NULL;
}
cleanup:
- if (new != NULL)
- notify_destroy(new, ISC_TRUE);
+ if (newnotify != NULL)
+ notify_destroy(newnotify, ISC_TRUE);
}
void
isc_result_t
dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
- isc_uint16_t keyid, isc_boolean_t delete)
+ isc_uint16_t keyid, isc_boolean_t deleteit)
{
isc_result_t result;
REQUIRE(DNS_ZONE_VALID(zone));
"dns_zone_signwithkey(algorithm=%u, keyid=%u)",
algorithm, keyid);
LOCK_ZONE(zone);
- result = zone_signwithkey(zone, algorithm, keyid, delete);
+ result = zone_signwithkey(zone, algorithm, keyid, deleteit);
UNLOCK_ZONE(zone);
return (result);
static isc_result_t
zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid,
- isc_boolean_t delete)
+ isc_boolean_t deleteit)
{
dns_signing_t *signing;
dns_signing_t *current;
signing->dbiterator = NULL;
signing->algorithm = algorithm;
signing->keyid = keyid;
- signing->delete = delete;
+ signing->deleteit = deleteit;
signing->done = ISC_FALSE;
TIME_NOW(&now);
if (current->db == signing->db &&
current->algorithm == signing->algorithm &&
current->keyid == signing->keyid) {
- if (current->delete != signing->delete)
+ if (current->deleteit != signing->deleteit)
current->done = ISC_TRUE;
else
goto cleanup;
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- unsigned int new = *tp * 10;
+ unsigned int byte = *tp * 10;
- new += (int)(pch - digits);
+ byte += (int)(pch - digits);
if (saw_digit && *tp == 0)
return (0);
- if (new > 255)
+ if (byte > 255)
return (0);
- *tp = new;
+ *tp = byte;
if (!saw_digit) {
if (++octets > 4)
return (0);
static inline isc_result_t
grow_data(isc_lex_t *lex, size_t *remainingp, char **currp, char **prevp) {
- char *new;
+ char *tmp;
- new = isc_mem_get(lex->mctx, lex->max_token * 2 + 1);
- if (new == NULL)
+ tmp = isc_mem_get(lex->mctx, lex->max_token * 2 + 1);
+ if (tmp == NULL)
return (ISC_R_NOMEMORY);
- memmove(new, lex->data, lex->max_token + 1);
- *currp = new + (*currp - lex->data);
+ memmove(tmp, lex->data, lex->max_token + 1);
+ *currp = tmp + (*currp - lex->data);
if (*prevp != NULL)
- *prevp = new + (*prevp - lex->data);
+ *prevp = tmp + (*prevp - lex->data);
isc_mem_put(lex->mctx, lex->data, lex->max_token + 1);
- lex->data = new;
+ lex->data = tmp;
*remainingp += lex->max_token;
lex->max_token *= 2;
return (ISC_R_SUCCESS);
* Check for duplicates.
*/
if (write_once) {
- isc_logmessage_t *message, *new;
+ isc_logmessage_t *message, *next;
isc_time_t oldest;
isc_interval_t interval;
* range.
*/
TIME_NOW(&oldest);
- if (isc_time_subtract(&oldest, &interval, &oldest)
+ if (isc_time_subtract(&oldest, &interval,
+ &oldest)
!= ISC_R_SUCCESS)
/*
* Can't effectively do the checking
*/
message = NULL;
else
- message =ISC_LIST_HEAD(lctx->messages);
+ message = ISC_LIST_HEAD(lctx->messages);
while (message != NULL) {
if (isc_time_compare(&message->time,
* message to spring back into
* existence.
*/
- new = ISC_LIST_NEXT(message,
- link);
+ next = ISC_LIST_NEXT(message,
+ link);
ISC_LIST_UNLINK(lctx->messages,
message, link);
sizeof(*message) + 1 +
strlen(message->text));
- message = new;
+ message = next;
continue;
}
* It wasn't in the duplicate interval,
* so add it to the message list.
*/
- new = isc_mem_get(lctx->mctx,
- sizeof(isc_logmessage_t) +
- strlen(lctx->buffer) + 1);
- if (new != NULL) {
+ message = isc_mem_get(lctx->mctx,
+ sizeof(isc_logmessage_t) +
+ strlen(lctx->buffer) + 1);
+ if (message != NULL) {
/*
* Put the text immediately after
* the struct. The strcpy is safe.
*/
- new->text = (char *)(new + 1);
- strcpy(new->text, lctx->buffer);
+ message->text = (char *)(message + 1);
+ strcpy(message->text, lctx->buffer);
- TIME_NOW(&new->time);
+ TIME_NOW(&message->time);
- ISC_LINK_INIT(new, link);
+ ISC_LINK_INIT(message, link);
ISC_LIST_APPEND(lctx->messages,
- new, link);
+ message, link);
}
}
}
static inline isc_boolean_t
more_basic_blocks(isc__mem_t *ctx) {
- void *new;
+ void *tmp;
unsigned char *curr, *next;
unsigned char *first, *last;
unsigned char **table;
ctx->basic_table_size = table_size;
}
- new = (ctx->memalloc)(ctx->arg, NUM_BASIC_BLOCKS * ctx->mem_target);
- if (new == NULL) {
+ tmp = (ctx->memalloc)(ctx->arg, NUM_BASIC_BLOCKS * ctx->mem_target);
+ if (tmp == NULL) {
ctx->memalloc_failures++;
return (ISC_FALSE);
}
ctx->total += increment;
- ctx->basic_table[ctx->basic_table_count] = new;
+ ctx->basic_table[ctx->basic_table_count] = tmp;
ctx->basic_table_count++;
ctx->malloced += NUM_BASIC_BLOCKS * ctx->mem_target;
if (ctx->malloced > ctx->maxmalloced)
ctx->maxmalloced = ctx->malloced;
- curr = new;
+ curr = tmp;
next = curr + ctx->mem_target;
for (i = 0; i < (NUM_BASIC_BLOCKS - 1); i++) {
((element *)curr)->next = (element *)next;
* array.
*/
((element *)curr)->next = NULL;
- first = new;
+ first = tmp;
last = first + NUM_BASIC_BLOCKS * ctx->mem_target - 1;
if (first < ctx->lowest || ctx->lowest == NULL)
ctx->lowest = first;
if (last > ctx->highest)
ctx->highest = last;
- ctx->basic_blocks = new;
+ ctx->basic_blocks = tmp;
return (ISC_TRUE);
}
more_frags(isc__mem_t *ctx, size_t new_size) {
int i, frags;
size_t total_size;
- void *new;
+ void *tmp;
unsigned char *curr, *next;
/*!
}
total_size = ctx->mem_target;
- new = ctx->basic_blocks;
+ tmp = ctx->basic_blocks;
ctx->basic_blocks = ctx->basic_blocks->next;
frags = (int)(total_size / new_size);
ctx->stats[new_size].blocks++;
* Set up a linked-list of blocks of size
* "new_size".
*/
- curr = new;
+ curr = tmp;
next = curr + new_size;
total_size -= new_size;
for (i = 0; i < (frags - 1); i++) {
* array.
*/
((element *)curr)->next = NULL;
- ctx->freelists[new_size] = new;
+ ctx->freelists[new_size] = tmp;
return (ISC_TRUE);
}
#else
static int
#endif
-isc_atomic_cmpxchg(atomic_p p, int old, int new) {
+isc_atomic_cmpxchg(atomic_p p, int old, int replacement) {
int orig = old;
#ifdef __GNUC__
#else
__isync();
#endif
- if (compare_and_swap(p, &orig, new))
+ if (compare_and_swap(p, &orig, replacement))
orig = old;
#ifdef __GNUC__
*/
if (manager->reserved != 0 && sock->type == isc_sockettype_udp &&
sock->fd >= 0 && sock->fd < manager->reserved) {
- int new, tmp;
- new = fcntl(sock->fd, F_DUPFD, manager->reserved);
+ int newfd, tmp;
+ newfd = fcntl(sock->fd, F_DUPFD, manager->reserved);
tmp = errno;
(void)close(sock->fd);
errno = tmp;
- sock->fd = new;
+ sock->fd = newfd;
err = "isc_socket_create: fcntl/reserved";
} else if (sock->fd >= 0 && sock->fd < 20) {
- int new, tmp;
- new = fcntl(sock->fd, F_DUPFD, 20);
+ int newfd, tmp;
+ newfd = fcntl(sock->fd, F_DUPFD, 20);
tmp = errno;
(void)close(sock->fd);
errno = tmp;
- sock->fd = new;
+ sock->fd = newfd;
err = "isc_socket_create: fcntl";
}
#endif
* Leave a space for stdio to work in.
*/
if (fd >= 0 && fd < 20) {
- int new, tmp;
- new = fcntl(fd, F_DUPFD, 20);
+ int newfd, tmp;
+ newfd = fcntl(fd, F_DUPFD, 20);
tmp = errno;
(void)close(fd);
errno = tmp;
- fd = new;
+ fd = newfd;
err = "accept/fcntl";
}
#endif
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- unsigned int new = *tp * 10;
+ unsigned int byte = *tp * 10;
- new += (unsigned int)(pch - digits);
- if (new > 255)
+ byte += (unsigned int)(pch - digits);
+ if (byte > 255)
return (0);
- *tp = new;
+ *tp = byte;
if (! saw_digit) {
if (++octets > 4)
return (0);
static void
addserver(dns_client_t *client, const char *addrstr, const char *port,
- const char *namespace)
+ const char *name_space)
{
struct addrinfo hints, *res;
int gaierror;
ISC_LIST_INIT(servers);
ISC_LIST_APPEND(servers, &sa, link);
- if (namespace != NULL) {
- namelen = strlen(namespace);
- isc_buffer_constinit(&b, namespace, namelen);
+ if (name_space != NULL) {
+ namelen = strlen(name_space);
+ isc_buffer_constinit(&b, name_space, namelen);
isc_buffer_add(&b, namelen);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);