Compare commits
135
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c3af708ef | ||
|
|
db6e1379ca | ||
|
|
c7b5c0d9ba | ||
|
|
be27968e24 | ||
|
|
e5bda0d2e8 | ||
|
|
19c11103f0 | ||
|
|
1cf25df406 | ||
|
|
b0c1765501 | ||
|
|
1b10390863 | ||
|
|
661b15f25b | ||
|
|
e8dc021560 | ||
|
|
7c806002c3 | ||
|
|
cf367bd64f | ||
|
|
c9e6c59bc2 | ||
|
|
96ff385777 | ||
|
|
36bc9ac28b | ||
|
|
0b517735f2 | ||
|
|
3edde4d190 | ||
|
|
918af04b9d | ||
|
|
8279b866bc | ||
|
|
ac88ecbbaa | ||
|
|
bb1bd0bcac | ||
|
|
d1b608e7a2 | ||
|
|
6d69556eea | ||
|
|
a65d7597a9 | ||
|
|
cc0b84e84b | ||
|
|
55ce821070 | ||
|
|
6c4447015d | ||
|
|
0209c9f9ac | ||
|
|
56d8a6060b | ||
|
|
2a82f35029 | ||
|
|
14a852b86d | ||
|
|
30675428d8 | ||
|
|
627bf906ab | ||
|
|
16dd6d8068 | ||
|
|
46fe61d359 | ||
|
|
9fda4a4cbf | ||
|
|
e80ac06ed4 | ||
|
|
aaa13532c2 | ||
|
|
91d5c3313c | ||
|
|
abc7b247e5 | ||
|
|
a1b6eae847 | ||
|
|
efc2a21590 | ||
|
|
0a21285b11 | ||
|
|
2985bcd7ef | ||
|
|
caf309a80f | ||
|
|
85a3cc6ffa | ||
|
|
235c3e8685 | ||
|
|
666b0f7564 | ||
|
|
bcb55107ac | ||
|
|
b5afff59c2 | ||
|
|
79fc0e3f01 | ||
|
|
b21e515e1b | ||
|
|
b42ac28eb1 | ||
|
|
7fae1ef12b | ||
|
|
2f694f0b77 | ||
|
|
67d245d965 | ||
|
|
e6c5ecd698 | ||
|
|
aea824f16e | ||
|
|
a9a9aa7fd8 | ||
|
|
b378d0371f | ||
|
|
a787bc0b14 | ||
|
|
be3a11029a | ||
|
|
5214f24d7b | ||
|
|
7f0fcb8a3e | ||
|
|
dd6598f391 | ||
|
|
891f24fa57 | ||
|
|
fccf65a585 | ||
|
|
bf7a99a3c1 | ||
|
|
7ba1af0280 | ||
|
|
714594d468 | ||
|
|
44b08521ef | ||
|
|
0312e73e16 | ||
|
|
d64921848d | ||
|
|
2e189bb053 | ||
|
|
1b1a94ea6d | ||
|
|
8456b5627d | ||
|
|
e4d08c0232 | ||
|
|
b6c3a2f172 | ||
|
|
1efc7550a3 | ||
|
|
5fc9efba30 | ||
|
|
aa101260d9 | ||
|
|
0be2dc9f22 | ||
|
|
331b74d6bf | ||
|
|
a038f77d92 | ||
|
|
d162bbcceb | ||
|
|
a9bd6f6ea6 | ||
|
|
9943c5dce5 | ||
|
|
2c0c333d16 | ||
|
|
830d40b36e | ||
|
|
7135ef78ee | ||
|
|
37b41ff693 | ||
|
|
3079956ff7 | ||
|
|
59a1e5564d | ||
|
|
99ed3a0e13 | ||
|
|
a9c1fffba0 | ||
|
|
b8be29fee6 | ||
|
|
2868eafc46 | ||
|
|
c00def343f | ||
|
|
05ae2e48ab | ||
|
|
478e4ac201 | ||
|
|
bb65e57297 | ||
|
|
d6de520bd1 | ||
|
|
704b9ee9d0 | ||
|
|
c65c06301c | ||
|
|
f17b9b8dd1 | ||
|
|
7b948c7335 | ||
|
|
6c2e138d7a | ||
|
|
668a972d1e | ||
|
|
dfd96e1aa5 | ||
|
|
7a002c7ece | ||
|
|
fc4e44bd37 | ||
|
|
8745043a86 | ||
|
|
dba0163dac | ||
|
|
9f6e0dc945 | ||
|
|
c73e5866c4 | ||
|
|
d5f682a00b | ||
|
|
4459745ff2 | ||
|
|
9286548c7e | ||
|
|
5eb3f71a3e | ||
|
|
33328871a7 | ||
|
|
de123a67d6 | ||
|
|
1248f05ae8 | ||
|
|
8ceaf28442 | ||
|
|
2ec5b852df | ||
|
|
02c2fc5ad3 | ||
|
|
7c0d9dac9f | ||
|
|
d159fdf25d | ||
|
|
68a360772f | ||
|
|
379949cce4 | ||
|
|
272a31f758 | ||
|
|
279f6b01de | ||
|
|
a09c464a20 | ||
|
|
f91b3a69ce | ||
|
|
0adb4b25d3 |
+9
-6
@@ -60,7 +60,7 @@ stages:
|
||||
|
||||
.openbsd-amd64: &openbsd_amd64
|
||||
tags:
|
||||
- openbsd
|
||||
- libvirt
|
||||
- amd64
|
||||
|
||||
### Docker Image Templates
|
||||
@@ -1071,20 +1071,23 @@ unit:clang:freebsd12.0:amd64:
|
||||
- clang:freebsd12.0:amd64
|
||||
needs: ["clang:freebsd12.0:amd64"]
|
||||
|
||||
# Jobs for Clang builds on OpenBSD 6.5 (amd64)
|
||||
# Jobs for Clang builds on OpenBSD 6.6 (amd64)
|
||||
|
||||
clang:openbsd6.5:amd64:
|
||||
clang:openbsd6.6:amd64:
|
||||
variables:
|
||||
CC: clang
|
||||
USER: gitlab-runner
|
||||
<<: *openbsd_amd64
|
||||
<<: *build_job
|
||||
|
||||
system:clang:openbsd6.5:amd64:
|
||||
system:clang:openbsd6.6:amd64:
|
||||
<<: *openbsd_amd64
|
||||
<<: *system_test_job
|
||||
variables:
|
||||
USER: gitlab-runner
|
||||
dependencies:
|
||||
- clang:openbsd6.5:amd64
|
||||
needs: ["clang:openbsd6.5:amd64"]
|
||||
- clang:openbsd6.6:amd64
|
||||
needs: ["clang:openbsd6.6:amd64"]
|
||||
only:
|
||||
- schedules
|
||||
- tags
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
5354. [bug] dnssec-policy created new KSK keys when zone is in
|
||||
initial stage of signing (the DS is not yet in
|
||||
rumoured or omnipresent state). Fix by checking
|
||||
key goals rather than active state when determining
|
||||
new keys are needed. [GL #1593]
|
||||
|
||||
5353. [doc] Document port and dscp parameters in forwarders
|
||||
configuration option. [GL !914]
|
||||
|
||||
5352. [bug] Correctly handle catalog zone entries containing
|
||||
characters that aren't legal in filenames. [GL #1592]
|
||||
|
||||
5351. [bug] CDS / CDNSKEY consistency checks failed to handle
|
||||
removal records. [GL #1554]
|
||||
|
||||
5350. [bug] When a view was configured with class CHAOS, the
|
||||
server could crash while processing a query for a
|
||||
non-existent record. [GL #1540]
|
||||
|
||||
@@ -34,7 +34,7 @@ offer support on a "best effort" basis for some.
|
||||
|
||||
Regularly tested platforms
|
||||
|
||||
As of Dec 2019, BIND 9.15 is fully supported and regularly tested on the
|
||||
As of Feb 2020, BIND 9.15 is fully supported and regularly tested on the
|
||||
following systems:
|
||||
|
||||
* Debian 9, 10
|
||||
@@ -42,7 +42,7 @@ following systems:
|
||||
* Fedora 31
|
||||
* Red Hat Enterprise Linux / CentOS 7, 8
|
||||
* FreeBSD 11.3, 12.0
|
||||
* OpenBSD 6.5
|
||||
* OpenBSD 6.6
|
||||
* Alpine Linux
|
||||
|
||||
The amd64, i386, armhf and arm64 CPU architectures are all fully
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ offer support on a "best effort" basis for some.
|
||||
|
||||
### Regularly tested platforms
|
||||
|
||||
As of Dec 2019, BIND 9.15 is fully supported and regularly tested on the
|
||||
As of Feb 2020, BIND 9.15 is fully supported and regularly tested on the
|
||||
following systems:
|
||||
|
||||
* Debian 9, 10
|
||||
@@ -50,7 +50,7 @@ following systems:
|
||||
* Fedora 31
|
||||
* Red Hat Enterprise Linux / CentOS 7, 8
|
||||
* FreeBSD 11.3, 12.0
|
||||
* OpenBSD 6.5
|
||||
* OpenBSD 6.6
|
||||
* Alpine Linux
|
||||
|
||||
The amd64, i386, armhf and arm64 CPU architectures are all fully supported.
|
||||
|
||||
+3
-8
@@ -568,8 +568,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
|
||||
if (!query->lookup->comments)
|
||||
flags |= DNS_MESSAGETEXTFLAG_NOCOMMENTS;
|
||||
|
||||
result = isc_buffer_allocate(mctx, &buf, len);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(mctx, &buf, len);
|
||||
|
||||
if (yaml) {
|
||||
enum { Q = 0x1, R = 0x2 }; /* Q:query; R:ecursive */
|
||||
@@ -742,11 +741,8 @@ repopulate_buffer:
|
||||
buftoosmall:
|
||||
len += OUTPUTBUF;
|
||||
isc_buffer_free(&buf);
|
||||
result = isc_buffer_allocate(mctx, &buf, len);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
goto repopulate_buffer;
|
||||
else
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(mctx, &buf, len);
|
||||
goto repopulate_buffer;
|
||||
}
|
||||
check_result(result,
|
||||
"dns_message_pseudosectiontotext");
|
||||
@@ -827,7 +823,6 @@ buftoosmall:
|
||||
(char *)isc_buffer_base(buf));
|
||||
isc_buffer_free(&buf);
|
||||
|
||||
cleanup:
|
||||
if (style != NULL)
|
||||
dns_master_styledestroy(&style, mctx);
|
||||
return (result);
|
||||
|
||||
+2
-5
@@ -883,10 +883,8 @@ setup_text_key(void) {
|
||||
unsigned char *secretstore;
|
||||
|
||||
debug("setup_text_key()");
|
||||
result = isc_buffer_allocate(mctx, &namebuf, MXNAME);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(mctx, &namebuf, MXNAME);
|
||||
dns_name_init(&keyname, NULL);
|
||||
check_result(result, "dns_name_init");
|
||||
isc_buffer_putstr(namebuf, keynametext);
|
||||
secretsize = (unsigned int) strlen(keysecret) * 3 / 4;
|
||||
secretstore = isc_mem_allocate(mctx, secretsize);
|
||||
@@ -1396,8 +1394,7 @@ setup_libs(void) {
|
||||
check_result(result, "dst_lib_init");
|
||||
is_dst_up = true;
|
||||
|
||||
result = isc_mempool_create(mctx, COMMSIZE, &commctx);
|
||||
check_result(result, "isc_mempool_create");
|
||||
isc_mempool_create(mctx, COMMSIZE, &commctx);
|
||||
isc_mempool_setname(commctx, "COMMPOOL");
|
||||
/*
|
||||
* 6 and 2 set as reasonable parameters for 3 or 4 nameserver
|
||||
|
||||
+1
-2
@@ -199,8 +199,7 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
||||
|
||||
dns_name_format(name, namestr, sizeof(namestr));
|
||||
retry:
|
||||
result = isc_buffer_allocate(mctx, &b, bufsize);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(mctx, &b, bufsize);
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_NOSPACE) {
|
||||
isc_buffer_free(&b);
|
||||
|
||||
+1
-3
@@ -221,9 +221,7 @@ printrdata(dns_rdata_t *rdata) {
|
||||
printf("rdata_%d = ", rdata->type);
|
||||
|
||||
while (!done) {
|
||||
result = isc_buffer_allocate(mctx, &b, size);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(mctx, &b, size);
|
||||
result = dns_rdata_totext(rdata, NULL, b);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
printf("%.*s\n", (int)isc_buffer_usedlength(b),
|
||||
|
||||
@@ -370,8 +370,7 @@ formatset(dns_rdataset_t *rdataset) {
|
||||
mctx);
|
||||
check_result(result, "dns_master_stylecreate2 failed");
|
||||
|
||||
result = isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
|
||||
check_result(result, "printing DS records");
|
||||
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
|
||||
result = dns_master_rdatasettotext(name, rdataset, style, NULL, buf);
|
||||
|
||||
if ((result == ISC_R_SUCCESS) && isc_buffer_availablelength(buf) < 1) {
|
||||
@@ -834,8 +833,7 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata,
|
||||
result = dns_rdatalist_tordataset(dslist, &new_ds_set);
|
||||
check_result(result, "dns_rdatalist_tordataset(dslist)");
|
||||
|
||||
result = isc_buffer_allocate(mctx, &new_ds_buf, size);
|
||||
check_result(result, "building new DS records");
|
||||
isc_buffer_allocate(mctx, &new_ds_buf, size);
|
||||
|
||||
for (result = dns_rdataset_first(rdset);
|
||||
result == ISC_R_SUCCESS;
|
||||
|
||||
@@ -226,8 +226,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
|
||||
|
||||
dns_rdataset_init(&rds);
|
||||
|
||||
result = isc_buffer_allocate(mctx, &buffer, bufsize);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(mctx, &buffer, bufsize);
|
||||
|
||||
for (result = dns_rdatasetiter_first(iter);
|
||||
result == ISC_R_SUCCESS;
|
||||
@@ -253,8 +252,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
|
||||
|
||||
bufsize <<= 1;
|
||||
isc_buffer_free(&buffer);
|
||||
result = isc_buffer_allocate(mctx, &buffer, bufsize);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(mctx, &buffer, bufsize);
|
||||
}
|
||||
check_result(result, "dns_master_rdatasettotext");
|
||||
|
||||
|
||||
@@ -445,9 +445,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
||||
goto cleanup_request;
|
||||
}
|
||||
|
||||
result = isc_buffer_allocate(listener->mctx, &text, 2 * 2048);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup_request;
|
||||
isc_buffer_allocate(listener->mctx, &text, 2 * 2048);
|
||||
|
||||
/*
|
||||
* Establish nonce.
|
||||
@@ -493,10 +491,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
||||
goto cleanup_response;
|
||||
|
||||
if (conn->buffer == NULL) {
|
||||
result = isc_buffer_allocate(listener->mctx,
|
||||
&conn->buffer, 2 * 2048);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup_response;
|
||||
isc_buffer_allocate(listener->mctx, &conn->buffer, 2 * 2048);
|
||||
}
|
||||
|
||||
isc_buffer_clear(conn->buffer);
|
||||
|
||||
+8
-26
@@ -1344,7 +1344,7 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af,
|
||||
break;
|
||||
}
|
||||
if (isc_sockaddr_getport(&sa) == 0) {
|
||||
attrs |= DNS_DISPATCHATTR_EXCLUSIVE;
|
||||
// attrs |= DNS_DISPATCHATTR_EXCLUSIVE;
|
||||
maxdispatchbuffers = EXCLBUFFERS;
|
||||
} else {
|
||||
INSIST(obj != NULL);
|
||||
@@ -7694,9 +7694,7 @@ data_to_cfg(dns_view_t *view, MDB_val *key, MDB_val *data,
|
||||
REQUIRE(zoneconfig != NULL && *zoneconfig == NULL);
|
||||
|
||||
if (*text == NULL) {
|
||||
result = isc_buffer_allocate(view->mctx, text, 256);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(view->mctx, text, 256);
|
||||
} else {
|
||||
isc_buffer_clear(*text);
|
||||
}
|
||||
@@ -9546,7 +9544,7 @@ run_server(isc_task_t *task, isc_event_t *event) {
|
||||
named_g_nm,
|
||||
named_g_dispatchmgr,
|
||||
server->task, named_g_udpdisp, geoip,
|
||||
&server->interfacemgr),
|
||||
named_g_cpus, &server->interfacemgr),
|
||||
"creating interface manager");
|
||||
|
||||
CHECKFATAL(isc_timer_create(named_g_timermgr, isc_timertype_inactive,
|
||||
@@ -10067,8 +10065,7 @@ named_add_reserved_dispatch(named_server_t *server,
|
||||
return;
|
||||
|
||||
cleanup:
|
||||
if (dispatch != NULL)
|
||||
isc_mem_put(server->mctx, dispatch, sizeof(*dispatch));
|
||||
isc_mem_put(server->mctx, dispatch, sizeof(*dispatch));
|
||||
isc_sockaddr_format(addr, addrbuf, sizeof(addrbuf));
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
@@ -11030,8 +11027,7 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex,
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (dctx != NULL)
|
||||
dumpcontext_destroy(dctx);
|
||||
dumpcontext_destroy(dctx);
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -12394,17 +12390,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
|
||||
/* We're creating or overwriting the zone */
|
||||
const cfg_obj_t *zoptions;
|
||||
|
||||
result = isc_buffer_allocate(view->mctx, &text, 256);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(named_g_lctx,
|
||||
NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER,
|
||||
ISC_LOG_ERROR,
|
||||
"Unable to allocate buffer in "
|
||||
"nzd_save(): %s",
|
||||
isc_result_totext(result));
|
||||
goto cleanup;
|
||||
}
|
||||
isc_buffer_allocate(view->mctx, &text, 256);
|
||||
|
||||
zoptions = cfg_tuple_get(zconfig, "options");
|
||||
if (zoptions == NULL) {
|
||||
@@ -12429,7 +12415,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
|
||||
ISC_LOG_ERROR,
|
||||
"Error writing zone config to "
|
||||
"buffer in nzd_save(): %s",
|
||||
isc_result_totext(result));
|
||||
isc_result_totext(dzarg.result));
|
||||
result = dzarg.result;
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -12761,7 +12747,7 @@ migrate_nzf(dns_view_t *view) {
|
||||
|
||||
CHECK(nzd_open(view, 0, &txn, &dbi));
|
||||
|
||||
CHECK(isc_buffer_allocate(view->mctx, &text, 256));
|
||||
isc_buffer_allocate(view->mctx, &text, 256);
|
||||
|
||||
for (element = cfg_list_first(zonelist);
|
||||
element != NULL;
|
||||
@@ -13847,10 +13833,6 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex,
|
||||
dns_zone_detach(&raw);
|
||||
if (zone != NULL)
|
||||
dns_zone_detach(&zone);
|
||||
if (dz != NULL) {
|
||||
dns_zone_detach(&dz->zone);
|
||||
isc_mem_put(named_g_mctx, dz, sizeof(*dz));
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -1238,8 +1238,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
|
||||
|
||||
result = dns_message_gettempname(msg, namep);
|
||||
check_result(result, "dns_message_gettempname");
|
||||
result = isc_buffer_allocate(gmctx, &namebuf, DNS_NAME_MAXWIRE);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(gmctx, &namebuf, DNS_NAME_MAXWIRE);
|
||||
dns_name_init(*namep, NULL);
|
||||
dns_name_setbuffer(*namep, namebuf);
|
||||
dns_message_takebuffer(msg, &namebuf);
|
||||
@@ -1284,16 +1283,14 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
|
||||
isc_buffer_add(&source, strlen(cmdline));
|
||||
result = isc_lex_openbuffer(lex, &source);
|
||||
check_result(result, "isc_lex_openbuffer");
|
||||
result = isc_buffer_allocate(gmctx, &buf, MAXWIRE);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(gmctx, &buf, MAXWIRE);
|
||||
result = dns_rdata_fromtext(NULL, rdataclass, rdatatype, lex,
|
||||
dns_rootname, 0, gmctx, buf,
|
||||
&callbacks);
|
||||
isc_lex_destroy(&lex);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_buffer_usedregion(buf, &r);
|
||||
result = isc_buffer_allocate(gmctx, &newbuf, r.length);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(gmctx, &newbuf, r.length);
|
||||
isc_buffer_putmem(newbuf, r.base, r.length);
|
||||
isc_buffer_usedregion(newbuf, &r);
|
||||
dns_rdata_fromregion(rdata, rdataclass, rdatatype, &r);
|
||||
@@ -2041,8 +2038,7 @@ show_message(FILE *stream, dns_message_t *msg, const char *description) {
|
||||
}
|
||||
if (buf != NULL)
|
||||
isc_buffer_free(&buf);
|
||||
result = isc_buffer_allocate(gmctx, &buf, bufsz);
|
||||
check_result(result, "isc_buffer_allocate");
|
||||
isc_buffer_allocate(gmctx, &buf, bufsz);
|
||||
result = dns_message_totext(msg, style, 0, buf);
|
||||
bufsz *= 2;
|
||||
} while (result == ISC_R_NOSPACE);
|
||||
|
||||
@@ -374,8 +374,8 @@ plugin_register(const char *parameters,
|
||||
cfg_line, mctx, lctx, actx));
|
||||
}
|
||||
|
||||
CHECK(isc_mempool_create(mctx, sizeof(filter_data_t),
|
||||
&inst->datapool));
|
||||
isc_mempool_create(mctx, sizeof(filter_data_t),
|
||||
&inst->datapool);
|
||||
CHECK(isc_ht_init(&inst->ht, mctx, 16));
|
||||
isc_mutex_init(&inst->hlock);
|
||||
|
||||
|
||||
+1
-2
@@ -965,8 +965,7 @@ main(int argc, char **argv) {
|
||||
|
||||
command = *argv;
|
||||
|
||||
DO("allocate data buffer",
|
||||
isc_buffer_allocate(rndc_mctx, &databuf, 2048));
|
||||
isc_buffer_allocate(rndc_mctx, &databuf, 2048);
|
||||
|
||||
/*
|
||||
* Convert argc/argv into a space-delimited command string
|
||||
|
||||
@@ -297,8 +297,8 @@ main(int argc, char **argv) {
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
cmp = NULL;
|
||||
RUNTIME_CHECK(isc_mempool_create(mctx, sizeof(client_t), &cmp)
|
||||
== ISC_R_SUCCESS);
|
||||
isc_mempool_create(mctx, sizeof(client_t), &cmp)
|
||||
;
|
||||
isc_mempool_setname(cmp, "adb test clients");
|
||||
|
||||
result = isc_log_create(mctx, &lctx, &lcfg);
|
||||
|
||||
@@ -34,10 +34,10 @@ main(int argc, char *argv[]) {
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
mp1 = NULL;
|
||||
RUNTIME_CHECK(isc_mempool_create(mctx, 24, &mp1) == ISC_R_SUCCESS);
|
||||
isc_mempool_create(mctx, 24, &mp1);
|
||||
|
||||
mp2 = NULL;
|
||||
RUNTIME_CHECK(isc_mempool_create(mctx, 31, &mp2) == ISC_R_SUCCESS);
|
||||
isc_mempool_create(mctx, 31, &mp2);
|
||||
|
||||
isc_mempool_associatelock(mp1, &lock);
|
||||
isc_mempool_associatelock(mp2, &lock);
|
||||
|
||||
+109
-81
@@ -378,7 +378,7 @@ ret=0
|
||||
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
|
||||
server 10.53.0.1 ${PORT}
|
||||
update add masters.catalog1.example. 3600 IN A 10.53.0.3
|
||||
update add masters.catalog1.example. 3600 IN AAAA fd92:7065:b8e:ffff::3
|
||||
update add masters.catalog1.example. 3600 IN AAAA fd92:7065:b8e:ffff::3
|
||||
update add 4346f565b4d63ddb99e5d2497ff22d04e878e8f8.zones.catalog1.example. 3600 IN PTR dom6.example.
|
||||
send
|
||||
END
|
||||
@@ -759,96 +759,127 @@ if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
##########################################################################
|
||||
echo_i "Testing very long domain in catalog"
|
||||
n=$((n+1))
|
||||
echo_i "checking that this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. is not served by master ($n)"
|
||||
ret=0
|
||||
wait_for_no_soa @10.53.0.1 this.is.aery.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
echo_i "Testing catalog entries that can't be represented as filenames"
|
||||
# note: we need 4 backslashes in the shell to get 2 backslashes in DNS
|
||||
# presentation format, which is 1 backslash on the wire.
|
||||
for special in \
|
||||
this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example \
|
||||
this.zone/domain.has.a.slash.dom10.example \
|
||||
this.zone\\\\domain.has.backslash.dom10.example \
|
||||
this.zone:domain.has.a.colon.dom.10.example
|
||||
do
|
||||
# hashes below are generated by:
|
||||
# python ${TOP}/contrib/scripts/catzhash.py "${special}"
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "Adding a domain this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. to master via RNDC ($n)"
|
||||
ret=0
|
||||
echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom10.example.db
|
||||
echo "@ IN NS invalid." >> ns1/dom10.example.db
|
||||
rndccmd 10.53.0.1 addzone this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. '{type master; file "dom10.example.db";};' || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
case "$special" in
|
||||
this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example)
|
||||
hash=825f48b1ce1b4cf5a041d20255a0c8e98d114858
|
||||
db=__catz__4d70696f2335687069467f11f5d5378c480383f97782e553fb2d04a7bb2a23ed.db
|
||||
;;
|
||||
this.zone/domain.has.a.slash.dom10.example)
|
||||
hash=e64cc64c99bf52d0a77fb16dd7ed57cf925a36aa
|
||||
db=__catz__46ba3e1b28d5955e5313d5fee61bedc78c71d08035aa7ea2f7bf0b8228ab3acc.db
|
||||
;;
|
||||
this.zone\\\\domain.has.backslash.dom10.example)
|
||||
hash=91e27e02153d38cf656a9b376d7747fbcd19f985
|
||||
db=__catz__b667f7ff802c0895e0506699951cff9a1cab68c5ef8546aa0d07425f244ed870.db
|
||||
;;
|
||||
this.zone:domain.has.a.colon.dom.10.example)
|
||||
hash=8b7238bf4c34045834c573ba4116557ebb24d33c
|
||||
db=__catz__5c721f7872913a4e7fa8ad42589cce5dd6e551a4c9e6ab3f86e77c0bbc7c2ca6.db
|
||||
;;
|
||||
esac
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "checking that this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. is now served by master ($n)"
|
||||
ret=0
|
||||
wait_for_soa @10.53.0.1 this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
n=$((n+1))
|
||||
echo_i "checking that ${special}. is not served by master ($n)"
|
||||
ret=0
|
||||
wait_for_no_soa @10.53.0.1 "${special}" dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
nextpart ns2/named.run >/dev/null
|
||||
n=$((n+1))
|
||||
echo_i "Adding a domain ${special}. to master via RNDC ($n)"
|
||||
ret=0
|
||||
echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom10.example.db
|
||||
echo "@ IN NS invalid." >> ns1/dom10.example.db
|
||||
rndccmd 10.53.0.1 addzone '"'"${special}"'"' '{type master; file "dom10.example.db";};' || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "Adding domain this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. to catalog1 zone ($n)"
|
||||
ret=0
|
||||
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
|
||||
server 10.53.0.1 ${PORT}
|
||||
update add 825f48b1ce1b4cf5a041d20255a0c8e98d114858.zones.catalog1.example 3600 IN PTR this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example.
|
||||
send
|
||||
n=$((n+1))
|
||||
echo_i "checking that ${special}. is now served by master ($n)"
|
||||
ret=0
|
||||
wait_for_soa @10.53.0.1 "${special}." dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
nextpart ns2/named.run >/dev/null
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "Adding domain ${special}. to catalog1 zone ($n)"
|
||||
ret=0
|
||||
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
|
||||
server 10.53.0.1 ${PORT}
|
||||
update add ${hash}.zones.catalog1.example 3600 IN PTR ${special}.
|
||||
send
|
||||
END
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "waiting for slave to sync up ($n)"
|
||||
ret=0
|
||||
wait_for_message ns2/named.run "catz: adding zone 'this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example' from catalog 'catalog1.example'" &&
|
||||
wait_for_message ns2/named.run "transfer of 'this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
n=$((n+1))
|
||||
echo_i "waiting for slave to sync up ($n)"
|
||||
ret=0
|
||||
wait_for_message ns2/named.run "catz: adding zone '$special' from catalog 'catalog1.example'" &&
|
||||
wait_for_message ns2/named.run "transfer of '$special/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "checking that this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. is served by slave ($n)"
|
||||
ret=0
|
||||
wait_for_soa @10.53.0.2 this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
n=$((n+1))
|
||||
echo_i "checking that ${special}. is served by slave ($n)"
|
||||
ret=0
|
||||
wait_for_soa @10.53.0.2 "${special}." dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "checking that zone-directory is populated with a hashed filename ($n)"
|
||||
ret=0
|
||||
wait_for_zonefile "ns2/zonedir/__catz__4d70696f2335687069467f11f5d5378c480383f97782e553fb2d04a7bb2a23ed.db" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
n=$((n+1))
|
||||
echo_i "checking that zone-directory is populated with a hashed filename ($n)"
|
||||
ret=0
|
||||
wait_for_zonefile "ns2/zonedir/$db" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "removing domain this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. from catalog1 zone ($n)"
|
||||
ret=0
|
||||
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
|
||||
server 10.53.0.1 ${PORT}
|
||||
update delete 825f48b1ce1b4cf5a041d20255a0c8e98d114858.zones.catalog1.example
|
||||
send
|
||||
n=$((n+1))
|
||||
echo_i "removing domain ${special}. from catalog1 zone ($n)"
|
||||
ret=0
|
||||
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
|
||||
server 10.53.0.1 ${PORT}
|
||||
update delete ${hash}.zones.catalog1.example
|
||||
send
|
||||
END
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "waiting for slave to sync up ($n)"
|
||||
ret=0
|
||||
wait_for_message ns2/named.run "zone_shutdown: zone this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example/IN: shutting down" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
n=$((n+1))
|
||||
echo_i "waiting for slave to sync up ($n)"
|
||||
ret=0
|
||||
wait_for_message ns2/named.run "zone_shutdown: zone ${special}/IN: shutting down" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "checking that this.is.a.very.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. is not served by slave ($n)"
|
||||
ret=0
|
||||
wait_for_no_soa @10.53.0.2 this.is.aery.very.long.long.long.domain.that.will.cause.catalog.zones.to.generate.hash.instead.of.using.regular.filename.dom10.example. dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
n=$((n+1))
|
||||
echo_i "checking that ${special}. is not served by slave ($n)"
|
||||
ret=0
|
||||
wait_for_no_soa @10.53.0.2 "${special}." dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "checking that zone-directory is emptied ($n)"
|
||||
ret=0
|
||||
wait_for_no_zonefile "ns2/zonedir/__catz__4d70696f2335687069467f11f5d5378c480383f97782e553fb2d04a7bb2a23ed.db" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
n=$((n+1))
|
||||
echo_i "checking that zone-directory is emptied ($n)"
|
||||
ret=0
|
||||
wait_for_no_zonefile "ns2/zonedir/$db" || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
done
|
||||
|
||||
##########################################################################
|
||||
echo_i "Testing adding a domain and a subdomain of it"
|
||||
@@ -954,8 +985,6 @@ wait_for_soa @10.53.0.2 subdomain.of.dom11.example. dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "removing domain dom11.example. from catalog1 zone ($n)"
|
||||
ret=0
|
||||
@@ -1013,7 +1042,6 @@ wait_for_no_soa @10.53.0.2 subdomain.of.d11.example. dig.out.test$n || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
|
||||
|
||||
##########################################################################
|
||||
echo_i "Testing adding a catalog zone at runtime with rndc reconfig"
|
||||
n=$((n+1))
|
||||
|
||||
@@ -95,6 +95,8 @@ else
|
||||
COLOR_WARN=''
|
||||
fi
|
||||
|
||||
SYSTESTDIR="`basename $PWD`"
|
||||
|
||||
if type printf > /dev/null 2>&1
|
||||
then
|
||||
echofail () {
|
||||
@@ -115,6 +117,23 @@ then
|
||||
echoend () {
|
||||
printf "${COLOR_END}%s${COLOR_NONE}\n" "$*"
|
||||
}
|
||||
echo_i() {
|
||||
printf '%s\n' "$*" | while read -r __LINE ; do
|
||||
echoinfo "I:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
echo_ic() {
|
||||
printf '%s\n' "$*" | while read -r __LINE ; do
|
||||
echoinfo "I:$SYSTESTDIR: $__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
echo_d() {
|
||||
printf '%s\n' "$*" | while read -r __LINE ; do
|
||||
echoinfo "D:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
else
|
||||
echofail () {
|
||||
echo "$*"
|
||||
@@ -134,36 +153,34 @@ else
|
||||
echoend () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
echo_i() {
|
||||
echo "$@" | while read -r __LINE ; do
|
||||
echoinfo "I:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
echo_ic() {
|
||||
echo "$@" | while read -r __LINE ; do
|
||||
echoinfo "I:$SYSTESTDIR: $__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
echo_d() {
|
||||
echo "$@" | while read -r __LINE ; do
|
||||
echoinfo "D:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
fi
|
||||
|
||||
SYSTESTDIR="`basename $PWD`"
|
||||
|
||||
echo_i() {
|
||||
echo "$@" | while read __LINE ; do
|
||||
echoinfo "I:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
echo_ic() {
|
||||
echo "$@" | while read __LINE ; do
|
||||
echoinfo "I:$SYSTESTDIR: $__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
cat_i() {
|
||||
while read __LINE ; do
|
||||
while read -r __LINE ; do
|
||||
echoinfo "I:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
echo_d() {
|
||||
echo "$@" | while read __LINE ; do
|
||||
echoinfo "D:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
cat_d() {
|
||||
while read __LINE ; do
|
||||
while read -r __LINE ; do
|
||||
echoinfo "D:$SYSTESTDIR:$__LINE"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ rm -f ./canonical?.*
|
||||
rm -f ./delv.out*
|
||||
rm -f ./delve.out*
|
||||
rm -f ./dig.out.*
|
||||
rm -f ./dnssectools.out*
|
||||
rm -f ./dsfromkey.out.*
|
||||
rm -f ./keygen.err
|
||||
rm -f ./dnssectools.out*
|
||||
rm -f ./named.secroots.test*
|
||||
rm -f ./nosign.before
|
||||
rm -f ./ns*/*.nta
|
||||
@@ -37,19 +37,19 @@ rm -f ./ns1/root.db ./ns2/example.db ./ns2/managed.db ./ns2/trusted.db
|
||||
rm -f ./ns2/algroll.db
|
||||
rm -f ./ns2/badparam.db ./ns2/badparam.db.bad
|
||||
rm -f ./ns2/cdnskey-kskonly.secure.db
|
||||
rm -f ./ns2/cdnskey-kskonly.secure.id
|
||||
rm -f ./ns2/cdnskey-update.secure.db
|
||||
rm -f ./ns2/cdnskey-x.secure.db
|
||||
rm -f ./ns2/cdnskey.secure.db
|
||||
rm -f ./ns2/cds-auto.secure.db ./ns2/cds-auto.secure.db.jnl
|
||||
rm -f ./ns2/cds-kskonly.secure.db
|
||||
rm -f ./ns2/cds-kskonly.secure.id
|
||||
rm -f ./ns2/cds-update.secure.db ./ns2/cds-update.secure.db.jnl
|
||||
rm -f ./ns2/cds.secure.db ./ns2/cds-x.secure.db
|
||||
rm -f ./ns2/in-addr.arpa.db
|
||||
rm -f ./ns2/nsec3chain-test.db
|
||||
rm -f ./ns2/single-nsec3.db
|
||||
rm -f ./ns2/updatecheck-kskonly.secure.*
|
||||
rm -f ./ns3/secure.example.db ./ns3/*.managed.db ./ns3/*.trusted.db
|
||||
rm -f ./ns3/unsupported.managed.db.tmp ./ns3/unsupported.trusted.db.tmp
|
||||
rm -f ./ns3/auto-nsec.example.db ./ns3/auto-nsec3.example.db
|
||||
rm -f ./ns3/badds.example.db
|
||||
rm -f ./ns3/dname-at-apex-nsec3.example.db
|
||||
@@ -57,10 +57,10 @@ rm -f ./ns3/dnskey-nsec3-unknown.example.db
|
||||
rm -f ./ns3/dnskey-nsec3-unknown.example.db.tmp
|
||||
rm -f ./ns3/dnskey-unknown.example.db
|
||||
rm -f ./ns3/dnskey-unknown.example.db.tmp
|
||||
rm -f ./ns3/dnskey-unsupported.example.db
|
||||
rm -f ./ns3/dnskey-unsupported.example.db.tmp
|
||||
rm -f ./ns3/dnskey-unsupported-2.example.db
|
||||
rm -f ./ns3/dnskey-unsupported-2.example.db.tmp
|
||||
rm -f ./ns3/dnskey-unsupported.example.db
|
||||
rm -f ./ns3/dnskey-unsupported.example.db.tmp
|
||||
rm -f ./ns3/dynamic.example.db ./ns3/dynamic.example.db.signed.jnl
|
||||
rm -f ./ns3/expired.example.db ./ns3/update-nsec3.example.db
|
||||
rm -f ./ns3/expiring.example.db ./ns3/nosign.example.db
|
||||
@@ -80,6 +80,7 @@ rm -f ./ns3/publish-inactive.example.db
|
||||
rm -f ./ns3/revkey.example.db
|
||||
rm -f ./ns3/rsasha256.example.db ./ns3/rsasha512.example.db
|
||||
rm -f ./ns3/secure.below-cname.example.db
|
||||
rm -f ./ns3/secure.example.db ./ns3/*.managed.db ./ns3/*.trusted.db
|
||||
rm -f ./ns3/secure.nsec3.example.db
|
||||
rm -f ./ns3/secure.optout.example.db
|
||||
rm -f ./ns3/siginterval.conf
|
||||
@@ -89,6 +90,7 @@ rm -f ./ns3/split-smart.example.db
|
||||
rm -f ./ns3/ttlpatch.example.db ./ns3/ttlpatch.example.db.signed
|
||||
rm -f ./ns3/ttlpatch.example.db.patched
|
||||
rm -f ./ns3/unsecure.example.db ./ns3/bogus.example.db ./ns3/keyless.example.db
|
||||
rm -f ./ns3/unsupported.managed.db.tmp ./ns3/unsupported.trusted.db.tmp
|
||||
rm -f ./ns4/managed-keys.bind*
|
||||
rm -f ./ns4/named_dump.db*
|
||||
rm -f ./ns6/optout-tld.db
|
||||
|
||||
@@ -238,6 +238,7 @@ key1=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone -f KSK "$
|
||||
key2=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone "$zone")
|
||||
cat "$infile" "$key1.key" "$key2.key" > "$zonefile"
|
||||
"$SIGNER" -P -g -o "$zone" "$zonefile" > /dev/null 2>&1
|
||||
keyfile_to_key_id "$key1" > cds-kskonly.secure.id
|
||||
|
||||
zone=cds-auto.secure
|
||||
infile=cds-auto.secure.db.in
|
||||
@@ -281,6 +282,7 @@ key1=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone -f KSK "$
|
||||
key2=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone "$zone")
|
||||
cat "$infile" "$key1.key" "$key2.key" > "$zonefile"
|
||||
"$SIGNER" -P -g -o "$zone" "$zonefile" > /dev/null 2>&1
|
||||
keyfile_to_key_id "$key1" > cdnskey-kskonly.secure.id
|
||||
|
||||
zone=cdnskey-auto.secure
|
||||
infile=cdnskey-auto.secure.db.in
|
||||
|
||||
@@ -3317,6 +3317,24 @@ n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "check that a CDS deletion record is accepted ($n)"
|
||||
ret=0
|
||||
(
|
||||
echo zone cds-update.secure
|
||||
echo server 10.53.0.2 "$PORT"
|
||||
echo update delete cds-update.secure CDS
|
||||
echo update add cds-update.secure 0 CDS 0 0 0 00
|
||||
echo send
|
||||
) | $NSUPDATE > nsupdate.out.test$n 2>&1
|
||||
dig_with_opts +noall +answer @10.53.0.2 cds cds-update.secure > dig.out.test$n
|
||||
lines=$(awk '$4 == "CDS" {print}' dig.out.test$n | wc -l)
|
||||
test "${lines:-10}" -eq 1 || ret=1
|
||||
lines=$(tr -d '\r' < dig.out.test$n | awk '$4 == "CDS" && $5 == "0" && $6 == "0" && $7 == "0" && $8 == "00" {print}' | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "check that CDS records are signed using KSK when added by nsupdate ($n)"
|
||||
ret=0
|
||||
(
|
||||
@@ -3342,6 +3360,7 @@ status=$((status+ret))
|
||||
echo_i "check that CDS records are signed only using KSK when added by"
|
||||
echo_i " nsupdate when dnssec-dnskey-kskonly is yes ($n)"
|
||||
ret=0
|
||||
keyid=$(cat ns2/cds-kskonly.secure.id)
|
||||
(
|
||||
echo zone cds-kskonly.secure
|
||||
echo server 10.53.0.2 "$PORT"
|
||||
@@ -3356,12 +3375,38 @@ echo send
|
||||
dig_with_opts +noall +answer @10.53.0.2 cds cds-kskonly.secure > dig.out.test$n
|
||||
lines=$(awk '$4 == "RRSIG" && $5 == "CDS" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk -v id="${keyid}" '$4 == "RRSIG" && $5 == "CDS" && $11 == id {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk '$4 == "CDS" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 2 || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "check that CDS deletion records are signed only using KSK when added by"
|
||||
echo_i " nsupdate when dnssec-dnskey-kskonly is yes ($n)"
|
||||
ret=0
|
||||
keyid=$(cat ns2/cds-kskonly.secure.id)
|
||||
(
|
||||
echo zone cds-kskonly.secure
|
||||
echo server 10.53.0.2 "$PORT"
|
||||
echo update delete cds-kskonly.secure CDS
|
||||
echo update add cds-kskonly.secure 0 CDS 0 0 0 00
|
||||
echo send
|
||||
) | $NSUPDATE
|
||||
dig_with_opts +noall +answer @10.53.0.2 cds cds-kskonly.secure > dig.out.test$n
|
||||
lines=$(awk '$4 == "RRSIG" && $5 == "CDS" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk -v id="${keyid}" '$4 == "RRSIG" && $5 == "CDS" && $11 == id {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk '$4 == "CDS" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(tr -d '\r' < dig.out.test$n | awk '$4 == "CDS" && $5 == "0" && $6 == "0" && $7 == "0" && $8 == "00" {print}' | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "checking that positive unknown NSEC3 hash algorithm with OPTOUT does validate ($n)"
|
||||
ret=0
|
||||
dig_with_opts +noauth +noadd +nodnssec +adflag @10.53.0.3 optout-unknown.example SOA > dig.out.ns3.test$n
|
||||
@@ -3497,6 +3542,24 @@ n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "check that a CDNSKEY deletion record is accepted ($n)"
|
||||
ret=0
|
||||
(
|
||||
echo zone cdnskey-update.secure
|
||||
echo server 10.53.0.2 "$PORT"
|
||||
echo update delete cdnskey-update.secure CDNSKEY
|
||||
echo update add cdnskey-update.secure 0 CDNSKEY 0 3 0 AA==
|
||||
echo send
|
||||
) | $NSUPDATE > nsupdate.out.test$n 2>&1
|
||||
dig_with_opts +noall +answer @10.53.0.2 cdnskey cdnskey-update.secure > dig.out.test$n
|
||||
lines=$(awk '$4 == "CDNSKEY" {print}' dig.out.test$n | wc -l)
|
||||
test "${lines:-10}" -eq 1 || ret=1
|
||||
lines=$(tr -d '\r' < dig.out.test$n | awk '$4 == "CDNSKEY" && $5 == "0" && $6 == "3" && $7 == "0" && $8 == "AA==" {print}' | wc -l)
|
||||
test "${lines:-10}" -eq 1 || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "checking that unknown DNSKEY algorithm + unknown NSEC3 has algorithm validates as insecure ($n)"
|
||||
ret=0
|
||||
dig_with_opts +noauth +noadd +nodnssec +adflag @10.53.0.3 dnskey-nsec3-unknown.example A > dig.out.ns3.test$n
|
||||
@@ -3530,6 +3593,7 @@ status=$((status+ret))
|
||||
echo_i "check that CDNSKEY records are signed only using KSK when added by"
|
||||
echo_i " nsupdate when dnssec-dnskey-kskonly is yes ($n)"
|
||||
ret=0
|
||||
keyid=$(cat ns2/cdnskey-kskonly.secure.id)
|
||||
(
|
||||
echo zone cdnskey-kskonly.secure
|
||||
echo server 10.53.0.2 "$PORT"
|
||||
@@ -3541,12 +3605,38 @@ echo send
|
||||
dig_with_opts +noall +answer @10.53.0.2 cdnskey cdnskey-kskonly.secure > dig.out.test$n
|
||||
lines=$(awk '$4 == "RRSIG" && $5 == "CDNSKEY" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk -v id="${keyid}" '$4 == "RRSIG" && $5 == "CDNSKEY" && $11 == id {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk '$4 == "CDNSKEY" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "check that CDNSKEY deletion records are signed only using KSK when added by"
|
||||
echo_i " nsupdate when dnssec-dnskey-kskonly is yes ($n)"
|
||||
ret=0
|
||||
keyid=$(cat ns2/cdnskey-kskonly.secure.id)
|
||||
(
|
||||
echo zone cdnskey-kskonly.secure
|
||||
echo server 10.53.0.2 "$PORT"
|
||||
echo update delete cdnskey-kskonly.secure CDNSKEY
|
||||
echo update add cdnskey-kskonly.secure 0 CDNSKEY 0 3 0 AA==
|
||||
echo send
|
||||
) | $NSUPDATE
|
||||
dig_with_opts +noall +answer @10.53.0.2 cdnskey cdnskey-kskonly.secure > dig.out.test$n
|
||||
lines=$(awk '$4 == "RRSIG" && $5 == "CDNSKEY" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk -v id="${keyid}" '$4 == "RRSIG" && $5 == "CDNSKEY" && $11 == id {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(awk '$4 == "CDNSKEY" {print}' dig.out.test$n | wc -l)
|
||||
test "$lines" -eq 1 || ret=1
|
||||
lines=$(tr -d '\r' < dig.out.test$n | awk '$4 == "CDNSKEY" && $5 == "0" && $6 == "3" && $7 == "0" && $8 == "AA==" {print}' | wc -l)
|
||||
test "${lines:-10}" -eq 1 || ret=1
|
||||
n=$((n+1))
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
echo_i "checking initialization with a revoked managed key ($n)"
|
||||
ret=0
|
||||
copy_setports ns5/named2.conf.in ns5/named.conf
|
||||
|
||||
@@ -120,8 +120,7 @@ dyndb_init(isc_mem_t *mctx, const char *name, const char *parameters,
|
||||
*instp = sample_inst;
|
||||
|
||||
cleanup:
|
||||
if (s != NULL)
|
||||
isc_mem_free(mctx, s);
|
||||
isc_mem_free(mctx, s);
|
||||
if (argv != NULL)
|
||||
isc_mem_put(mctx, argv, argc * sizeof(*argv));
|
||||
|
||||
|
||||
@@ -107,6 +107,16 @@ zone "pregenerated.kasp" {
|
||||
dnssec-policy "rsasha1";
|
||||
};
|
||||
|
||||
/*
|
||||
* A configured dnssec-policy with one rumoured key.
|
||||
* Bugfix case for GL #1593.
|
||||
*/
|
||||
zone "rumoured.kasp" {
|
||||
type master;
|
||||
file "rumoured.kasp.db";
|
||||
dnssec-policy "rsasha1";
|
||||
};
|
||||
|
||||
/*
|
||||
* Different algorithms.
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ U="UNRETENTIVE"
|
||||
# Set up zones that will be initially signed.
|
||||
#
|
||||
for zn in default rsasha1 dnssec-keygen some-keys legacy-keys pregenerated \
|
||||
rsasha1-nsec3 rsasha256 rsasha512 ecdsa256 ecdsa384 inherit
|
||||
rumoured rsasha1-nsec3 rsasha256 rsasha512 ecdsa256 ecdsa384 inherit
|
||||
do
|
||||
setup "${zn}.kasp"
|
||||
cp template.db.in "$zonefile"
|
||||
@@ -72,6 +72,16 @@ zone="pregenerated.kasp"
|
||||
$KEYGEN -k rsasha1 -l policies/kasp.conf $zone > keygen.out.$zone.1 2>&1
|
||||
$KEYGEN -k rsasha1 -l policies/kasp.conf $zone > keygen.out.$zone.2 2>&1
|
||||
|
||||
zone="rumoured.kasp"
|
||||
Tpub="now"
|
||||
Tact="now+1d"
|
||||
KSK=$($KEYGEN -a RSASHA1 -f KSK -L 1234 $zone 2> keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA1 -b 2000 -L 1234 $zone 2> keygen.out.$zone.2)
|
||||
ZSK2=$($KEYGEN -a RSASHA1 -L 1234 $zone 2> keygen.out.$zone.3)
|
||||
$SETTIME -s -P $Tpub -A $Tact -g $O -k $R $Tpub -r $R $Tpub -d $H $Tpub "$KSK" > settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -P $Tpub -A $Tact -g $O -k $R $Tpub -z $R $Tpub "$ZSK1" > settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -P $Tpub -A $Tact -g $O -k $R $Tpub -z $R $Tpub "$ZSK2" > settime.out.$zone.2 2>&1
|
||||
|
||||
#
|
||||
# Set up zones that are already signed.
|
||||
#
|
||||
|
||||
@@ -855,7 +855,7 @@ check_signatures() {
|
||||
response_has_cds_for_key() (
|
||||
awk -v zone="${ZONE%%.}." \
|
||||
-v ttl="${DNSKEY_TTL}" \
|
||||
-v qtype="${_qtype}" \
|
||||
-v qtype="CDS" \
|
||||
-v keyid="$(key_get "${1}" ID)" \
|
||||
-v keyalg="${_key_algnum}" \
|
||||
-v hashalg="2" \
|
||||
@@ -865,37 +865,70 @@ response_has_cds_for_key() (
|
||||
"$2"
|
||||
)
|
||||
|
||||
response_has_cdnskey_for_key() (
|
||||
awk -v zone="${ZONE%%.}." \
|
||||
-v ttl="${DNSKEY_TTL}" \
|
||||
-v qtype="CDNSKEY" \
|
||||
-v flags="257" \
|
||||
-v keyalg="${_key_algnum}" \
|
||||
'BEGIN { ret=1; }
|
||||
$1 == zone && $2 == ttl && $4 == qtype && $5 == flags && $7 == keyalg { ret=0; exit; }
|
||||
END { exit ret; }' \
|
||||
"$2"
|
||||
)
|
||||
|
||||
# Test CDS and CDNSKEY publication.
|
||||
check_cds() {
|
||||
|
||||
_qtype="CDS"
|
||||
_key_algnum="$(key_get KEY1 ALG_NUM)"
|
||||
|
||||
n=$((n+1))
|
||||
echo_i "check ${_qtype} rrset is signed correctly for zone ${ZONE} ($n)"
|
||||
echo_i "check CDS and CDNSKEY rrset are signed correctly for zone ${ZONE} ($n)"
|
||||
ret=0
|
||||
dig_with_opts "$ZONE" "@${SERVER}" $_qtype > "dig.out.$DIR.test$n" || log_error "dig ${ZONE} ${_qtype} failed"
|
||||
grep "status: NOERROR" "dig.out.$DIR.test$n" > /dev/null || log_error "mismatch status in DNS response"
|
||||
|
||||
dig_with_opts "$ZONE" "@${SERVER}" "CDS" > "dig.out.$DIR.test$n.cds" || log_error "dig ${ZONE} CDS failed"
|
||||
grep "status: NOERROR" "dig.out.$DIR.test$n.cds" > /dev/null || log_error "mismatch status in DNS response"
|
||||
|
||||
dig_with_opts "$ZONE" "@${SERVER}" "CDNSKEY" > "dig.out.$DIR.test$n.cdnskey" || log_error "dig ${ZONE} CDNSKEY failed"
|
||||
grep "status: NOERROR" "dig.out.$DIR.test$n.cdnskey" > /dev/null || log_error "mismatch status in DNS response"
|
||||
|
||||
if [ "$(key_get KEY1 STATE_DS)" = "rumoured" ] || [ "$(key_get KEY1 STATE_DS)" = "omnipresent" ]; then
|
||||
response_has_cds_for_key KEY1 "dig.out.$DIR.test$n" || log_error "missing ${_qtype} record in response for key $(key_get KEY1 ID)"
|
||||
check_signatures $_qtype "dig.out.$DIR.test$n" "KSK"
|
||||
response_has_cds_for_key KEY1 "dig.out.$DIR.test$n.cds" || log_error "missing CDS record in response for key $(key_get KEY1 ID)"
|
||||
check_signatures "CDS" "dig.out.$DIR.test$n.cds" "KSK"
|
||||
response_has_cdnskey_for_key KEY1 "dig.out.$DIR.test$n.cdnskey" || log_error "missing CDNSKEY record in response for key $(key_get KEY1 ID)"
|
||||
check_signatures "CDNSKEY" "dig.out.$DIR.test$n.cdnskey" "KSK"
|
||||
elif [ "$(key_get KEY1 EXPECT)" = "yes" ]; then
|
||||
response_has_cds_for_key KEY1 "dig.out.$DIR.test$n" && log_error "unexpected ${_qtype} record in response for key $(key_get KEY1 ID)"
|
||||
response_has_cds_for_key KEY1 "dig.out.$DIR.test$n.cds" && log_error "unexpected CDS record in response for key $(key_get KEY1 ID)"
|
||||
# KEY1 should not have an associated CDNSKEY, but there may be
|
||||
# one for another key. Since the CDNSKEY has no field for key
|
||||
# id, it is hard to check what key the CDNSKEY may belong to
|
||||
# so let's skip this check for now.
|
||||
fi
|
||||
|
||||
if [ "$(key_get KEY2 STATE_DS)" = "rumoured" ] || [ "$(key_get KEY2 STATE_DS)" = "omnipresent" ]; then
|
||||
response_has_cds_for_key KEY2 "dig.out.$DIR.test$n" || log_error "missing ${_qtype} record in response for key $(key_get KEY2 ID)"
|
||||
check_signatures $_qtype "dig.out.$DIR.test$n" "KSK"
|
||||
response_has_cds_for_key KEY2 "dig.out.$DIR.test$n.cds" || log_error "missing CDS record in response for key $(key_get KEY2 ID)"
|
||||
check_signatures "CDS" "dig.out.$DIR.test$n.cds" "KSK"
|
||||
response_has_cdnskey_for_key KEY2 "dig.out.$DIR.test$n.cdnskey" || log_error "missing CDNSKEY record in response for key $(key_get KEY2 ID)"
|
||||
check_signatures "CDNSKEY" "dig.out.$DIR.test$n.cdnskey" "KSK"
|
||||
elif [ "$(key_get KEY2 EXPECT)" = "yes" ]; then
|
||||
response_has_cds_for_key KEY2 "dig.out.$DIR.test$n" && log_error "unexpected ${_qtype} record in response for key $(key_get KEY2 ID)"
|
||||
response_has_cds_for_key KEY2 "dig.out.$DIR.test$n.cds" && log_error "unexpected CDS record in response for key $(key_get KEY2 ID)"
|
||||
# KEY2 should not have an associated CDNSKEY, but there may be
|
||||
# one for another key. Since the CDNSKEY has no field for key
|
||||
# id, it is hard to check what key the CDNSKEY may belong to
|
||||
# so let's skip this check for now.
|
||||
fi
|
||||
|
||||
if [ "$(key_get KEY3 STATE_DS)" = "rumoured" ] || [ "$(key_get KEY3 STATE_DS)" = "omnipresent" ]; then
|
||||
response_has_cds_for_key KEY3 "dig.out.$DIR.test$n" || log_error "missing ${_qtype} record in response for key $(key_get KEY3 ID)"
|
||||
check_signatures $_qtype "dig.out.$DIR.test$n" "KSK"
|
||||
response_has_cds_for_key KEY3 "dig.out.$DIR.test$n.cds" || log_error "missing CDS record in response for key $(key_get KEY3 ID)"
|
||||
check_signatures "CDS" "dig.out.$DIR.test$n.cds" "KSK"
|
||||
response_has_cdnskey_for_key KEY3 "dig.out.$DIR.test$n.cdnskey" || log_error "missing CDNSKEY record in response for key $(key_get KEY3 ID)"
|
||||
check_signatures "CDNSKEY" "dig.out.$DIR.test$n.cdnskey" "KSK"
|
||||
elif [ "$(key_get KEY3 EXPECT)" = "yes" ]; then
|
||||
response_has_cds_for_key KEY3 "dig.out.$DIR.test$n" && log_error "unexpected ${_qtype} record in response for key $(key_get KEY3 ID)"
|
||||
response_has_cds_for_key KEY3 "dig.out.$DIR.test$n.cds" && log_error "unexpected CDS record in response for key $(key_get KEY3 ID)"
|
||||
# KEY3 should not have an associated CDNSKEY, but there may be
|
||||
# one for another key. Since the CDNSKEY has no field for key
|
||||
# id, it is hard to check what key the CDNSKEY may belong to
|
||||
# so let's skip this check for now.
|
||||
fi
|
||||
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
@@ -957,7 +990,7 @@ check_apex() {
|
||||
test "$ret" -eq 0 || echo_i "failed"
|
||||
status=$((status+ret))
|
||||
|
||||
# Test CDS publication.
|
||||
# Test CDS and CDNSKEY publication.
|
||||
check_cds
|
||||
}
|
||||
|
||||
@@ -1056,6 +1089,17 @@ check_apex
|
||||
check_subdomain
|
||||
dnssec_verify
|
||||
|
||||
#
|
||||
# Zone: rumoured.kasp.
|
||||
#
|
||||
# There are three keys in rumoured state.
|
||||
zone_properties "ns3" "rumoured.kasp" "rsasha1" "1234" "3" "10.53.0.3"
|
||||
# key_properties, key_timings and key_states same as above.
|
||||
check_keys
|
||||
check_apex
|
||||
check_subdomain
|
||||
dnssec_verify
|
||||
|
||||
#
|
||||
# Zone: secondary.kasp.
|
||||
#
|
||||
|
||||
@@ -45,9 +45,10 @@ my $A = "ns.example 300 IN A $localaddr";
|
||||
#
|
||||
# Records to be TTL stretched
|
||||
#
|
||||
my $TXT = "data.example 1 IN TXT \"A text record with a 1 second ttl\"";
|
||||
my $TXT = "data.example 2 IN TXT \"A text record with a 2 second ttl\"";
|
||||
my $LONGTXT = "longttl.example 600 IN TXT \"A text record with a 600 second ttl\"";
|
||||
my $negSOA = "example 1 IN SOA . . 0 0 0 0 300";
|
||||
my $CAA = "othertype.example 2 IN CAA 0 issue \"ca1.example.net\"";
|
||||
my $negSOA = "example 2 IN SOA . . 0 0 0 0 300";
|
||||
|
||||
sub reply_handler {
|
||||
my ($qname, $qclass, $qtype) = @_;
|
||||
@@ -129,6 +130,15 @@ sub reply_handler {
|
||||
my $rr = new Net::DNS::RR($negSOA);
|
||||
push @auth, $rr;
|
||||
$rcode = "NXDOMAIN";
|
||||
} elsif ($qname eq "othertype.example") {
|
||||
if ($qtype eq "CAA") {
|
||||
my $rr = new Net::DNS::RR($CAA);
|
||||
push @ans, $rr;
|
||||
} else {
|
||||
my $rr = new Net::DNS::RR($negSOA);
|
||||
push @auth, $rr;
|
||||
}
|
||||
$rcode = "NOERROR";
|
||||
} else {
|
||||
my $rr = new Net::DNS::RR($SOA);
|
||||
push @auth, $rr;
|
||||
|
||||
@@ -27,7 +27,7 @@ options {
|
||||
listen-on { 10.53.0.1; };
|
||||
listen-on-v6 { none; };
|
||||
recursion yes;
|
||||
max-stale-ttl 35;
|
||||
max-stale-ttl 45;
|
||||
stale-answer-ttl 3;
|
||||
stale-answer-enable yes;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ n=0
|
||||
#$DIG -p ${PORT} @10.53.0.2 data.example TXT
|
||||
#$DIG -p ${PORT} @10.53.0.2 nodata.example TXT
|
||||
#$DIG -p ${PORT} @10.53.0.2 nxdomain.example TXT
|
||||
#$DIG -p ${PORT} @10.53.0.2 othertype.example CAA
|
||||
|
||||
#
|
||||
# First test server with serve-stale options set.
|
||||
@@ -54,6 +55,15 @@ grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "prime cache othertype.example ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "prime cache nodata.example ($n)"
|
||||
ret=0
|
||||
@@ -82,6 +92,7 @@ cp ns1/named.stats ns1/named.stats.$n
|
||||
# Check first 10 lines of Cache DB statistics. After prime queries, we expect
|
||||
# two active TXT one nxrrset TXT, and one NXDOMAIN.
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
|
||||
grep "1 Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "2 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 !TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
@@ -97,7 +108,7 @@ grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check 'rndc serve-stale status' ($n)"
|
||||
@@ -113,19 +124,29 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
# Run rndc dumpdb, test whether the stale data has correct comment printed.
|
||||
# The max-stale-ttl is 3600 seconds, so the comment should say the data is
|
||||
# stale for somewhere between 3500-3599 seconds.
|
||||
rndc_dumpdb ns1 || ret=1
|
||||
awk '/; stale/ { x=$0; getline; print x, $0}' ns1/named_dump.db.test$n |
|
||||
grep "; stale (will be retained for 35.. more seconds) data\.example.*A text record with a 1 second ttl" > /dev/null 2>&1 || ret=1
|
||||
grep "; stale (will be retained for 35.. more seconds) data\.example.*A text record with a 2 second ttl" > /dev/null 2>&1 || ret=1
|
||||
# Also make sure the not expired data does not have a stale comment.
|
||||
awk '/; answer/ { x=$0; getline; print x, $0}' ns1/named_dump.db.test$n |
|
||||
grep "; answer longttl\.example.*A text record with a 600 second ttl" > /dev/null 2>&1 || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale othertype.example ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale nodata.example ($n)"
|
||||
ret=0
|
||||
@@ -158,6 +179,7 @@ cp ns1/named.stats ns1/named.stats.$n
|
||||
# stale NXDOMAIN.
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
|
||||
grep "1 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #!TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
@@ -189,6 +211,14 @@ status=`expr $status + $ret`
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale othertype.example (serve-stale off) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale nodata.example (serve-stale off) ($n)"
|
||||
ret=0
|
||||
@@ -226,7 +256,17 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale othertype.example (serve-stale on) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -273,6 +313,14 @@ grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale othertype.example (serve-stale no) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale nodata.example (serve-stale no) ($n)"
|
||||
ret=0
|
||||
@@ -310,7 +358,17 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale othertype.example (serve-stale yes) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -362,7 +420,17 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale othertype.example (serve-stale reset) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "othertype.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -425,7 +493,7 @@ n=`expr $n + 1`
|
||||
echo_i "check 'rndc serve-stale status' ($n)"
|
||||
ret=0
|
||||
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
|
||||
grep '_default: off (rndc) (stale-answer-ttl=3 max-stale-ttl=35)' rndc.out.test$n > /dev/null || ret=1
|
||||
grep '_default: off (rndc) (stale-answer-ttl=3 max-stale-ttl=45)' rndc.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -444,7 +512,7 @@ n=`expr $n + 1`
|
||||
echo_i "check 'rndc serve-stale status' ($n)"
|
||||
ret=0
|
||||
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
|
||||
grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=35)' rndc.out.test$n > /dev/null || ret=1
|
||||
grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=45)' rndc.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -457,7 +525,7 @@ grep "TXT.\"1\"" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "prime cache longttl.example (low max-stale-ttl) ($n)"
|
||||
@@ -477,6 +545,15 @@ grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "prime cache othertype.example (low max-stale-ttl) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "prime cache nodata.example (low max-stale-ttl) ($n)"
|
||||
ret=0
|
||||
@@ -506,6 +583,7 @@ cp ns1/named.stats ns1/named.stats.$n
|
||||
# two active TXT RRsets, one nxrrset TXT, and one NXDOMAIN.
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
|
||||
grep "2 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 !TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
status=`expr $status + $ret`
|
||||
@@ -520,7 +598,7 @@ grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale data.example (low max-stale-ttl) ($n)"
|
||||
@@ -528,7 +606,17 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*3.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*3.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check stale othertype.example (low max-stale-ttl) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "othertype\.example\..*3.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -565,12 +653,14 @@ cp ns1/named.stats ns1/named.stats.$n
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
|
||||
grep "1 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #!TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
|
||||
status=`expr $status + $ret`
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check ancient data.example (low max-stale-ttl) ($n)"
|
||||
@@ -581,6 +671,15 @@ grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check ancient othertype.example (low max-stale-ttl) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
|
||||
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check ancient nodata.example (low max-stale-ttl) ($n)"
|
||||
ret=0
|
||||
@@ -628,7 +727,17 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*1.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "prime cache othertype.example (max-stale-ttl default) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.3 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -638,7 +747,7 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*1.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*2.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -648,7 +757,7 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
|
||||
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*1.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*2.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -663,6 +772,7 @@ cp ns3/named.stats ns3/named.stats.$n
|
||||
# two active TXT RRsets, one nxrrset TXT, and one NXDOMAIN.
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns3/named.stats.$n > ns3/named.stats.$n.cachedb || ret=1
|
||||
grep "2 TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 Others" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 !TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 NXDOMAIN" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
status=`expr $status + $ret`
|
||||
@@ -677,7 +787,7 @@ grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check 'rndc serve-stale status' ($n)"
|
||||
@@ -696,6 +806,15 @@ grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check fail of othertype.example (max-stale-ttl default) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.3 othertype.example CAA > dig.out.test$n
|
||||
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check fail of nodata.example (max-stale-ttl default) ($n)"
|
||||
ret=0
|
||||
@@ -727,8 +846,10 @@ cp ns3/named.stats ns3/named.stats.$n
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns3/named.stats.$n > ns3/named.stats.$n.cachedb || ret=1
|
||||
grep "1 TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #Others" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #!TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #NXDOMAIN" ns3/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
|
||||
status=`expr $status + $ret`
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
|
||||
@@ -753,7 +874,17 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*1.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*1.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check othertype.example (max-stale-ttl default) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.3 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*1.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -806,7 +937,17 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.4 data.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*1.*IN.*TXT.*A text record with a 1 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
grep "data\.example\..*2.*IN.*TXT.*A text record with a 2 second ttl" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "prime cache othertype.example (serve-stale disabled) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.4 othertype.example CAA > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
|
||||
grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -816,7 +957,7 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.4 nodata.example TXT > dig.out.test$n
|
||||
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*1.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*2.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -826,7 +967,7 @@ ret=0
|
||||
$DIG -p ${PORT} @10.53.0.4 nxdomain.example TXT > dig.out.test$n
|
||||
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*1.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
grep "example\..*2.*IN.*SOA" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -841,6 +982,7 @@ cp ns4/named.stats ns4/named.stats.$n
|
||||
# two active TXT RRsets, one nxrrset TXT, and one NXDOMAIN.
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns4/named.stats.$n > ns4/named.stats.$n.cachedb || ret=1
|
||||
grep "2 TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 Others" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 !TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 NXDOMAIN" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
status=`expr $status + $ret`
|
||||
@@ -855,7 +997,7 @@ grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check 'rndc serve-stale status' ($n)"
|
||||
@@ -874,6 +1016,15 @@ grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check fail of othertype.example (serve-stale disabled) ($n)"
|
||||
ret=0
|
||||
$DIG -p ${PORT} @10.53.0.4 othertype.example CAA > dig.out.test$n
|
||||
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
|
||||
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "check fail of nodata.example (serve-stale disabled) ($n)"
|
||||
ret=0
|
||||
@@ -905,6 +1056,7 @@ cp ns4/named.stats ns4/named.stats.$n
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns4/named.stats.$n > ns4/named.stats.$n.cachedb || ret=1
|
||||
grep "1 TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #Others" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #!TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
grep "1 #NXDOMAIN" ns4/named.stats.$n.cachedb > /dev/null || ret=1
|
||||
status=`expr $status + $ret`
|
||||
@@ -947,7 +1099,7 @@ status=`expr $status + $ret`
|
||||
echo_i "start ns4"
|
||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} serve-stale ns4
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "verify ancient cache statistics (serve-stale disabled) ($n)"
|
||||
@@ -960,6 +1112,7 @@ cp ns4/named.stats ns4/named.stats.$n
|
||||
# everything to be removed or scheduled to be removed.
|
||||
grep -A 10 "++ Cache DB RRsets ++" ns4/named.stats.$n > ns4/named.stats.$n.cachedb || ret=1
|
||||
grep "#TXT" ns4/named.stats.$n.cachedb > /dev/null && ret=1
|
||||
grep "#Others" ns4/named.stats.$n.cachedb > /dev/null && ret=1
|
||||
grep "#!TXT" ns4/named.stats.$n.cachedb > /dev/null && ret=1
|
||||
grep "#NXDOMAIN" ns4/named.stats.$n.cachedb > /dev/null && ret=1
|
||||
status=`expr $status + $ret`
|
||||
|
||||
@@ -175,8 +175,7 @@ main(int argc, char *argv[]) {
|
||||
} else
|
||||
f = stdin;
|
||||
|
||||
result = isc_buffer_allocate(mctx, &input, 64 * 1024);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(mctx, &input, 64 * 1024);
|
||||
|
||||
if (rawdata) {
|
||||
while (fread(&c, 1, 1, f) != 0) {
|
||||
|
||||
+3
-7
@@ -309,8 +309,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
|
||||
if (!display_comments)
|
||||
flags |= DNS_MESSAGETEXTFLAG_NOCOMMENTS;
|
||||
|
||||
result = isc_buffer_allocate(mctx, &buf, len);
|
||||
CHECK("isc_buffer_allocate", result);
|
||||
isc_buffer_allocate(mctx, &buf, len);
|
||||
|
||||
if (yaml) {
|
||||
char sockstr[ISC_SOCKADDR_FORMATSIZE];
|
||||
@@ -416,11 +415,8 @@ repopulate_buffer:
|
||||
buftoosmall:
|
||||
len += OUTPUTBUF;
|
||||
isc_buffer_free(&buf);
|
||||
result = isc_buffer_allocate(mctx, &buf, len);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
goto repopulate_buffer;
|
||||
else
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(mctx, &buf, len);
|
||||
goto repopulate_buffer;
|
||||
}
|
||||
CHECK("dns_message_pseudosectiontotext", result);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
@@
|
||||
statement S;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- if (V != ISC_R_SUCCESS) S
|
||||
|
||||
@@
|
||||
statement S1, S2;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- if (V == ISC_R_SUCCESS)
|
||||
S1
|
||||
- else S2
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- check_result(V, ...);
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- CHECK(
|
||||
isc_buffer_allocate(...)
|
||||
- )
|
||||
;
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- DO(...,
|
||||
isc_buffer_allocate(...)
|
||||
- )
|
||||
;
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- RETERR(
|
||||
isc_buffer_allocate(...)
|
||||
- )
|
||||
;
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- assert_int_equal(V, ISC_R_SUCCESS);
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- CHECK(..., V);
|
||||
|
||||
@@
|
||||
expression V;
|
||||
statement S;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- if (ISC_UNLIKELY(V != ISC_R_SUCCESS)) S
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- RUNTIME_CHECK(V == ISC_R_SUCCESS);
|
||||
@@ -0,0 +1,49 @@
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_mempool_create(...);
|
||||
- assert_int_equal(V, ISC_R_SUCCESS);
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_mempool_create(...);
|
||||
- check_result(V, ...);
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- CHECK(
|
||||
isc_mempool_create(...)
|
||||
- )
|
||||
;
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- RUNTIME_CHECK(
|
||||
isc_mempool_create(...)
|
||||
- == ISC_R_SUCCESS)
|
||||
;
|
||||
|
||||
@@
|
||||
expression V;
|
||||
statement S;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_mempool_create(...);
|
||||
- if (V != ISC_R_SUCCESS) S
|
||||
|
||||
@@
|
||||
statement S;
|
||||
@@
|
||||
|
||||
- if (
|
||||
isc_mempool_create(...)
|
||||
- != ISC_R_SUCCESS) S
|
||||
+ ;
|
||||
@@ -471,6 +471,9 @@
|
||||
/* Define to 1 if you have the `uv_handle_set_data' function. */
|
||||
#undef HAVE_UV_HANDLE_SET_DATA
|
||||
|
||||
/* Define to 1 if you have the `uv_import' function. */
|
||||
#undef HAVE_UV_IMPORT
|
||||
|
||||
/* Use zlib library */
|
||||
#undef HAVE_ZLIB
|
||||
|
||||
|
||||
@@ -355,6 +355,15 @@ typedef __int64 off_t;
|
||||
/* Define to 1 if you have the `HMAC_CTX_reset' function. */
|
||||
@HAVE_HMAC_CTX_RESET@
|
||||
|
||||
/* Define to 1 if you have the `uv_handle_get_data' function. */
|
||||
@HAVE_UV_HANDLE_GET_DATA@
|
||||
|
||||
/* Define to 1 if you have the `uv_handle_set_data' function. */
|
||||
@HAVE_UV_HANDLE_SET_DATA@
|
||||
|
||||
/* Define to 1 if you have the `uv_import' function. */
|
||||
@HAVE_UV_IMPORT@
|
||||
|
||||
/*
|
||||
* Define to nothing if C supports flexible array members, and to 1 if it does
|
||||
* not. That way, with a declaration like `struct s { int n; double
|
||||
|
||||
@@ -852,6 +852,7 @@ infodir
|
||||
docdir
|
||||
oldincludedir
|
||||
includedir
|
||||
runstatedir
|
||||
localstatedir
|
||||
sharedstatedir
|
||||
sysconfdir
|
||||
@@ -1025,6 +1026,7 @@ datadir='${datarootdir}'
|
||||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
runstatedir='${localstatedir}/run'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||
@@ -1277,6 +1279,15 @@ do
|
||||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||
| --run | --ru | --r)
|
||||
ac_prev=runstatedir ;;
|
||||
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||
| --run=* | --ru=* | --r=*)
|
||||
runstatedir=$ac_optarg ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
@@ -1414,7 +1425,7 @@ fi
|
||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||
libdir localedir mandir
|
||||
libdir localedir mandir runstatedir
|
||||
do
|
||||
eval ac_val=\$$ac_var
|
||||
# Remove trailing slashes.
|
||||
@@ -1567,6 +1578,7 @@ Fine tuning of the installation directories:
|
||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||
@@ -4011,7 +4023,7 @@ else
|
||||
We can't simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
|
||||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
|
||||
&& LARGE_OFF_T % 2147483647 == 1)
|
||||
? 1 : -1];
|
||||
@@ -4057,7 +4069,7 @@ else
|
||||
We can't simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
|
||||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
|
||||
&& LARGE_OFF_T % 2147483647 == 1)
|
||||
? 1 : -1];
|
||||
@@ -4081,7 +4093,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
We can't simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
|
||||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
|
||||
&& LARGE_OFF_T % 2147483647 == 1)
|
||||
? 1 : -1];
|
||||
@@ -4126,7 +4138,7 @@ else
|
||||
We can't simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
|
||||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
|
||||
&& LARGE_OFF_T % 2147483647 == 1)
|
||||
? 1 : -1];
|
||||
@@ -4150,7 +4162,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
We can't simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
|
||||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
|
||||
&& LARGE_OFF_T % 2147483647 == 1)
|
||||
? 1 : -1];
|
||||
@@ -15582,8 +15594,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS -lck $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS -I/usr/include/ck"
|
||||
CC="$PTHREAD_CC"
|
||||
|
||||
for ac_func in pthread_attr_getstacksize pthread_attr_setstacksize
|
||||
@@ -15948,7 +15960,7 @@ LIBS="$LIBS $LIBUV_LIBS"
|
||||
|
||||
# Those functions are only provided in newer versions of libuv, we'll be emulating them
|
||||
# for now
|
||||
for ac_func in uv_handle_get_data uv_handle_set_data
|
||||
for ac_func in uv_handle_get_data uv_handle_set_data uv_import
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
@@ -16070,10 +16082,6 @@ $as_echo "#define USE_PTHREAD_RWLOCK 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
if test "$enable_pthread_rwlock" = "yes" -a "$enable_developer" != "yes"; then :
|
||||
as_fn_error $? "pthread rwlock is not meant used in production and the developer mode must be enabled" "$LINENO" 5
|
||||
fi
|
||||
|
||||
CRYPTO=OpenSSL
|
||||
|
||||
#
|
||||
|
||||
+3
-6
@@ -607,8 +607,8 @@ AC_CHECK_FUNCS(arc4random arc4random_buf arc4random_uniform getrandom)
|
||||
|
||||
AX_PTHREAD
|
||||
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS -lck $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS -I/usr/include/ck"
|
||||
CC="$PTHREAD_CC"
|
||||
|
||||
AC_CHECK_FUNCS([pthread_attr_getstacksize pthread_attr_setstacksize])
|
||||
@@ -667,7 +667,7 @@ LIBS="$LIBS $LIBUV_LIBS"
|
||||
|
||||
# Those functions are only provided in newer versions of libuv, we'll be emulating them
|
||||
# for now
|
||||
AC_CHECK_FUNCS([uv_handle_get_data uv_handle_set_data])
|
||||
AC_CHECK_FUNCS([uv_handle_get_data uv_handle_set_data uv_import])
|
||||
|
||||
#
|
||||
# flockfile is usually provided by pthreads
|
||||
@@ -729,9 +729,6 @@ AS_IF([test "$enable_pthread_rwlock" = "yes"],
|
||||
AC_DEFINE([USE_PTHREAD_RWLOCK],[1],[Define if you want to use pthread rwlock implementation])
|
||||
])
|
||||
|
||||
AS_IF([test "$enable_pthread_rwlock" = "yes" -a "$enable_developer" != "yes"],
|
||||
[AC_MSG_ERROR([pthread rwlock is not meant used in production and the developer mode must be enabled])])
|
||||
|
||||
CRYPTO=OpenSSL
|
||||
|
||||
#
|
||||
|
||||
@@ -157,7 +157,7 @@ is_safe(const char *input) {
|
||||
return (true);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
static void
|
||||
create_path_helper(char *out, const char *in, config_data_t *cd) {
|
||||
char *tmpString;
|
||||
char *tmpPtr;
|
||||
@@ -206,7 +206,6 @@ create_path_helper(char *out, const char *in, config_data_t *cd) {
|
||||
}
|
||||
|
||||
isc_mem_free(named_g_mctx, tmpString);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*%
|
||||
@@ -223,7 +222,6 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
char *tmpPath;
|
||||
int pathsize;
|
||||
int len;
|
||||
isc_result_t result;
|
||||
bool isroot = false;
|
||||
|
||||
/* we require a zone & cd parameter */
|
||||
@@ -285,9 +283,7 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
|
||||
/* add zone name - parsed properly */
|
||||
if (!isroot) {
|
||||
result = create_path_helper(tmpPath, zone, cd);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup_mem;
|
||||
create_path_helper(tmpPath, zone, cd);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -322,26 +318,13 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
/* if host not null, add it. */
|
||||
if (host != NULL) {
|
||||
strncat(tmpPath, (char *) &cd->pathsep, 1);
|
||||
if ((result = create_path_helper(tmpPath, host,
|
||||
cd)) != ISC_R_SUCCESS)
|
||||
goto cleanup_mem;
|
||||
create_path_helper(tmpPath, host, cd);
|
||||
}
|
||||
|
||||
/* return the path we built. */
|
||||
*path = tmpPath;
|
||||
|
||||
/* return success */
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
cleanup_mem:
|
||||
/* cleanup memory */
|
||||
|
||||
/* free tmpPath memory */
|
||||
if (tmpPath != NULL && result != ISC_R_SUCCESS)
|
||||
isc_mem_free(named_g_mctx, tmpPath);
|
||||
|
||||
/* free tmpPath memory */
|
||||
return (result);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -705,19 +688,18 @@ fs_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
} /* end while */
|
||||
|
||||
complete_allnds:
|
||||
if (dir_list != NULL) {
|
||||
/* clean up entries from list. */
|
||||
dir_entry = ISC_LIST_HEAD(*dir_list);
|
||||
while (dir_entry != NULL) {
|
||||
next_de = ISC_LIST_NEXT(dir_entry, link);
|
||||
isc_mem_put(named_g_mctx, dir_entry, sizeof(dir_entry_t));
|
||||
dir_entry = next_de;
|
||||
} /* end while */
|
||||
isc_mem_put(named_g_mctx, dir_list, sizeof(dlist_t));
|
||||
}
|
||||
/* clean up entries from list. */
|
||||
dir_entry = ISC_LIST_HEAD(*dir_list);
|
||||
while (dir_entry != NULL) {
|
||||
next_de = ISC_LIST_NEXT(dir_entry, link);
|
||||
isc_mem_put(named_g_mctx, dir_entry, sizeof(dir_entry_t));
|
||||
dir_entry = next_de;
|
||||
} /* end while */
|
||||
isc_mem_put(named_g_mctx, dir_list, sizeof(dlist_t));
|
||||
|
||||
if (basepath != NULL)
|
||||
if (basepath != NULL) {
|
||||
isc_mem_free(named_g_mctx, basepath);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -254,8 +254,7 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
|
||||
|
||||
flag_fail:
|
||||
/* get rid of what was build of the query list */
|
||||
if (tql != NULL)
|
||||
destroy_querylist(mctx, &tql);
|
||||
destroy_querylist(mctx, &tql);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
# catzhash.py: generate the SHA-1 hash of a domain name in wire format.
|
||||
#
|
||||
# This can be used to determine the label to use in a catalog zone to
|
||||
# represent the specified zone. For example, the zone
|
||||
# "domain.example" can be represented in a catalog zone called
|
||||
# "catalog.example" by adding the following record:
|
||||
#
|
||||
# 5960775ba382e7a4e09263fc06e7c00569b6a05c.zones.catalog.example. IN PTR domain.example.
|
||||
#
|
||||
# The label "5960775ba382e7a4e09263fc06e7c00569b6a05c" is the output of
|
||||
# this script when run with the argument "domain.example".
|
||||
|
||||
import sys
|
||||
import dns.name
|
||||
import hashlib
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: %s name" % sys.argv[0])
|
||||
|
||||
print (hashlib.sha1(dns.name.from_text(sys.argv[1]).to_wire()).hexdigest())
|
||||
@@ -6866,9 +6866,11 @@ options {
|
||||
<term><command>forwarders</command></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies the IP addresses to be used
|
||||
for forwarding. The default is the empty list (no
|
||||
forwarding).
|
||||
Specifies a list of IP addresses to which queries shall be
|
||||
forwarded. The default is the empty list (no forwarding).
|
||||
Each address in the list can be associated with an optional
|
||||
port number and/or DSCP value, and a default port number and
|
||||
DSCP value can be set for the entire list.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
target = target ? target + 1 : argv[0];
|
||||
target = (target != NULL) ? target + 1 : argv[0];
|
||||
if (strncmp(target, "lt-", 3) == 0) {
|
||||
target += 3;
|
||||
}
|
||||
|
||||
+2
-2
@@ -77,7 +77,7 @@ DNSOBJS = acl.@O@ adb.@O@ badcache.@O@ byaddr.@O@ \
|
||||
stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \
|
||||
tsec.@O@ tsig.@O@ ttl.@O@ update.@O@ validator.@O@ \
|
||||
version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ \
|
||||
zoneverify.@O@ zt.@O@
|
||||
zoneverify.@O@ zt.@O@ lowac.@O@
|
||||
PORTDNSOBJS = client.@O@ ecdb.@O@
|
||||
|
||||
OBJS= @DNSTAPOBJS@ ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} \
|
||||
@@ -112,7 +112,7 @@ DNSSRCS = acl.c adb.c badcache. byaddr.c \
|
||||
stats.c tcpmsg.c time.c timer.c tkey.c \
|
||||
tsec.c tsig.c ttl.c update.c validator.c \
|
||||
version.c view.c xfrin.c zone.c zoneverify.c \
|
||||
zonekey.c zt.c ${OTHERSRCS}
|
||||
zonekey.c zt.c ${OTHERSRCS} lowac.c
|
||||
PORTDNSSRCS = client.c ecdb.c
|
||||
|
||||
SRCS = ${DSTSRCS} ${DNSSRCS} \
|
||||
|
||||
+1
-3
@@ -2646,9 +2646,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr,
|
||||
* Memory pools
|
||||
*/
|
||||
#define MPINIT(t, p, n) do { \
|
||||
result = isc_mempool_create(mem, sizeof(t), &(p)); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto fail2; \
|
||||
isc_mempool_create(mem, sizeof(t), &(p)); \
|
||||
isc_mempool_setfreemax((p), FREE_ITEMS); \
|
||||
isc_mempool_setfillcount((p), FILL_COUNT); \
|
||||
isc_mempool_setname((p), n); \
|
||||
|
||||
+40
-29
@@ -522,8 +522,8 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) {
|
||||
|
||||
dns_name_format(&entry->name, zname, DNS_NAME_FORMATSIZE);
|
||||
result = addzone(entry, target, target->catzs->view,
|
||||
target->catzs->taskmgr,
|
||||
target->catzs->zmm->udata);
|
||||
target->catzs->taskmgr,
|
||||
target->catzs->zmm->udata);
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
|
||||
DNS_LOGMODULE_MASTER, ISC_LOG_INFO,
|
||||
"catz: adding zone '%s' from catalog "
|
||||
@@ -1239,10 +1239,8 @@ catz_process_apl(dns_catz_zone_t *zone, isc_buffer_t **aclbp,
|
||||
result = dns_rdata_tostruct(&rdata, &rdata_apl, zone->catzs->mctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
result = isc_buffer_allocate(zone->catzs->mctx, &aclb, 16);
|
||||
isc_buffer_allocate(zone->catzs->mctx, &aclb, 16);
|
||||
isc_buffer_setautorealloc(aclb, true);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
for (result = dns_rdata_apl_first(&rdata_apl);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdata_apl_next(&rdata_apl)) {
|
||||
@@ -1457,39 +1455,52 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
isc_region_t r;
|
||||
isc_result_t result;
|
||||
size_t rlen;
|
||||
bool special = false;
|
||||
|
||||
REQUIRE(DNS_CATZ_ZONE_VALID(zone));
|
||||
REQUIRE(entry != NULL);
|
||||
REQUIRE(buffer != NULL && *buffer != NULL);
|
||||
|
||||
result = isc_buffer_allocate(zone->catzs->mctx, &tbuf,
|
||||
strlen(zone->catzs->view->name) +
|
||||
2 * DNS_NAME_FORMATSIZE + 2);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
INSIST(tbuf != NULL);
|
||||
isc_buffer_allocate(zone->catzs->mctx, &tbuf,
|
||||
strlen(zone->catzs->view->name) + 2 *
|
||||
DNS_NAME_FORMATSIZE + 2);
|
||||
|
||||
isc_buffer_putstr(tbuf, zone->catzs->view->name);
|
||||
isc_buffer_putstr(tbuf, "_");
|
||||
result = dns_name_totext(&zone->name, true, tbuf);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
isc_buffer_putstr(tbuf, "_");
|
||||
result = dns_name_totext(&entry->name, true, tbuf);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search for slash and other special characters in the view and
|
||||
* zone names. Add a null terminator so we can use strpbrk(), then
|
||||
* remove it.
|
||||
*/
|
||||
isc_buffer_putuint8(tbuf, 0);
|
||||
if (strpbrk(isc_buffer_base(tbuf), "\\/:") != NULL) {
|
||||
special = true;
|
||||
}
|
||||
isc_buffer_subtract(tbuf, 1);
|
||||
|
||||
/* __catz__<digest>.db */
|
||||
rlen = (isc_md_type_get_size(ISC_MD_SHA256) * 2 + 1) + 12;
|
||||
|
||||
/* optionally prepend with <zonedir>/ */
|
||||
if (entry->opts.zonedir != NULL)
|
||||
if (entry->opts.zonedir != NULL) {
|
||||
rlen += strlen(entry->opts.zonedir) + 1;
|
||||
}
|
||||
|
||||
result = isc_buffer_reserve(buffer, (unsigned int)rlen);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (entry->opts.zonedir != NULL) {
|
||||
isc_buffer_putstr(*buffer, entry->opts.zonedir);
|
||||
@@ -1498,9 +1509,10 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
|
||||
isc_buffer_usedregion(tbuf, &r);
|
||||
isc_buffer_putstr(*buffer, "__catz__");
|
||||
if (tbuf->used > ISC_SHA256_DIGESTLENGTH * 2 + 1) {
|
||||
if (special || tbuf->used > ISC_SHA256_DIGESTLENGTH * 2 + 1) {
|
||||
unsigned char digest[ISC_MAX_MD_SIZE];
|
||||
unsigned int digestlen;
|
||||
|
||||
/* we can do that because digest string < 2 * DNS_NAME */
|
||||
result = isc_md(ISC_MD_SHA256, r.base, r.length,
|
||||
digest, &digestlen);
|
||||
@@ -1531,7 +1543,7 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
{
|
||||
/*
|
||||
* We have to generate a text buffer with regular zone config:
|
||||
* zone foo.bar {
|
||||
* zone "foo.bar" {
|
||||
* type slave;
|
||||
* masters [ dscp X ] { ip1 port port1; ip2 port port2; };
|
||||
* }
|
||||
@@ -1552,16 +1564,12 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
* The buffer will be reallocated if something won't fit,
|
||||
* ISC_BUFFER_INCR seems like a good start.
|
||||
*/
|
||||
result = isc_buffer_allocate(zone->catzs->mctx, &buffer,
|
||||
ISC_BUFFER_INCR);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
isc_buffer_allocate(zone->catzs->mctx, &buffer, ISC_BUFFER_INCR);
|
||||
|
||||
isc_buffer_setautorealloc(buffer, true);
|
||||
isc_buffer_putstr(buffer, "zone ");
|
||||
isc_buffer_putstr(buffer, "zone \"");
|
||||
dns_name_totext(&entry->name, true, buffer);
|
||||
isc_buffer_putstr(buffer, " { type slave; masters");
|
||||
isc_buffer_putstr(buffer, "\" { type slave; masters");
|
||||
|
||||
/*
|
||||
* DSCP value has no default, but when it is specified, it is identical
|
||||
@@ -1569,7 +1577,8 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
* use the DSCP value set for the first master
|
||||
*/
|
||||
if (entry->opts.masters.count > 0 &&
|
||||
entry->opts.masters.dscps[0] >= 0) {
|
||||
entry->opts.masters.dscps[0] >= 0)
|
||||
{
|
||||
isc_buffer_putstr(buffer, " dscp ");
|
||||
snprintf(pbuf, sizeof(pbuf), "%hd",
|
||||
entry->opts.masters.dscps[0]);
|
||||
@@ -1611,8 +1620,9 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
isc_buffer_putstr(buffer, " key ");
|
||||
result = dns_name_totext(entry->opts.masters.keys[i],
|
||||
true, buffer);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
isc_buffer_putstr(buffer, "; ");
|
||||
}
|
||||
@@ -1620,8 +1630,9 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
if (entry->opts.in_memory == false) {
|
||||
isc_buffer_putstr(buffer, "file \"");
|
||||
result = dns_catz_generate_masterfilename(zone, entry, &buffer);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
}
|
||||
isc_buffer_putstr(buffer, "\"; ");
|
||||
|
||||
}
|
||||
@@ -1640,11 +1651,11 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
|
||||
isc_buffer_putstr(buffer, "};");
|
||||
*buf = buffer;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (buffer != NULL)
|
||||
isc_buffer_free(&buffer);
|
||||
isc_buffer_free(&buffer);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
+12
-37
@@ -1340,13 +1340,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
|
||||
ISC_LIST_INIT(event->answerlist);
|
||||
|
||||
rctx = isc_mem_get(mctx, sizeof(*rctx));
|
||||
if (rctx == NULL)
|
||||
result = ISC_R_NOMEMORY;
|
||||
else {
|
||||
isc_mutex_init(&rctx->lock);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mutex_init(&rctx->lock);
|
||||
|
||||
result = getrdataset(mctx, &rdataset);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
@@ -1399,8 +1393,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
|
||||
isc_mutex_destroy(&rctx->lock);
|
||||
isc_mem_put(mctx, rctx, sizeof(*rctx));
|
||||
}
|
||||
if (event != NULL)
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
isc_task_detach(&tclone);
|
||||
dns_view_detach(&view);
|
||||
|
||||
@@ -1495,7 +1488,6 @@ dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_view_t *view = NULL;
|
||||
dst_key_t *dstkey = NULL;
|
||||
dns_keytable_t *secroots = NULL;
|
||||
dns_name_t *name = NULL;
|
||||
char dsbuf[DNS_DS_BUFFERSIZE];
|
||||
@@ -1540,9 +1532,6 @@ dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
CHECK(dns_keytable_add(secroots, false, false, name, &ds));
|
||||
|
||||
cleanup:
|
||||
if (dstkey != NULL) {
|
||||
dst_key_free(&dstkey);
|
||||
}
|
||||
if (view != NULL) {
|
||||
dns_view_detach(&view);
|
||||
}
|
||||
@@ -1748,13 +1737,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
|
||||
action, arg, sizeof(*event));
|
||||
|
||||
ctx = isc_mem_get(client->mctx, sizeof(*ctx));
|
||||
if (ctx == NULL)
|
||||
result = ISC_R_NOMEMORY;
|
||||
else {
|
||||
isc_mutex_init(&ctx->lock);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mutex_init(&ctx->lock);
|
||||
|
||||
ctx->client = client;
|
||||
ISC_LINK_INIT(ctx, link);
|
||||
@@ -1787,16 +1770,13 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
|
||||
|
||||
isc_refcount_decrement(&client->references);
|
||||
|
||||
cleanup:
|
||||
if (ctx != NULL) {
|
||||
LOCK(&client->lock);
|
||||
ISC_LIST_UNLINK(client->reqctxs, ctx, link);
|
||||
UNLOCK(&client->lock);
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
isc_mem_put(client->mctx, ctx, sizeof(*ctx));
|
||||
}
|
||||
if (event != NULL)
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
LOCK(&client->lock);
|
||||
ISC_LIST_UNLINK(client->reqctxs, ctx, link);
|
||||
UNLOCK(&client->lock);
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
isc_mem_put(client->mctx, ctx, sizeof(*ctx));
|
||||
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
isc_task_detach(&tclone);
|
||||
dns_view_detach(&view);
|
||||
|
||||
@@ -2556,9 +2536,7 @@ copy_name(isc_mem_t *mctx, dns_message_t *msg, const dns_name_t *name,
|
||||
result = dns_message_gettempname(msg, &newname);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
result = isc_buffer_allocate(mctx, &namebuf, DNS_NAME_MAXWIRE);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto fail;
|
||||
isc_buffer_allocate(mctx, &namebuf, DNS_NAME_MAXWIRE);
|
||||
dns_name_init(newname, NULL);
|
||||
dns_name_setbuffer(newname, namebuf);
|
||||
dns_message_takebuffer(msg, &namebuf);
|
||||
@@ -2587,10 +2565,7 @@ copy_name(isc_mem_t *mctx, dns_message_t *msg, const dns_name_t *name,
|
||||
goto fail;
|
||||
dns_rdata_toregion(&rdata, &r);
|
||||
rdatabuf = NULL;
|
||||
result = isc_buffer_allocate(mctx, &rdatabuf,
|
||||
r.length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto fail;
|
||||
isc_buffer_allocate(mctx, &rdatabuf, r.length);
|
||||
isc_buffer_putmem(rdatabuf, r.base, r.length);
|
||||
isc_buffer_usedregion(rdatabuf, &r);
|
||||
dns_rdata_init(newrdata);
|
||||
|
||||
+18
-4
@@ -149,6 +149,7 @@ dns_compress_init(dns_compress_t *cctx, int edns, isc_mem_t *mctx) {
|
||||
cctx->mctx = mctx;
|
||||
cctx->count = 0;
|
||||
cctx->allowed = DNS_COMPRESS_ENABLED;
|
||||
cctx->arena_off = 0;
|
||||
|
||||
memset(&cctx->table[0], 0, sizeof(cctx->table));
|
||||
|
||||
@@ -386,6 +387,7 @@ dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
|
||||
uint16_t toffset;
|
||||
unsigned char *tmp;
|
||||
isc_region_t r;
|
||||
bool allocated = false;
|
||||
|
||||
REQUIRE(VALID_CCTX(cctx));
|
||||
REQUIRE(dns_name_isabsolute(name));
|
||||
@@ -407,7 +409,13 @@ dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
|
||||
start = 0;
|
||||
dns_name_toregion(name, &r);
|
||||
length = r.length;
|
||||
tmp = isc_mem_get(cctx->mctx, length);
|
||||
if (cctx->arena_off + length < DNS_COMPRESS_ARENA_SIZE) {
|
||||
tmp = &cctx->arena[cctx->arena_off];
|
||||
cctx->arena_off += length;
|
||||
} else {
|
||||
allocated = true;
|
||||
tmp = isc_mem_get(cctx->mctx, length);
|
||||
}
|
||||
/*
|
||||
* Copy name data to 'tmp' and make 'r' use 'tmp'.
|
||||
*/
|
||||
@@ -446,8 +454,9 @@ dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
|
||||
* 'node->r.base' becomes 'tmp' when start == 0.
|
||||
* Record this by setting 0x8000 so it can be freed later.
|
||||
*/
|
||||
if (start == 0)
|
||||
if (start == 0 && allocated) {
|
||||
toffset |= 0x8000;
|
||||
}
|
||||
node->offset = toffset;
|
||||
dns_name_toregion(&tname, &node->r);
|
||||
dns_name_init(&node->name, NULL);
|
||||
@@ -462,8 +471,13 @@ dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
|
||||
count--;
|
||||
}
|
||||
|
||||
if (start == 0)
|
||||
isc_mem_put(cctx->mctx, tmp, length);
|
||||
if (start == 0) {
|
||||
if (!allocated) {
|
||||
cctx->arena_off -= length;
|
||||
} else {
|
||||
isc_mem_put(cctx->mctx, tmp, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+11
-41
@@ -1762,25 +1762,16 @@ dns_dispatchmgr_create(isc_mem_t *mctx, dns_dispatchmgr_t **mgrp)
|
||||
isc_mutex_init(&mgr->spool_lock);
|
||||
|
||||
mgr->depool = NULL;
|
||||
if (isc_mempool_create(mgr->mctx, sizeof(dns_dispatchevent_t),
|
||||
&mgr->depool) != ISC_R_SUCCESS) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto kill_locks;
|
||||
}
|
||||
isc_mempool_create(mgr->mctx, sizeof(dns_dispatchevent_t),
|
||||
&mgr->depool);
|
||||
|
||||
mgr->rpool = NULL;
|
||||
if (isc_mempool_create(mgr->mctx, sizeof(dns_dispentry_t),
|
||||
&mgr->rpool) != ISC_R_SUCCESS) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto kill_depool;
|
||||
}
|
||||
isc_mempool_create(mgr->mctx, sizeof(dns_dispentry_t),
|
||||
&mgr->rpool);
|
||||
|
||||
mgr->dpool = NULL;
|
||||
if (isc_mempool_create(mgr->mctx, sizeof(dns_dispatch_t),
|
||||
&mgr->dpool) != ISC_R_SUCCESS) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto kill_rpool;
|
||||
}
|
||||
isc_mempool_create(mgr->mctx, sizeof(dns_dispatch_t),
|
||||
&mgr->dpool);
|
||||
|
||||
isc_mempool_setname(mgr->depool, "dispmgr_depool");
|
||||
isc_mempool_setmaxalloc(mgr->depool, 32768);
|
||||
@@ -1835,11 +1826,8 @@ dns_dispatchmgr_create(isc_mem_t *mctx, dns_dispatchmgr_t **mgrp)
|
||||
|
||||
kill_dpool:
|
||||
isc_mempool_destroy(&mgr->dpool);
|
||||
kill_rpool:
|
||||
isc_mempool_destroy(&mgr->rpool);
|
||||
kill_depool:
|
||||
isc_mempool_destroy(&mgr->depool);
|
||||
kill_locks:
|
||||
isc_mutex_destroy(&mgr->spool_lock);
|
||||
isc_mutex_destroy(&mgr->bpool_lock);
|
||||
isc_mutex_destroy(&mgr->dpool_lock);
|
||||
@@ -1986,11 +1974,7 @@ dns_dispatchmgr_setudp(dns_dispatchmgr_t *mgr,
|
||||
mgr->maxbuffers = maxbuffers;
|
||||
}
|
||||
} else {
|
||||
result = isc_mempool_create(mgr->mctx, buffersize, &mgr->bpool);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
UNLOCK(&mgr->buffer_lock);
|
||||
return (result);
|
||||
}
|
||||
isc_mempool_create(mgr->mctx, buffersize, &mgr->bpool);
|
||||
isc_mempool_setname(mgr->bpool, "dispmgr_bpool");
|
||||
isc_mempool_setmaxalloc(mgr->bpool, maxbuffers);
|
||||
isc_mempool_setfreemax(mgr->bpool, maxbuffers);
|
||||
@@ -2009,10 +1993,8 @@ dns_dispatchmgr_setudp(dns_dispatchmgr_t *mgr,
|
||||
UNLOCK(&mgr->buffer_lock);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
result = isc_mempool_create(mgr->mctx, sizeof(dispsocket_t),
|
||||
isc_mempool_create(mgr->mctx, sizeof(dispsocket_t),
|
||||
&mgr->spool);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
|
||||
isc_mempool_setname(mgr->spool, "dispmgr_spool");
|
||||
isc_mempool_setmaxalloc(mgr->spool, maxrequests);
|
||||
@@ -2857,11 +2839,8 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
|
||||
ISC_LIST_INIT(disp->port_table[i]);
|
||||
}
|
||||
|
||||
result = isc_mempool_create(mgr->mctx, sizeof(dispportentry_t),
|
||||
isc_mempool_create(mgr->mctx, sizeof(dispportentry_t),
|
||||
&disp->portpool);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto deallocate_dispatch;
|
||||
}
|
||||
isc_mempool_setname(disp->portpool, "disp_portpool");
|
||||
isc_mempool_setfreemax(disp->portpool, 128);
|
||||
}
|
||||
@@ -2892,12 +2871,8 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
|
||||
sizeof(isc_event_t));
|
||||
|
||||
disp->sepool = NULL;
|
||||
if (isc_mempool_create(mgr->mctx, sizeof(isc_socketevent_t),
|
||||
&disp->sepool) != ISC_R_SUCCESS)
|
||||
{
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto kill_ctlevent;
|
||||
}
|
||||
isc_mempool_create(mgr->mctx, sizeof(isc_socketevent_t),
|
||||
&disp->sepool);
|
||||
|
||||
isc_mutex_init(&disp->sepool_lock);
|
||||
|
||||
@@ -2929,11 +2904,6 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
|
||||
/*
|
||||
* Error returns.
|
||||
*/
|
||||
kill_ctlevent:
|
||||
isc_event_free(&disp->ctlevent);
|
||||
for (i = 0; i < disp->ntasks; i++) {
|
||||
isc_task_detach(&disp->task[i]);
|
||||
}
|
||||
kill_socket:
|
||||
if (disp->socket != NULL) {
|
||||
isc_socket_detach(&disp->socket);
|
||||
|
||||
+3
-6
@@ -257,9 +257,7 @@ dns_dnssec_sign(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
|
||||
*/
|
||||
sig.signature = isc_mem_get(mctx, sig.siglen);
|
||||
|
||||
ret = isc_buffer_allocate(mctx, &databuf, sigsize + 256 + 18);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
goto cleanup_signature;
|
||||
isc_buffer_allocate(mctx, &databuf, sigsize + 256 + 18);
|
||||
|
||||
dns_rdata_init(&tmpsigrdata);
|
||||
ret = dns_rdata_fromstruct(&tmpsigrdata, sig.common.rdclass,
|
||||
@@ -355,7 +353,6 @@ cleanup_context:
|
||||
dst_context_destroy(&ctx);
|
||||
cleanup_databuf:
|
||||
isc_buffer_free(&databuf);
|
||||
cleanup_signature:
|
||||
isc_mem_put(mctx, sig.signature, sig.siglen);
|
||||
|
||||
return (ret);
|
||||
@@ -997,7 +994,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) {
|
||||
|
||||
rdata = NULL;
|
||||
RETERR(dns_message_gettemprdata(msg, &rdata));
|
||||
RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 1024));
|
||||
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
|
||||
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
||||
dns_rdatatype_sig /* SIG(0) */,
|
||||
&sig, dynbuf));
|
||||
@@ -1981,7 +1978,7 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
|
||||
}
|
||||
|
||||
/*
|
||||
* Unconditionaly remove CDS/DNSKEY records for removed keys.
|
||||
* Unconditionally remove CDS/DNSKEY records for removed keys.
|
||||
*/
|
||||
for (key = ISC_LIST_HEAD(*rmkeys);
|
||||
key != NULL;
|
||||
|
||||
+24
-12
@@ -865,8 +865,8 @@ dst_key_fromgssapi(const dns_name_t *name, gss_ctx_id_t gssctx,
|
||||
* Keep the token for use by external ssu rules. They may need
|
||||
* to examine the PAC in the kerberos ticket.
|
||||
*/
|
||||
RETERR(isc_buffer_allocate(key->mctx, &key->key_tkeytoken,
|
||||
intoken->length));
|
||||
isc_buffer_allocate(key->mctx, &key->key_tkeytoken,
|
||||
intoken->length);
|
||||
RETERR(isc_buffer_copyregion(key->key_tkeytoken, intoken));
|
||||
}
|
||||
|
||||
@@ -2336,7 +2336,7 @@ dst_key_is_unused(dst_key_t* key)
|
||||
* This key is used.
|
||||
*/
|
||||
if (!state_type_set) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
/*
|
||||
* If the state is not HIDDEN, the key is in use.
|
||||
@@ -2346,11 +2346,11 @@ dst_key_is_unused(dst_key_t* key)
|
||||
st = DST_KEY_STATE_NA;
|
||||
}
|
||||
if (st != DST_KEY_STATE_HIDDEN) {
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
/* This key is unused. */
|
||||
return true;
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
@@ -2405,7 +2405,7 @@ dst_key_is_published(dst_key_t *key, isc_stdtime_t now,
|
||||
time_ok = true;
|
||||
}
|
||||
|
||||
return state_ok && time_ok;
|
||||
return (state_ok && time_ok);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -2465,10 +2465,9 @@ dst_key_is_active(dst_key_t *key, isc_stdtime_t now)
|
||||
inactive = false;
|
||||
}
|
||||
}
|
||||
return ds_ok && zrrsig_ok && time_ok && !inactive;
|
||||
return (ds_ok && zrrsig_ok && time_ok && !inactive);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
dst_key_is_signing(dst_key_t *key, int role, isc_stdtime_t now, isc_stdtime_t *active)
|
||||
{
|
||||
@@ -2522,7 +2521,7 @@ dst_key_is_signing(dst_key_t *key, int role, isc_stdtime_t now, isc_stdtime_t *a
|
||||
inactive = false;
|
||||
}
|
||||
}
|
||||
return krrsig_ok && zrrsig_ok && time_ok && !inactive;
|
||||
return (krrsig_ok && zrrsig_ok && time_ok && !inactive);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -2540,7 +2539,7 @@ dst_key_is_revoked(dst_key_t *key, isc_stdtime_t now, isc_stdtime_t *revoke)
|
||||
time_ok = (when <= now);
|
||||
}
|
||||
|
||||
return time_ok;
|
||||
return (time_ok);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -2555,7 +2554,7 @@ dst_key_is_removed(dst_key_t *key, isc_stdtime_t now, isc_stdtime_t *remove)
|
||||
|
||||
if (dst_key_is_unused(key)) {
|
||||
/* This key was never used. */
|
||||
return false;
|
||||
return (false);
|
||||
}
|
||||
|
||||
result = dst_key_gettime(key, DST_TIME_DELETE, &when);
|
||||
@@ -2579,7 +2578,20 @@ dst_key_is_removed(dst_key_t *key, isc_stdtime_t now, isc_stdtime_t *remove)
|
||||
time_ok = true;
|
||||
}
|
||||
|
||||
return state_ok && time_ok;
|
||||
return (state_ok && time_ok);
|
||||
}
|
||||
|
||||
dst_key_state_t
|
||||
dst_key_goal(dst_key_t *key)
|
||||
{
|
||||
dst_key_state_t state;
|
||||
isc_result_t result;
|
||||
|
||||
result = dst_key_getstate(key, DST_KEY_GOAL, &state);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
return (state);
|
||||
}
|
||||
return (DST_KEY_STATE_HIDDEN);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+3
-13
@@ -54,18 +54,12 @@ struct dst_gssapi_signverifyctx {
|
||||
static isc_result_t
|
||||
gssapi_create_signverify_ctx(dst_key_t *key, dst_context_t *dctx) {
|
||||
dst_gssapi_signverifyctx_t *ctx;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(key);
|
||||
|
||||
ctx = isc_mem_get(dctx->mctx, sizeof(dst_gssapi_signverifyctx_t));
|
||||
ctx->buffer = NULL;
|
||||
result = isc_buffer_allocate(dctx->mctx, &ctx->buffer,
|
||||
INITIAL_BUFFER_SIZE);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(dctx->mctx, ctx, sizeof(dst_gssapi_signverifyctx_t));
|
||||
return (result);
|
||||
}
|
||||
isc_buffer_allocate(dctx->mctx, &ctx->buffer, INITIAL_BUFFER_SIZE);
|
||||
|
||||
dctx->ctxdata.gssctx = ctx;
|
||||
|
||||
@@ -107,9 +101,7 @@ gssapi_adddata(dst_context_t *dctx, const isc_region_t *data) {
|
||||
|
||||
length = isc_buffer_length(ctx->buffer) + data->length + BUFFER_EXTRA;
|
||||
|
||||
result = isc_buffer_allocate(dctx->mctx, &newbuffer, length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(dctx->mctx, &newbuffer, length);
|
||||
|
||||
isc_buffer_usedregion(ctx->buffer, &r);
|
||||
(void)isc_buffer_copyregion(newbuffer, &r);
|
||||
@@ -276,9 +268,7 @@ gssapi_restore(dst_key_t *key, const char *keystr) {
|
||||
|
||||
len = (len / 4) * 3;
|
||||
|
||||
result = isc_buffer_allocate(key->mctx, &b, len);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(key->mctx, &b, len);
|
||||
|
||||
result = isc_base64_decodestring(keystr, b);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
|
||||
+2
-2
@@ -752,8 +752,8 @@ dst_gssapi_acceptctx(gss_cred_id_t cred,
|
||||
}
|
||||
|
||||
if (gouttoken.length > 0U) {
|
||||
RETERR(isc_buffer_allocate(mctx, outtoken,
|
||||
(unsigned int)gouttoken.length));
|
||||
isc_buffer_allocate(mctx, outtoken,
|
||||
(unsigned int)gouttoken.length);
|
||||
GBUFFER_TO_REGION(gouttoken, r);
|
||||
RETERR(isc_buffer_copyregion(*outtoken, &r));
|
||||
(void)gss_release_buffer(&minor, &gouttoken);
|
||||
|
||||
@@ -323,13 +323,15 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
/* Methods provided by named to dynamically modify the member zones */
|
||||
/* xxxwpk TODO config! */
|
||||
typedef isc_result_t (*dns_catz_zoneop_fn_t)(dns_catz_entry_t *entry,
|
||||
dns_catz_zone_t *origin, dns_view_t *view,
|
||||
isc_taskmgr_t *taskmgr, void *udata);
|
||||
dns_catz_zone_t *origin,
|
||||
dns_view_t *view,
|
||||
isc_taskmgr_t *taskmgr,
|
||||
void *udata);
|
||||
struct dns_catz_zonemodmethods {
|
||||
dns_catz_zoneop_fn_t addzone;
|
||||
dns_catz_zoneop_fn_t modzone;
|
||||
dns_catz_zoneop_fn_t delzone;
|
||||
void * udata;
|
||||
void *udata;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ ISC_LANG_BEGINDECLS
|
||||
#define DNS_COMPRESS_TABLEBITS 6
|
||||
#define DNS_COMPRESS_TABLESIZE (1U << DNS_COMPRESS_TABLEBITS)
|
||||
#define DNS_COMPRESS_TABLEMASK (DNS_COMPRESS_TABLESIZE - 1)
|
||||
#define DNS_COMPRESS_INITIALNODES 16
|
||||
#define DNS_COMPRESS_INITIALNODES 24
|
||||
#define DNS_COMPRESS_ARENA_SIZE 640
|
||||
|
||||
typedef struct dns_compressnode dns_compressnode_t;
|
||||
|
||||
@@ -69,6 +70,9 @@ struct dns_compress {
|
||||
int edns; /*%< Edns version or -1. */
|
||||
/*% Global compression table. */
|
||||
dns_compressnode_t *table[DNS_COMPRESS_TABLESIZE];
|
||||
/*% Preallocated arena for names. */
|
||||
unsigned char arena[DNS_COMPRESS_ARENA_SIZE];
|
||||
off_t arena_off;
|
||||
/*% Preallocated nodes for the table. */
|
||||
dns_compressnode_t initialnodes[DNS_COMPRESS_INITIALNODES];
|
||||
uint16_t count; /*%< Number of nodes. */
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#include <isc/mem.h>
|
||||
#include <dns/name.h>
|
||||
typedef struct dns_lowac_entry dns_lowac_entry_t;
|
||||
typedef struct dns_lowac dns_lowac_t;
|
||||
|
||||
dns_lowac_t*
|
||||
dns_lowac_create(isc_mem_t *mctx);
|
||||
|
||||
void
|
||||
dns_lowac_destroy(dns_lowac_t *lowac);
|
||||
|
||||
isc_result_t
|
||||
dns_lowac_put(dns_lowac_t *lowac, dns_name_t *name, char* packet, int size);
|
||||
|
||||
isc_result_t
|
||||
dns_lowac_get(dns_lowac_t *lowac, dns_name_t *name, unsigned char* blob, int* blobsize, bool tcp);
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
#include <dns/rpz.h>
|
||||
#include <dns/types.h>
|
||||
#include <dns/zt.h>
|
||||
#include <dns/lowac.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
@@ -240,6 +241,7 @@ struct dns_view {
|
||||
void *hooktable; /* ns_hooktable */
|
||||
void (*hooktable_free)(isc_mem_t *, void **);
|
||||
|
||||
dns_lowac_t* lowac;
|
||||
};
|
||||
|
||||
#define DNS_VIEW_MAGIC ISC_MAGIC('V','i','e','w')
|
||||
|
||||
@@ -1166,6 +1166,18 @@ dst_key_is_removed(dst_key_t *key, isc_stdtime_t now, isc_stdtime_t *remove);
|
||||
* 'key' to be valid.
|
||||
*/
|
||||
|
||||
dst_key_state_t
|
||||
dst_key_goal(dst_key_t *key);
|
||||
/*%<
|
||||
* Get the key goal. Should be OMNIPRESENT or HIDDEN.
|
||||
* This can be used to determine if the key is being introduced or
|
||||
* is on its way out.
|
||||
*
|
||||
* Requires:
|
||||
* 'key' to be valid.
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
dst_key_copy_metadata(dst_key_t *to, dst_key_t *from);
|
||||
/*%<
|
||||
|
||||
@@ -126,26 +126,6 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
|
||||
}
|
||||
dst->count = src->count;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
do {
|
||||
if (dst->labels[i] != NULL) {
|
||||
if (dns_name_dynamic(dst->labels[i]))
|
||||
dns_name_free(dst->labels[i], mctx);
|
||||
isc_mem_put(mctx, dst->labels[i], sizeof(dns_name_t));
|
||||
dst->labels[i] = NULL;
|
||||
}
|
||||
} while (i-- > 0);
|
||||
|
||||
do {
|
||||
if (dst->keys[i] != NULL) {
|
||||
if (dns_name_dynamic(dst->keys[i]))
|
||||
dns_name_free(dst->keys[i], mctx);
|
||||
isc_mem_put(mctx, dst->keys[i], sizeof(dns_name_t));
|
||||
dst->keys[i] = NULL;
|
||||
}
|
||||
} while (i-- > 0);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ keymgr_keyrole(dst_key_t* key)
|
||||
return ("CSK");
|
||||
} else if (ksk) {
|
||||
return ("KSK");
|
||||
} else {
|
||||
} else if (zsk) {
|
||||
return ("ZSK");
|
||||
}
|
||||
return ("NOSIGN");
|
||||
@@ -1358,7 +1358,7 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass,
|
||||
lifetime);
|
||||
}
|
||||
|
||||
if (dst_key_is_active(dkey->key, now)) {
|
||||
if (dst_key_goal(dkey->key) == OMNIPRESENT) {
|
||||
if (active_key != NULL) {
|
||||
/*
|
||||
* Multiple signing keys match
|
||||
|
||||
+1
-3
@@ -592,9 +592,7 @@ dns_keytable_dump(dns_keytable_t *keytable, FILE *fp) {
|
||||
REQUIRE(VALID_KEYTABLE(keytable));
|
||||
REQUIRE(fp != NULL);
|
||||
|
||||
result = isc_buffer_allocate(keytable->mctx, &text, 4096);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(keytable->mctx, &text, 4096);
|
||||
|
||||
result = dns_keytable_totext(keytable, &text);
|
||||
|
||||
|
||||
+488
@@ -0,0 +1,488 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/thread.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/random.h>
|
||||
#include <isc/refcount.h>
|
||||
#include <dns/name.h>
|
||||
#include <dns/lowac.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ck_ht.h>
|
||||
#include <ck_fifo.h>
|
||||
#include <ck_queue.h>
|
||||
#define fprintf(...) {}
|
||||
#define MAXIMUM_PKT_SIZE 1024
|
||||
|
||||
#define LENTRY_MAGIC ISC_MAGIC('L', 'o', 'w', 'E')
|
||||
#define VALID_LENTRY(c) ISC_MAGIC_VALID(c, LENTRY_MAGIC)
|
||||
|
||||
struct dns_lowac_entry {
|
||||
unsigned int magic;
|
||||
dns_name_t name;
|
||||
isc_region_t key;
|
||||
uint16_t flags;
|
||||
int64_t expire;
|
||||
ck_ht_hash_t hash;
|
||||
unsigned char *blob;
|
||||
uint32_t blobsize;
|
||||
isc_refcount_t refcount;
|
||||
/*
|
||||
* Set to 'true' when we enqueue this entry on remq.
|
||||
* Nothing serious will happen if we enqueue the entry
|
||||
* on remq multiple times as we're refcounting.
|
||||
* It's not locked in any way as it can only change
|
||||
* from false to true during runtime.
|
||||
*/
|
||||
bool remq_enqueued;
|
||||
bool inht;
|
||||
isc_refcount_t rqrefcount;
|
||||
|
||||
|
||||
|
||||
atomic_int_fast64_t lastusage;
|
||||
};
|
||||
|
||||
|
||||
struct dns_lowac {
|
||||
isc_mem_t * mctx;
|
||||
isc_thread_t thread;
|
||||
int expiry; /* Time after which records expire */
|
||||
|
||||
bool running; /* We're not shut down */
|
||||
bool accepting; /* We're accepting packets into cache */
|
||||
|
||||
ck_ht_t ht; /* Cache hash table */
|
||||
ck_ht_iterator_t htit; /* Hashtable maintenance iterator */
|
||||
|
||||
ck_fifo_mpmc_t inq; /* Packet input queue */
|
||||
ck_fifo_mpmc_t remq; /* Removal queue */
|
||||
|
||||
atomic_int_fast64_t now; /* Epoch time, updated at every loop */
|
||||
int count;
|
||||
|
||||
};
|
||||
|
||||
static void *
|
||||
rthread(void*d);
|
||||
|
||||
static void *
|
||||
ht_malloc(size_t r)
|
||||
{
|
||||
return(malloc(r));
|
||||
}
|
||||
|
||||
static void
|
||||
ht_free(void *p, size_t b, bool r)
|
||||
{
|
||||
(void)b;
|
||||
(void)r;
|
||||
free(p);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
ht_hash_wrapper(struct ck_ht_hash *h, const void *key, size_t length,
|
||||
uint64_t seed)
|
||||
{
|
||||
(void)seed;
|
||||
h->value = isc_hash_function(key, length, false);
|
||||
return;
|
||||
}
|
||||
|
||||
static struct ck_malloc my_allocator = {
|
||||
.malloc = ht_malloc,
|
||||
.free = ht_free
|
||||
};
|
||||
|
||||
static void
|
||||
free_entry(dns_lowac_t *lowac, dns_lowac_entry_t *entry) {
|
||||
entry->magic = 0xffffffff;
|
||||
dns_name_free(&entry->name, lowac->mctx);
|
||||
isc_mem_put(lowac->mctx, entry->blob, entry->blobsize);
|
||||
isc_mem_put(lowac->mctx, entry, sizeof(*entry));
|
||||
}
|
||||
|
||||
static bool
|
||||
dequeue_input_entry(dns_lowac_t*lowac) {
|
||||
dns_lowac_entry_t *entry = NULL;
|
||||
ck_fifo_mpmc_entry_t *garbage = NULL;
|
||||
if (ck_fifo_mpmc_dequeue(&lowac->inq, &entry,
|
||||
&garbage) == true) {
|
||||
REQUIRE(VALID_LENTRY(entry));
|
||||
isc_mem_put(lowac->mctx, garbage,
|
||||
sizeof(*garbage));
|
||||
ck_ht_entry_t htentry;
|
||||
ck_ht_entry_t oldhtentry;
|
||||
|
||||
ck_ht_entry_set(&htentry, entry->hash, entry->key.base,
|
||||
entry->key.length, entry);
|
||||
ck_ht_entry_set(&oldhtentry, entry->hash, entry->key.base,
|
||||
entry->key.length, NULL);
|
||||
|
||||
if (ck_ht_get_spmc(&lowac->ht, entry->hash,
|
||||
&oldhtentry) == false) {
|
||||
/* We don't have this entry in hashtable */
|
||||
entry->inht = true;
|
||||
if (ck_ht_put_spmc(&lowac->ht, entry->hash,
|
||||
&htentry) == false) {
|
||||
abort();
|
||||
printf("oddness but might happen\n");
|
||||
/* We can do it safely as it never was in
|
||||
* hashtable */
|
||||
RUNTIME_CHECK(isc_refcount_decrement(&entry->
|
||||
refcount) ==
|
||||
1);
|
||||
free_entry(lowac, entry);
|
||||
} else {
|
||||
fprintf(stderr, "XXXInsert %p %d\n", entry, lowac->count);
|
||||
lowac->count++;
|
||||
}
|
||||
} else {
|
||||
dns_lowac_entry_t *oldentry =
|
||||
ck_ht_entry_value(&oldhtentry);
|
||||
/* Note: set without remove doesn't seem to work
|
||||
* properly */
|
||||
oldentry->inht = false;
|
||||
RUNTIME_CHECK(ck_ht_remove_spmc(&lowac->ht,
|
||||
entry->hash,
|
||||
&oldhtentry) == true);
|
||||
entry->inht = true;
|
||||
RUNTIME_CHECK(ck_ht_set_spmc(&lowac->ht, entry->hash,
|
||||
&htentry) == true);
|
||||
lowac->count++;
|
||||
|
||||
/*
|
||||
* We don't need to increment refcount since we
|
||||
* have not decremented it
|
||||
* when removing from hashtable
|
||||
*/
|
||||
ck_fifo_mpmc_entry_t *qentry =
|
||||
isc_mem_get(lowac->mctx,
|
||||
(sizeof(
|
||||
ck_fifo_mpmc_entry_t)));
|
||||
oldentry->remq_enqueued = true;
|
||||
isc_refcount_increment0(&oldentry->rqrefcount);
|
||||
fprintf(stderr, "XXXenq %p %d\n", oldentry, __LINE__);
|
||||
ck_fifo_mpmc_enqueue(&lowac->remq, qentry,
|
||||
oldentry);
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
static int
|
||||
expire_entries(dns_lowac_t *lowac) {
|
||||
int iterated = 0;
|
||||
|
||||
ck_ht_entry_t *htitentry = NULL;
|
||||
bool iterok = ck_ht_next(&lowac->ht, &lowac->htit, &htitentry);
|
||||
if (!iterok) {
|
||||
ck_ht_iterator_init(&lowac->htit);
|
||||
iterok = ck_ht_next(&lowac->ht, &lowac->htit, &htitentry);
|
||||
}
|
||||
while (iterok && htitentry != NULL && iterated < 2048) {
|
||||
dns_lowac_entry_t *entry = ck_ht_entry_value(htitentry);
|
||||
REQUIRE(VALID_LENTRY(entry));
|
||||
if (entry->expire < atomic_load(&lowac->now)) {
|
||||
if (!ck_ht_remove_spmc(&lowac->ht, entry->hash, htitentry)) {
|
||||
abort();
|
||||
/*
|
||||
* Very unlikely, but can happen when we're between generations.
|
||||
* TODO verify that it's ok at all, maybe we're using the iterator wrong?
|
||||
*/
|
||||
isc_refcount_increment0(&entry->refcount);
|
||||
fprintf(stderr, "INCREF %d %p\n", __LINE__, entry);
|
||||
} else {
|
||||
dns_lowac_entry_t *ent2 = ck_ht_entry_value(htitentry);
|
||||
RUNTIME_CHECK(ent2 == entry);
|
||||
}
|
||||
entry->inht = false;
|
||||
/*
|
||||
* We don't need to increment refcount since we have
|
||||
* not decremented it when removing from hashtable.
|
||||
*/
|
||||
ck_fifo_mpmc_entry_t *qentry =
|
||||
isc_mem_get(lowac->mctx,
|
||||
(sizeof(
|
||||
ck_fifo_mpmc_entry_t)));
|
||||
entry->remq_enqueued = true;
|
||||
isc_refcount_increment0(&entry->rqrefcount);
|
||||
fprintf(stderr, "XXXenq %p %d\n", entry, __LINE__);
|
||||
ck_fifo_mpmc_enqueue(&lowac->remq, qentry, entry);
|
||||
}
|
||||
htitentry = NULL;
|
||||
iterok = ck_ht_next(&lowac->ht, &lowac->htit, &htitentry);
|
||||
iterated++;
|
||||
}
|
||||
|
||||
if (!iterok) {
|
||||
ck_ht_iterator_init(&lowac->htit);
|
||||
}
|
||||
return (iterated);
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterate over remq.
|
||||
* If the entry is in HT - remove it, requeue.
|
||||
* If the entry is not in HT but it is referenced - requeue.
|
||||
* If the entry is not referenced - free.
|
||||
*/
|
||||
static int
|
||||
cleanup_entries(dns_lowac_t *lowac) {
|
||||
ck_ht_entry_t htentry;
|
||||
dns_lowac_entry_t *entry;
|
||||
ck_fifo_mpmc_entry_t *qentry = NULL;
|
||||
int removed = 0;
|
||||
int max = 100;
|
||||
|
||||
while (--max > 0 &&
|
||||
ck_fifo_mpmc_dequeue(&lowac->remq, &entry, &qentry) == true)
|
||||
{
|
||||
REQUIRE(VALID_LENTRY(entry));
|
||||
int rc = isc_refcount_decrement(&entry->refcount);
|
||||
int rqrc = isc_refcount_decrement(&entry->rqrefcount);
|
||||
fprintf(stderr, "DECREF %d %p %d\n", __LINE__, entry, lowac->count);
|
||||
if (entry->inht) {
|
||||
/*
|
||||
* Remove entry from the hashtable, we'll remove the
|
||||
* entry itself in the next iteration.
|
||||
*/
|
||||
ck_ht_entry_set(&htentry, entry->hash, entry->key.base,
|
||||
entry->key.length, entry);
|
||||
RUNTIME_CHECK(ck_ht_remove_spmc(&lowac->ht,
|
||||
entry->hash,
|
||||
&htentry) == true);
|
||||
entry->inht = false;
|
||||
isc_refcount_increment0(&entry->rqrefcount);
|
||||
/* We don't increment refcount - it was at 2 (remq + ht), it stays at 1 (remq) */
|
||||
fprintf(stderr, "INCREF %d %p\n", __LINE__, entry);
|
||||
fprintf(stderr, "XXXenq %p %d\n", entry, __LINE__);
|
||||
ck_fifo_mpmc_enqueue(&lowac->remq, qentry, entry);
|
||||
} else {
|
||||
if (rc > 1) {
|
||||
/* Requeue if still in use and there's no other request in queue */
|
||||
/* TODO that's completely wrong, if we have two instances in the queue they will always have rc > 1 !!! */
|
||||
if (rqrc == 0) {
|
||||
int p1 = isc_refcount_increment0(&entry->rqrefcount);
|
||||
int p2 = isc_refcount_increment0(&entry->refcount);
|
||||
(void) p1;
|
||||
(void) p2;
|
||||
fprintf(stderr, "INCREF %d %p %d %d\n", __LINE__, entry, p1, p2);
|
||||
fprintf(stderr, "XXXenq %p %d\n", entry, __LINE__);
|
||||
ck_fifo_mpmc_enqueue(&lowac->remq, qentry,
|
||||
entry);
|
||||
} else {
|
||||
isc_mem_put(lowac->mctx, qentry,
|
||||
sizeof(*qentry));
|
||||
}
|
||||
fprintf(stderr, "IGNREF %d %p\n", __LINE__, entry);
|
||||
} else {
|
||||
isc_mem_put(lowac->mctx, qentry,
|
||||
sizeof(*qentry));
|
||||
removed++;
|
||||
free_entry(lowac, entry);
|
||||
fprintf(stderr, "XXXFree %p %d\n", entry, lowac->count);
|
||||
lowac->count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (removed);
|
||||
}
|
||||
|
||||
static void *
|
||||
rthread(void *d) {
|
||||
dns_lowac_t *lowac = (dns_lowac_t*) d;
|
||||
ck_ht_iterator_init(&lowac->htit);
|
||||
while (lowac->running) {
|
||||
isc_time_t now;
|
||||
isc_time_now(&now);
|
||||
atomic_store(&lowac->now, now.seconds);
|
||||
bool dequeued = dequeue_input_entry(lowac);
|
||||
if (!dequeued) {
|
||||
expire_entries(lowac);
|
||||
int removed = cleanup_entries(lowac);
|
||||
if (removed < 256) {
|
||||
usleep(1000);
|
||||
} else {
|
||||
RUNTIME_CHECK(ck_ht_gc(&lowac->ht, 128,
|
||||
isc_random32()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
dns_lowac_t*
|
||||
dns_lowac_create(isc_mem_t *mctx) {
|
||||
dns_lowac_t *lowac = isc_mem_get(mctx, sizeof(dns_lowac_t));
|
||||
lowac->expiry = 600;
|
||||
lowac->count = 0;
|
||||
lowac->running = true;
|
||||
|
||||
if (ck_ht_init(&lowac->ht,
|
||||
CK_HT_MODE_BYTESTRING | CK_HT_WORKLOAD_DELETE,
|
||||
ht_hash_wrapper,
|
||||
&my_allocator, 32, isc_random32()) == false) {
|
||||
abort();
|
||||
}
|
||||
|
||||
ck_fifo_mpmc_entry_t *inq_stub =
|
||||
isc_mem_get(mctx, sizeof(ck_fifo_mpmc_entry_t));
|
||||
ck_fifo_mpmc_entry_t *remq_stub =
|
||||
isc_mem_get(mctx, sizeof(ck_fifo_mpmc_entry_t));
|
||||
|
||||
ck_fifo_mpmc_init(&lowac->inq, inq_stub);
|
||||
ck_fifo_mpmc_init(&lowac->remq, remq_stub);
|
||||
|
||||
|
||||
lowac->mctx = NULL;
|
||||
isc_mem_attach(mctx, &lowac->mctx);
|
||||
|
||||
isc_thread_create(rthread, lowac, &lowac->thread);
|
||||
return (lowac);
|
||||
}
|
||||
|
||||
void
|
||||
dns_lowac_destroy(dns_lowac_t *lowac) {
|
||||
lowac->running = false;
|
||||
isc_thread_join(lowac->thread, NULL);
|
||||
dns_lowac_entry_t *entry;
|
||||
ck_fifo_mpmc_entry_t *fentry;
|
||||
|
||||
/* Entries in inq can only be in inq, it's safe to free them */
|
||||
while (ck_fifo_mpmc_dequeue(&lowac->inq,
|
||||
&entry,
|
||||
&fentry))
|
||||
{
|
||||
isc_mem_put(lowac->mctx, fentry, sizeof(*fentry));
|
||||
free_entry(lowac, entry);
|
||||
}
|
||||
|
||||
/*
|
||||
* Entries in remq can be freed only if they're no longer referenced
|
||||
* by either multiple occurences in queue or HT
|
||||
*/
|
||||
while (ck_fifo_mpmc_dequeue(&lowac->remq,
|
||||
&entry,
|
||||
&fentry))
|
||||
{
|
||||
if (isc_refcount_decrement(&entry->refcount) == 1) {
|
||||
fprintf(stderr, "DECREF %d %p\n", __LINE__, entry);
|
||||
free_entry(lowac, entry);
|
||||
} else {
|
||||
fprintf(stderr, "Non-unreferenced entry in remq %p\n", entry);
|
||||
}
|
||||
isc_mem_put(lowac->mctx, fentry, sizeof(*fentry));
|
||||
}
|
||||
|
||||
/* Finally we free rest of entries from HT */
|
||||
while (ck_ht_count(&lowac->ht) > 0) {
|
||||
ck_ht_gc(&lowac->ht, 0, 0);
|
||||
ck_ht_iterator_t htit = CK_HT_ITERATOR_INITIALIZER;
|
||||
ck_ht_entry_t *htitentry = NULL;
|
||||
while (ck_ht_next(&lowac->ht, &htit, &htitentry)) {
|
||||
entry = ck_ht_entry_value(htitentry);
|
||||
ck_ht_remove_spmc(&lowac->ht, entry->hash, htitentry);
|
||||
free_entry(lowac, entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ck_fifo_mpmc_deinit(&lowac->inq, &fentry);
|
||||
isc_mem_put(lowac->mctx, fentry, sizeof(*fentry));
|
||||
|
||||
ck_fifo_mpmc_deinit(&lowac->remq, &fentry);
|
||||
isc_mem_put(lowac->mctx, fentry, sizeof(*fentry));
|
||||
|
||||
ck_ht_destroy(&lowac->ht);
|
||||
isc_mem_putanddetach(&lowac->mctx, lowac, sizeof(*lowac));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_lowac_put(dns_lowac_t *lowac, dns_name_t *name, char*packet, int size) {
|
||||
if (!lowac->running) {
|
||||
return (ISC_R_SHUTTINGDOWN);
|
||||
}
|
||||
if (size > MAXIMUM_PKT_SIZE) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
dns_lowac_entry_t *entry = isc_mem_get(lowac->mctx, sizeof(*entry));
|
||||
dns_name_init(&entry->name, NULL);
|
||||
dns_name_dup(name, lowac->mctx, &entry->name);
|
||||
entry->blob = isc_mem_get(lowac->mctx, size);
|
||||
memcpy(entry->blob, packet, size);
|
||||
entry->blobsize = size;
|
||||
isc_refcount_init(&entry->refcount, 1);
|
||||
isc_refcount_init(&entry->rqrefcount, 0);
|
||||
entry->expire = atomic_load(&lowac->now) + lowac->expiry;
|
||||
entry->remq_enqueued = false;
|
||||
entry->inht = false;
|
||||
entry->magic = LENTRY_MAGIC;
|
||||
|
||||
dns_name_toregion(&entry->name, &entry->key);
|
||||
|
||||
ck_ht_hash(&entry->hash, &lowac->ht, entry->key.base,
|
||||
entry->key.length);
|
||||
ck_fifo_mpmc_entry_t *qentry =
|
||||
isc_mem_get(lowac->mctx, (sizeof(ck_fifo_mpmc_entry_t)));
|
||||
ck_fifo_mpmc_enqueue(&lowac->inq, qentry, entry);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
isc_result_t
|
||||
dns_lowac_get(dns_lowac_t *lowac, dns_name_t *name, unsigned char *blob,
|
||||
int *blobsize, bool tcp) {
|
||||
ck_ht_entry_t htentry;
|
||||
ck_ht_hash_t h;
|
||||
isc_region_t r;
|
||||
|
||||
dns_name_toregion(name, &r);
|
||||
ck_ht_hash(&h, &lowac->ht, r.base, r.length);
|
||||
ck_ht_entry_key_set(&htentry, r.base, r.length);
|
||||
if (ck_ht_get_spmc(&lowac->ht, h, &htentry) == false) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
} else {
|
||||
dns_lowac_entry_t *entry = ck_ht_entry_value(&htentry);
|
||||
REQUIRE(VALID_LENTRY(entry));
|
||||
int oldrc = isc_refcount_increment0(&entry->refcount);
|
||||
fprintf(stderr, "INCREF %d %p\n", __LINE__, entry, oldrc);
|
||||
RUNTIME_CHECK(oldrc > 0);
|
||||
if (entry->remq_enqueued || !entry->inht) {
|
||||
/* This entry is being removed, bail */
|
||||
isc_refcount_decrement(&entry->refcount);
|
||||
fprintf(stderr, "DECREF %d %p\n", __LINE__, entry);
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
if (entry->expire < atomic_load(&lowac->now)) {
|
||||
ck_fifo_mpmc_entry_t *qentry =
|
||||
isc_mem_get(lowac->mctx,
|
||||
(sizeof(ck_fifo_mpmc_entry_t)));
|
||||
entry->remq_enqueued = true;
|
||||
isc_refcount_increment0(&entry->rqrefcount);
|
||||
fprintf(stderr, "XXXenq %p %d\n", entry, __LINE__);
|
||||
ck_fifo_mpmc_enqueue(&lowac->remq, qentry, entry);
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
if (tcp) {
|
||||
blob[0] = entry->blobsize >> 8;
|
||||
blob[1] = entry->blobsize;
|
||||
memcpy(blob + 2, entry->blob, entry->blobsize);
|
||||
*blobsize = entry->blobsize + 2;
|
||||
} else {
|
||||
memcpy(blob, entry->blob, entry->blobsize);
|
||||
*blobsize = entry->blobsize;
|
||||
}
|
||||
isc_refcount_decrement(&entry->refcount);
|
||||
fprintf(stderr, "DECREF %d %p\n", __LINE__, entry);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
@@ -400,7 +400,7 @@ totext_ctx_init(const dns_master_style_t *style, const dns_indent_t *indentctx,
|
||||
ctx->current_ttl = 0;
|
||||
ctx->current_ttl_valid = false;
|
||||
ctx->serve_stale_ttl = 0;
|
||||
ctx->indent = indentctx ? *indentctx : default_indent;
|
||||
ctx->indent = *indentctx;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -1547,12 +1547,13 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (dctx->dbiter != NULL)
|
||||
if (dctx->dbiter != NULL) {
|
||||
dns_dbiterator_destroy(&dctx->dbiter);
|
||||
if (dctx->db != NULL)
|
||||
}
|
||||
if (dctx->db != NULL) {
|
||||
dns_db_detach(&dctx->db);
|
||||
if (dctx != NULL)
|
||||
isc_mem_put(mctx, dctx, sizeof(*dctx));
|
||||
}
|
||||
isc_mem_put(mctx, dctx, sizeof(*dctx));
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
+8
-44
@@ -243,13 +243,10 @@ msgblock_free(isc_mem_t *mctx, dns_msgblock_t *block, unsigned int sizeof_type)
|
||||
*/
|
||||
static inline isc_result_t
|
||||
newbuffer(dns_message_t *msg, unsigned int size) {
|
||||
isc_result_t result;
|
||||
isc_buffer_t *dynbuf;
|
||||
|
||||
dynbuf = NULL;
|
||||
result = isc_buffer_allocate(msg->mctx, &dynbuf, size);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (ISC_R_NOMEMORY);
|
||||
isc_buffer_allocate(msg->mctx, &dynbuf, size);
|
||||
|
||||
ISC_LIST_APPEND(msg->scratchpad, dynbuf, link);
|
||||
return (ISC_R_SUCCESS);
|
||||
@@ -702,7 +699,6 @@ isc_result_t
|
||||
dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp)
|
||||
{
|
||||
dns_message_t *m;
|
||||
isc_result_t result;
|
||||
isc_buffer_t *dynbuf;
|
||||
unsigned int i;
|
||||
|
||||
@@ -743,49 +739,25 @@ dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp)
|
||||
* Ok, it is safe to allocate (and then "goto cleanup" if failure)
|
||||
*/
|
||||
|
||||
result = isc_mempool_create(m->mctx, sizeof(dns_name_t), &m->namepool);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mempool_create(m->mctx, sizeof(dns_name_t), &m->namepool);
|
||||
isc_mempool_setfillcount(m->namepool, NAME_COUNT);
|
||||
isc_mempool_setfreemax(m->namepool, NAME_COUNT);
|
||||
isc_mempool_setname(m->namepool, "msg:names");
|
||||
|
||||
result = isc_mempool_create(m->mctx, sizeof(dns_rdataset_t),
|
||||
isc_mempool_create(m->mctx, sizeof(dns_rdataset_t),
|
||||
&m->rdspool);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mempool_setfillcount(m->rdspool, RDATASET_COUNT);
|
||||
isc_mempool_setfreemax(m->rdspool, RDATASET_COUNT);
|
||||
isc_mempool_setname(m->rdspool, "msg:rdataset");
|
||||
|
||||
dynbuf = NULL;
|
||||
result = isc_buffer_allocate(mctx, &dynbuf, SCRATCHPAD_SIZE);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(mctx, &dynbuf, SCRATCHPAD_SIZE);
|
||||
ISC_LIST_APPEND(m->scratchpad, dynbuf, link);
|
||||
|
||||
m->cctx = NULL;
|
||||
|
||||
*msgp = m;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
/*
|
||||
* Cleanup for error returns.
|
||||
*/
|
||||
cleanup:
|
||||
dynbuf = ISC_LIST_HEAD(m->scratchpad);
|
||||
if (dynbuf != NULL) {
|
||||
ISC_LIST_UNLINK(m->scratchpad, dynbuf, link);
|
||||
isc_buffer_free(&dynbuf);
|
||||
}
|
||||
if (m->namepool != NULL)
|
||||
isc_mempool_destroy(&m->namepool);
|
||||
if (m->rdspool != NULL)
|
||||
isc_mempool_destroy(&m->rdspool);
|
||||
m->magic = 0;
|
||||
isc_mem_putanddetach(&mctx, m, sizeof(dns_message_t));
|
||||
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2865,9 +2837,7 @@ dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig) {
|
||||
goto cleanup;
|
||||
|
||||
isc_buffer_usedregion(querytsig, &r);
|
||||
result = isc_buffer_allocate(msg->mctx, &buf, r.length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(msg->mctx, &buf, r.length);
|
||||
isc_buffer_putmem(buf, r.base, r.length);
|
||||
isc_buffer_usedregion(buf, &r);
|
||||
dns_rdata_init(rdata);
|
||||
@@ -2912,9 +2882,7 @@ dns_message_getquerytsig(dns_message_t *msg, isc_mem_t *mctx,
|
||||
dns_rdataset_current(msg->tsig, &rdata);
|
||||
dns_rdata_toregion(&rdata, &r);
|
||||
|
||||
result = isc_buffer_allocate(mctx, querytsig, r.length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(mctx, querytsig, r.length);
|
||||
isc_buffer_putmem(*querytsig, r.base, r.length);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -3033,9 +3001,7 @@ dns_message_signer(dns_message_t *msg, dns_name_t *signer) {
|
||||
|
||||
if (!dns_name_hasbuffer(signer)) {
|
||||
isc_buffer_t *dynbuf = NULL;
|
||||
result = isc_buffer_allocate(msg->mctx, &dynbuf, 512);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(msg->mctx, &dynbuf, 512);
|
||||
dns_name_setbuffer(signer, dynbuf);
|
||||
dns_message_takebuffer(msg, &dynbuf);
|
||||
}
|
||||
@@ -4479,9 +4445,7 @@ dns_message_buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = isc_buffer_allocate(message->mctx, &buf, len);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(message->mctx, &buf, len);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (ednsopts[i].code == DNS_OPT_PAD &&
|
||||
|
||||
+15
-1
@@ -1777,7 +1777,21 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
|
||||
if (c == 0)
|
||||
done = true;
|
||||
n = c;
|
||||
state = fw_ordinary;
|
||||
if (downcase) {
|
||||
state = fw_ordinary;
|
||||
} else {
|
||||
current += n;
|
||||
if (current >= source->active) {
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
}
|
||||
memcpy(ndata, cdata, n);
|
||||
cdata += n;
|
||||
ndata += n;
|
||||
if (!seen_pointer) {
|
||||
cused+=n;
|
||||
}
|
||||
state = fw_start;
|
||||
}
|
||||
} else if (c >= 128 && c < 192) {
|
||||
/*
|
||||
* 14 bit local compression pointer.
|
||||
|
||||
+1
-3
@@ -568,9 +568,7 @@ dns_ntatable_dump(dns_ntatable_t *ntatable, FILE *fp) {
|
||||
isc_buffer_t *text = NULL;
|
||||
int len = 4096;
|
||||
|
||||
result = isc_buffer_allocate(ntatable->view->mctx, &text, len);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(ntatable->view->mctx, &text, len);
|
||||
|
||||
result = dns_ntatable_totext(ntatable, NULL, &text);
|
||||
|
||||
|
||||
@@ -273,16 +273,15 @@ static isc_result_t openssleddsa_todns(const dst_key_t *key,
|
||||
static isc_result_t
|
||||
openssleddsa_createctx(dst_key_t *key, dst_context_t *dctx) {
|
||||
isc_buffer_t *buf = NULL;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(key);
|
||||
REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
|
||||
dctx->key->key_alg == DST_ALG_ED448);
|
||||
|
||||
result = isc_buffer_allocate(dctx->mctx, &buf, 64);
|
||||
isc_buffer_allocate(dctx->mctx, &buf, 64);
|
||||
dctx->ctxdata.generic = buf;
|
||||
|
||||
return (result);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -312,9 +311,7 @@ openssleddsa_adddata(dst_context_t *dctx, const isc_region_t *data) {
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
length = isc_buffer_length(buf) + data->length + 64;
|
||||
result = isc_buffer_allocate(dctx->mctx, &nbuf, length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(dctx->mctx, &nbuf, length);
|
||||
isc_buffer_usedregion(buf, &r);
|
||||
(void) isc_buffer_copyregion(nbuf, &r);
|
||||
(void) isc_buffer_copyregion(nbuf, data);
|
||||
|
||||
@@ -108,9 +108,7 @@ pkcs11eddsa_adddata(dst_context_t *dctx, const isc_region_t *data) {
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
length = isc_buffer_length(buf) + data->length + 64;
|
||||
result = isc_buffer_allocate(dctx->mctx, &nbuf, length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(dctx->mctx, &nbuf, length);
|
||||
isc_buffer_usedregion(buf, &r);
|
||||
(void) isc_buffer_copyregion(nbuf, &r);
|
||||
(void) isc_buffer_copyregion(nbuf, data);
|
||||
|
||||
+13
-14
@@ -172,9 +172,12 @@ typedef isc_rwlock_t nodelock_t;
|
||||
* to be 0 by default either with or without threads.
|
||||
*/
|
||||
#ifndef DNS_RBTDB_LIMITLRUUPDATE
|
||||
#define DNS_RBTDB_LIMITLRUUPDATE 0
|
||||
#define DNS_RBTDB_LIMITLRUUPDATE 1
|
||||
#endif
|
||||
|
||||
#define DNS_RBTDB_LRUUPDATE_GLUE 300
|
||||
#define DNS_RBTDB_LRUUPDATE_REGULAR 600
|
||||
|
||||
/*
|
||||
* Allow clients with a virtual time of up to 5 minutes in the past to see
|
||||
* records that would have otherwise have expired.
|
||||
@@ -309,7 +312,7 @@ typedef ISC_LIST(dns_rbtnode_t) rbtnodelist_t;
|
||||
(((header)->rdh_ttl > (now)) || \
|
||||
((header)->rdh_ttl == (now) && ZEROTTL(header)))
|
||||
|
||||
#define DEFAULT_NODE_LOCK_COUNT 7 /*%< Should be prime. */
|
||||
#define DEFAULT_NODE_LOCK_COUNT 53 /*%< Should be prime. */
|
||||
#define RBTDB_GLUE_TABLE_INIT_SIZE 2U
|
||||
|
||||
/*%
|
||||
@@ -329,7 +332,7 @@ typedef ISC_LIST(dns_rbtnode_t) rbtnodelist_t;
|
||||
#define DEFAULT_CACHE_NODE_LOCK_COUNT DNS_RBTDB_CACHE_NODE_LOCK_COUNT
|
||||
#endif
|
||||
#else
|
||||
#define DEFAULT_CACHE_NODE_LOCK_COUNT 16
|
||||
#define DEFAULT_CACHE_NODE_LOCK_COUNT 97
|
||||
#endif /* DNS_RBTDB_CACHE_NODE_LOCK_COUNT */
|
||||
|
||||
typedef struct {
|
||||
@@ -1585,7 +1588,8 @@ clean_cache_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) {
|
||||
top_next = current->next;
|
||||
clean_stale_headers(rbtdb, mctx, current);
|
||||
/*
|
||||
* If current is nonexistent or stale, we can clean it up.
|
||||
* If current is nonexistent, ancient, or stale and
|
||||
* we are not keeping stale, we can clean it up.
|
||||
*/
|
||||
if (NONEXISTENT(current) || ANCIENT(current) ||
|
||||
(STALE(current) && ! KEEPSTALE(rbtdb))) {
|
||||
@@ -6367,8 +6371,7 @@ addnoqname(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
|
||||
cleanup:
|
||||
dns_rdataset_disassociate(&neg);
|
||||
dns_rdataset_disassociate(&negsig);
|
||||
if (noqname != NULL)
|
||||
free_noqname(mctx, &noqname);
|
||||
free_noqname(mctx, &noqname);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -6412,8 +6415,7 @@ addclosest(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
|
||||
cleanup:
|
||||
dns_rdataset_disassociate(&neg);
|
||||
dns_rdataset_disassociate(&negsig);
|
||||
if (closest != NULL)
|
||||
free_noqname(mctx, &closest);
|
||||
free_noqname(mctx, &closest);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -9884,10 +9886,7 @@ restart:
|
||||
dns_rdataset_t *sigrdataset_aaaa = NULL;
|
||||
dns_name_t *gluename = dns_fixedname_name(&ge->fixedname);
|
||||
|
||||
result = isc_buffer_allocate(msg->mctx, &buffer, 512);
|
||||
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
|
||||
goto no_glue;
|
||||
}
|
||||
isc_buffer_allocate(msg->mctx, &buffer, 512);
|
||||
|
||||
result = dns_message_gettempname(msg, &name);
|
||||
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
|
||||
@@ -10092,11 +10091,11 @@ need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) {
|
||||
* Glue records are updated if at least 60 seconds have passed
|
||||
* since the previous update time.
|
||||
*/
|
||||
return (header->last_used + 60 <= now);
|
||||
return (header->last_used + DNS_RBTDB_LRUUPDATE_GLUE <= now);
|
||||
}
|
||||
|
||||
/* Other records are updated if 5 minutes have passed. */
|
||||
return (header->last_used + 300 <= now);
|
||||
return (header->last_used + DNS_RBTDB_LRUUPDATE_REGULAR <= now);
|
||||
#else
|
||||
UNUSED(now);
|
||||
|
||||
|
||||
+1
-3
@@ -857,9 +857,7 @@ unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type,
|
||||
false));
|
||||
if (token.value.as_ulong > 65535U)
|
||||
return (ISC_R_RANGE);
|
||||
result = isc_buffer_allocate(mctx, &buf, token.value.as_ulong);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(mctx, &buf, token.value.as_ulong);
|
||||
|
||||
if (token.value.as_ulong != 0U) {
|
||||
result = isc_hex_tobuffer(lexer, buf,
|
||||
|
||||
+4
-14
@@ -780,10 +780,7 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf,
|
||||
sock = req_getsocket(request);
|
||||
INSIST(sock != NULL);
|
||||
|
||||
result = isc_buffer_allocate(mctx, &request->query,
|
||||
r.length + (tcp ? 2 : 0));
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(mctx, &request->query, r.length + (tcp ? 2 : 0));
|
||||
if (tcp)
|
||||
isc_buffer_putuint16(request->query, (uint16_t)r.length);
|
||||
result = isc_buffer_copyregion(request->query, &r);
|
||||
@@ -1040,9 +1037,7 @@ req_render(dns_message_t *message, isc_buffer_t **bufferp,
|
||||
/*
|
||||
* Create buffer able to hold largest possible message.
|
||||
*/
|
||||
result = isc_buffer_allocate(mctx, &buf1, 65535);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(mctx, &buf1, 65535);
|
||||
|
||||
result = dns_compress_init(&cctx, -1, mctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
@@ -1087,9 +1082,7 @@ req_render(dns_message_t *message, isc_buffer_t **bufferp,
|
||||
result = DNS_R_USETCP;
|
||||
goto cleanup;
|
||||
}
|
||||
result = isc_buffer_allocate(mctx, &buf2, r.length + (tcp ? 2 : 0));
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(mctx, &buf2, r.length + (tcp ? 2 : 0));
|
||||
if (tcp)
|
||||
isc_buffer_putuint16(buf2, (uint16_t)r.length);
|
||||
result = isc_buffer_copyregion(buf2, &r);
|
||||
@@ -1348,10 +1341,7 @@ req_response(isc_task_t *task, isc_event_t *event) {
|
||||
* Copy buffer to request.
|
||||
*/
|
||||
isc_buffer_usedregion(&devent->buffer, &r);
|
||||
result = isc_buffer_allocate(request->mctx, &request->answer,
|
||||
r.length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto done;
|
||||
isc_buffer_allocate(request->mctx, &request->answer, r.length);
|
||||
result = isc_buffer_copyregion(request->answer, &r);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
isc_buffer_free(&request->answer);
|
||||
|
||||
+10
-13
@@ -4832,7 +4832,7 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type,
|
||||
fctx->vresult = ISC_R_SUCCESS;
|
||||
fctx->exitline = -1; /* sentinel */
|
||||
fctx->logged = false;
|
||||
atomic_store(&fctx->attributes, 0);
|
||||
atomic_init(&fctx->attributes, 0);
|
||||
fctx->spilled = false;
|
||||
fctx->nqueries = 0;
|
||||
fctx->reason = NULL;
|
||||
@@ -7220,19 +7220,21 @@ log_nsid(isc_buffer_t *opt, size_t nsid_len, resquery_t *query,
|
||||
{
|
||||
static const char hex[17] = "0123456789abcdef";
|
||||
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
|
||||
uint16_t buflen, i;
|
||||
size_t buflen;
|
||||
unsigned char *p, *nsid;
|
||||
unsigned char *buf = NULL, *pbuf = NULL;
|
||||
|
||||
REQUIRE(nsid_len <= UINT16_MAX);
|
||||
|
||||
/* Allocate buffer for storing hex version of the NSID */
|
||||
buflen = (uint16_t)nsid_len * 2 + 1;
|
||||
buflen = nsid_len * 2 + 1;
|
||||
buf = isc_mem_get(mctx, buflen);
|
||||
pbuf = isc_mem_get(mctx, nsid_len + 1);
|
||||
|
||||
/* Convert to hex */
|
||||
p = buf;
|
||||
nsid = isc_buffer_current(opt);
|
||||
for (i = 0; i < nsid_len; i++) {
|
||||
for (size_t i = 0; i < nsid_len; i++) {
|
||||
*p++ = hex[(nsid[i] >> 4) & 0xf];
|
||||
*p++ = hex[nsid[i] & 0xf];
|
||||
}
|
||||
@@ -7240,11 +7242,8 @@ log_nsid(isc_buffer_t *opt, size_t nsid_len, resquery_t *query,
|
||||
|
||||
/* Make printable version */
|
||||
p = pbuf;
|
||||
for (i = 0; i < nsid_len; i++) {
|
||||
if (isprint(nsid[i]))
|
||||
*p++ = nsid[i];
|
||||
else
|
||||
*p++ = '.';
|
||||
for (size_t i = 0; i < nsid_len; i++) {
|
||||
*p++ = isprint(nsid[i]) ? nsid[i] : '.';
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
@@ -7254,10 +7253,8 @@ log_nsid(isc_buffer_t *opt, size_t nsid_len, resquery_t *query,
|
||||
DNS_LOGMODULE_RESOLVER, level,
|
||||
"received NSID %s (\"%s\") from %s", buf, pbuf, addrbuf);
|
||||
|
||||
if (pbuf != NULL)
|
||||
isc_mem_put(mctx, pbuf, nsid_len + 1);
|
||||
if (buf != NULL)
|
||||
isc_mem_put(mctx, buf, buflen);
|
||||
isc_mem_put(mctx, pbuf, nsid_len + 1);
|
||||
isc_mem_put(mctx, buf, buflen);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
+2
-9
@@ -273,7 +273,6 @@ dns_sdb_putrdata(dns_sdblookup_t *lookup, dns_rdatatype_t typeval,
|
||||
dns_rdatalist_t *rdatalist;
|
||||
dns_rdata_t *rdata;
|
||||
isc_buffer_t *rdatabuf = NULL;
|
||||
isc_result_t result;
|
||||
isc_mem_t *mctx;
|
||||
isc_region_t region;
|
||||
|
||||
@@ -299,9 +298,7 @@ dns_sdb_putrdata(dns_sdblookup_t *lookup, dns_rdatatype_t typeval,
|
||||
|
||||
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
|
||||
|
||||
result = isc_buffer_allocate(mctx, &rdatabuf, rdlen);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto failure;
|
||||
isc_buffer_allocate(mctx, &rdatabuf, rdlen);
|
||||
DE_CONST(rdatap, region.base);
|
||||
region.length = rdlen;
|
||||
isc_buffer_copyregion(rdatabuf, ®ion);
|
||||
@@ -311,12 +308,8 @@ dns_sdb_putrdata(dns_sdblookup_t *lookup, dns_rdatatype_t typeval,
|
||||
®ion);
|
||||
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
|
||||
ISC_LIST_APPEND(lookup->buffers, rdatabuf, link);
|
||||
rdata = NULL;
|
||||
|
||||
failure:
|
||||
if (rdata != NULL)
|
||||
isc_mem_put(mctx, rdata, sizeof(dns_rdata_t));
|
||||
return (result);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
+2
-6
@@ -1076,9 +1076,7 @@ modrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
|
||||
mctx = sdlz->common.mctx;
|
||||
|
||||
result = isc_buffer_allocate(mctx, &buffer, 1024);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(mctx, &buffer, 1024);
|
||||
|
||||
result = dns_master_stylecreate(&style, 0, 0, 0, 0, 0, 0, 1,
|
||||
0xffffffff, mctx);
|
||||
@@ -1869,9 +1867,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
|
||||
goto failure;
|
||||
|
||||
rdatabuf = NULL;
|
||||
result = isc_buffer_allocate(mctx, &rdatabuf, size);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto failure;
|
||||
isc_buffer_allocate(mctx, &rdatabuf, size);
|
||||
|
||||
result = dns_rdata_fromtext(rdata, rdatalist->rdclass,
|
||||
rdatalist->type, lex,
|
||||
|
||||
+124
-103
@@ -42,38 +42,57 @@ typedef enum {
|
||||
|
||||
/*%
|
||||
* It doesn't make sense to have 2^16 counters for all possible types since
|
||||
* most of them won't be used. We have counters for the first 256 types and
|
||||
* those explicitly supported in the rdata implementation.
|
||||
* XXXJT: this introduces tight coupling with the rdata implementation.
|
||||
* Ideally, we should have rdata handle this type of details.
|
||||
* most of them won't be used. We have counters for the first 256 types.
|
||||
*
|
||||
* A rdtypecounter is now 8 bits for RRtypes and 3 bits for flags:
|
||||
*
|
||||
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
* | | | | | | S |NX| RRType |
|
||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
||||
*
|
||||
* If the 8 bits for RRtype are all zero, this is an Other RRtype.
|
||||
*/
|
||||
#define RDTYPECOUNTER_MAXTYPE 0x00ff
|
||||
|
||||
/*
|
||||
* types, !types, nxdomain, stale types, stale !types, stale nxdomain,
|
||||
* ancient types, ancient !types, ancient nxdomain
|
||||
*
|
||||
* Bit 7 is the NXRRSET (NX) flag and indicates whether this is a
|
||||
* positive (0) or a negative (1) RRset.
|
||||
*/
|
||||
enum {
|
||||
/* For 0-255, we use the rdtype value as counter indices */
|
||||
rdtypecounter_dlv = 256, /* for dns_rdatatype_dlv */
|
||||
rdtypecounter_others = 257, /* anything else */
|
||||
rdtypecounter_max = 258,
|
||||
/* The following are used for nxrrset rdataset */
|
||||
rdtypenxcounter_max = rdtypecounter_max * 2,
|
||||
/* nxdomain counter */
|
||||
rdtypecounter_nxdomain = rdtypenxcounter_max,
|
||||
/* stale counters offset */
|
||||
rdtypecounter_stale = rdtypecounter_nxdomain + 1,
|
||||
rdtypecounter_stale_max = rdtypecounter_stale + rdtypecounter_max,
|
||||
rdtypenxcounter_stale_max = rdtypecounter_stale_max + rdtypecounter_max,
|
||||
rdtypecounter_stale_nxdomain = rdtypenxcounter_stale_max,
|
||||
/* ancient counters offset */
|
||||
rdtypecounter_ancient = rdtypecounter_stale_nxdomain + 1,
|
||||
rdtypecounter_ancient_max = rdtypecounter_ancient + rdtypecounter_max,
|
||||
rdtypenxcounter_ancient_max = rdtypecounter_ancient_max +
|
||||
rdtypecounter_max,
|
||||
rdtypecounter_ancient_nxdomain = rdtypenxcounter_ancient_max,
|
||||
/* limit of number counter types */
|
||||
rdatasettypecounter_max = rdtypecounter_ancient_nxdomain + 1,
|
||||
};
|
||||
#define RDTYPECOUNTER_NXRRSET 0x0100
|
||||
|
||||
/*
|
||||
* Then bit 5 and 6 mostly tell you if this counter is for an active,
|
||||
* stale, or ancient RRtype:
|
||||
*
|
||||
* S = 0 (0b00) means Active
|
||||
* S = 1 (0b01) means Stale
|
||||
* S = 2 (0b10) means Ancient
|
||||
*
|
||||
* Since a counter cannot be stale and ancient at the same time, we
|
||||
* treat S = 0x11 as a special case to deal with NXDOMAIN counters.
|
||||
*/
|
||||
#define RDTYPECOUNTER_STALE (1 << 9)
|
||||
#define RDTYPECOUNTER_ANCIENT (1 << 10)
|
||||
#define RDTYPECOUNTER_NXDOMAIN ((1 << 9) | (1 << 10))
|
||||
|
||||
/*
|
||||
* S = 0x11 indicates an NXDOMAIN counter and in this case the RRtype
|
||||
* field signals the expiry of this cached item:
|
||||
*
|
||||
* RRType = 0 (0b00) means Active
|
||||
* RRType = 1 (0b01) means Stale
|
||||
* RRType = 2 (0b02) means Ancient
|
||||
*
|
||||
*/
|
||||
#define RDTYPECOUNTER_NXDOMAIN_STALE 1
|
||||
#define RDTYPECOUNTER_NXDOMAIN_ANCIENT 2
|
||||
|
||||
/*
|
||||
* The maximum value for rdtypecounter is for an ancient NXDOMAIN.
|
||||
*/
|
||||
#define RDTYPECOUNTER_MAXVAL 0x0602
|
||||
|
||||
/* dnssec maximum key id */
|
||||
static int dnssec_keyid_max = 65535;
|
||||
@@ -175,8 +194,12 @@ isc_result_t
|
||||
dns_rdatatypestats_create(isc_mem_t *mctx, dns_stats_t **statsp) {
|
||||
REQUIRE(statsp != NULL && *statsp == NULL);
|
||||
|
||||
return (create_stats(mctx, dns_statstype_rdtype, rdtypecounter_max,
|
||||
statsp));
|
||||
/*
|
||||
* Create rdtype statistics for the first 255 RRtypes,
|
||||
* plus one additional for other RRtypes.
|
||||
*/
|
||||
return (create_stats(mctx, dns_statstype_rdtype,
|
||||
(RDTYPECOUNTER_MAXTYPE+1), statsp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -184,7 +207,7 @@ dns_rdatasetstats_create(isc_mem_t *mctx, dns_stats_t **statsp) {
|
||||
REQUIRE(statsp != NULL && *statsp == NULL);
|
||||
|
||||
return (create_stats(mctx, dns_statstype_rdataset,
|
||||
rdatasettypecounter_max, statsp));
|
||||
(RDTYPECOUNTER_MAXVAL+1), statsp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -220,52 +243,62 @@ dns_generalstats_increment(dns_stats_t *stats, isc_statscounter_t counter) {
|
||||
isc_stats_increment(stats->counters, counter);
|
||||
}
|
||||
|
||||
inline static
|
||||
isc_statscounter_t rdatatype2counter(dns_rdatatype_t type) {
|
||||
if (type > (dns_rdatatype_t)RDTYPECOUNTER_MAXTYPE) {
|
||||
return 0;
|
||||
}
|
||||
return (isc_statscounter_t)type;
|
||||
}
|
||||
|
||||
void
|
||||
dns_rdatatypestats_increment(dns_stats_t *stats, dns_rdatatype_t type) {
|
||||
int counter;
|
||||
isc_statscounter_t counter;
|
||||
|
||||
REQUIRE(DNS_STATS_VALID(stats) && stats->type == dns_statstype_rdtype);
|
||||
|
||||
if (type == dns_rdatatype_dlv)
|
||||
counter = rdtypecounter_dlv;
|
||||
else if (type > dns_rdatatype_any)
|
||||
counter = rdtypecounter_others;
|
||||
else
|
||||
counter = (int)type;
|
||||
|
||||
isc_stats_increment(stats->counters, (isc_statscounter_t)counter);
|
||||
counter = rdatatype2counter(type);
|
||||
isc_stats_increment(stats->counters, counter);
|
||||
}
|
||||
|
||||
static inline void
|
||||
update_rdatasetstats(dns_stats_t *stats, dns_rdatastatstype_t rrsettype,
|
||||
bool increment)
|
||||
{
|
||||
int counter;
|
||||
dns_rdatatype_t rdtype;
|
||||
isc_statscounter_t counter;
|
||||
|
||||
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_NXDOMAIN) != 0) {
|
||||
counter = rdtypecounter_nxdomain;
|
||||
counter = RDTYPECOUNTER_NXDOMAIN;
|
||||
|
||||
/*
|
||||
* This is an NXDOMAIN counter, save the expiry value
|
||||
* (active, stale, or ancient) value in the RRtype part.
|
||||
*/
|
||||
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT) != 0) {
|
||||
counter |= RDTYPECOUNTER_NXDOMAIN_ANCIENT;
|
||||
}
|
||||
else if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE) != 0) {
|
||||
counter += RDTYPECOUNTER_NXDOMAIN_STALE;
|
||||
}
|
||||
} else {
|
||||
rdtype = DNS_RDATASTATSTYPE_BASE(rrsettype);
|
||||
if (rdtype == dns_rdatatype_dlv)
|
||||
counter = (int)rdtypecounter_dlv;
|
||||
else if (rdtype > dns_rdatatype_any)
|
||||
counter = (int)rdtypecounter_others;
|
||||
else
|
||||
counter = (int)rdtype;
|
||||
counter = rdatatype2counter(DNS_RDATASTATSTYPE_BASE(rrsettype));
|
||||
|
||||
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_NXRRSET) != 0)
|
||||
counter += rdtypecounter_max;
|
||||
}
|
||||
DNS_RDATASTATSTYPE_ATTR_NXRRSET) != 0) {
|
||||
counter |= RDTYPECOUNTER_NXRRSET;
|
||||
}
|
||||
|
||||
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT) != 0) {
|
||||
counter += rdtypecounter_ancient;
|
||||
} else if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE) != 0) {
|
||||
counter += rdtypecounter_stale;
|
||||
if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT) != 0) {
|
||||
counter |= RDTYPECOUNTER_ANCIENT;
|
||||
}
|
||||
else if ((DNS_RDATASTATSTYPE_ATTR(rrsettype) &
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE) != 0) {
|
||||
counter |= RDTYPECOUNTER_STALE;
|
||||
}
|
||||
}
|
||||
|
||||
if (increment) {
|
||||
@@ -335,13 +368,10 @@ dump_rdentry(int rdcounter, uint64_t value, dns_rdatastatstype_t attributes,
|
||||
dns_rdatatype_t rdtype = dns_rdatatype_none; /* sentinel */
|
||||
dns_rdatastatstype_t type;
|
||||
|
||||
if (rdcounter == rdtypecounter_others)
|
||||
if ((rdcounter & RDTYPECOUNTER_MAXTYPE) == 0) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_OTHERTYPE;
|
||||
else {
|
||||
if (rdcounter == rdtypecounter_dlv)
|
||||
rdtype = dns_rdatatype_dlv;
|
||||
else
|
||||
rdtype = (dns_rdatatype_t)rdcounter;
|
||||
} else {
|
||||
rdtype = (dns_rdatatype_t)(rdcounter & RDTYPECOUNTER_MAXTYPE);
|
||||
}
|
||||
type = DNS_RDATASTATSTYPE_VALUE((dns_rdatastatstype_t)rdtype,
|
||||
attributes);
|
||||
@@ -370,48 +400,39 @@ dns_rdatatypestats_dump(dns_stats_t *stats, dns_rdatatypestats_dumper_t dump_fn,
|
||||
static void
|
||||
rdataset_dumpcb(isc_statscounter_t counter, uint64_t value, void *arg) {
|
||||
rdatadumparg_t *rdatadumparg = arg;
|
||||
unsigned int attributes;
|
||||
bool dump = true;
|
||||
unsigned int attributes = 0;
|
||||
|
||||
if (counter < rdtypecounter_max) {
|
||||
attributes = 0;
|
||||
} else if (counter < rdtypenxcounter_max) {
|
||||
counter -= rdtypecounter_max;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_NXRRSET;
|
||||
} else if (counter == rdtypecounter_nxdomain) {
|
||||
counter = 0;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_NXDOMAIN;
|
||||
} else if (counter < rdtypecounter_stale_max) {
|
||||
counter -= rdtypecounter_stale;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_STALE;
|
||||
} else if (counter < rdtypenxcounter_stale_max) {
|
||||
counter -= rdtypecounter_stale_max;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_NXRRSET |
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE;
|
||||
} else if (counter == rdtypecounter_stale_nxdomain) {
|
||||
counter = 0;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_NXDOMAIN |
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE;
|
||||
} else if (counter < rdtypecounter_ancient_max) {
|
||||
counter -= rdtypecounter_ancient;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_ANCIENT;
|
||||
} else if (counter < rdtypenxcounter_ancient_max) {
|
||||
counter -= rdtypecounter_ancient_max;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_NXRRSET |
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT;
|
||||
} else if (counter == rdtypecounter_ancient_nxdomain) {
|
||||
counter = 0;
|
||||
attributes = DNS_RDATASTATSTYPE_ATTR_NXDOMAIN |
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT;
|
||||
if ((counter & RDTYPECOUNTER_NXDOMAIN) == RDTYPECOUNTER_NXDOMAIN) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_NXDOMAIN;
|
||||
|
||||
/*
|
||||
* This is an NXDOMAIN counter, check the RRtype part for the
|
||||
* expiry value (active, stale, or ancient).
|
||||
*/
|
||||
if ((counter & RDTYPECOUNTER_MAXTYPE) ==
|
||||
RDTYPECOUNTER_NXDOMAIN_STALE) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_STALE;
|
||||
} else if ((counter & RDTYPECOUNTER_MAXTYPE) ==
|
||||
RDTYPECOUNTER_NXDOMAIN_ANCIENT) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_ANCIENT;
|
||||
}
|
||||
} else {
|
||||
/* Out of bounds, do not dump entry. */
|
||||
dump = false;
|
||||
if ((counter & RDTYPECOUNTER_MAXTYPE) == 0) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_OTHERTYPE;
|
||||
}
|
||||
if ((counter & RDTYPECOUNTER_NXRRSET) != 0) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_NXRRSET;
|
||||
}
|
||||
|
||||
if ((counter & RDTYPECOUNTER_STALE) != 0) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_STALE;
|
||||
} else if ((counter & RDTYPECOUNTER_ANCIENT) != 0) {
|
||||
attributes |= DNS_RDATASTATSTYPE_ATTR_ANCIENT;
|
||||
}
|
||||
}
|
||||
|
||||
if (dump) {
|
||||
dump_rdentry(counter, value, attributes, rdatadumparg->fn,
|
||||
dump_rdentry(counter, value, attributes, rdatadumparg->fn,
|
||||
rdatadumparg->arg);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -571,8 +571,7 @@ dns_test_namefromstring(const char *namestr, dns_fixedname_t *fname) {
|
||||
|
||||
name = dns_fixedname_initname(fname);
|
||||
|
||||
result = isc_buffer_allocate(dt_mctx, &b, length);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(dt_mctx, &b, length);
|
||||
|
||||
isc_buffer_putmem(b, (const unsigned char *) namestr, length);
|
||||
result = dns_name_fromtext(name, b, dns_rootname, 0, NULL);
|
||||
|
||||
@@ -130,7 +130,7 @@ static isc_result_t
|
||||
write_data(FILE *file, unsigned char *datap, void *arg, uint64_t *crc) {
|
||||
isc_result_t result;
|
||||
size_t ret = 0;
|
||||
data_holder_t *data = (data_holder_t *)datap;
|
||||
data_holder_t *data;
|
||||
data_holder_t temp;
|
||||
off_t where;
|
||||
|
||||
@@ -138,7 +138,8 @@ write_data(FILE *file, unsigned char *datap, void *arg, uint64_t *crc) {
|
||||
|
||||
REQUIRE(file != NULL);
|
||||
REQUIRE(crc != NULL);
|
||||
REQUIRE(data != NULL);
|
||||
REQUIRE(datap != NULL);
|
||||
data = (data_holder_t *)datap;
|
||||
REQUIRE((data->len == 0 && data->data == NULL) ||
|
||||
(data->len != 0 && data->data != NULL));
|
||||
|
||||
@@ -402,7 +403,9 @@ deserialize_corrupt_test(void **state) {
|
||||
close(fd);
|
||||
|
||||
/* Randomly fuzz a portion of the memory */
|
||||
/* cppcheck-suppress nullPointerArithmeticRedundantCheck */
|
||||
p = base + (isc_random_uniform(filesize));
|
||||
/* cppcheck-suppress nullPointerArithmeticRedundantCheck */
|
||||
q = base + filesize;
|
||||
q -= (isc_random_uniform(q - p));
|
||||
while (p++ < q) {
|
||||
|
||||
@@ -223,12 +223,11 @@ rdatasetstats(void **state, bool servestale) {
|
||||
result = dns_rdatasetstats_create(dt_mctx, &stats);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
|
||||
/* First 256 types. */
|
||||
for (i = 0; i <= 255; i++) {
|
||||
/* First 255 types. */
|
||||
for (i = 1; i <= 255; i++) {
|
||||
set_typestats(stats, (dns_rdatatype_t)i);
|
||||
}
|
||||
/* Specials */
|
||||
set_typestats(stats, dns_rdatatype_dlv);
|
||||
set_typestats(stats, (dns_rdatatype_t)1000);
|
||||
set_nxdomainstats(stats);
|
||||
|
||||
@@ -237,12 +236,10 @@ rdatasetstats(void **state, bool servestale) {
|
||||
|
||||
if (servestale) {
|
||||
/* Mark stale */
|
||||
for (i = 0; i <= 255; i++) {
|
||||
for (i = 1; i <= 255; i++) {
|
||||
mark_stale(stats, (dns_rdatatype_t)i, 0,
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE);
|
||||
}
|
||||
mark_stale(stats, dns_rdatatype_dlv, 0,
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE);
|
||||
mark_stale(stats, (dns_rdatatype_t)1000, 0,
|
||||
DNS_RDATASTATSTYPE_ATTR_STALE);
|
||||
mark_nxdomain_stale(stats, 0, DNS_RDATASTATSTYPE_ATTR_STALE);
|
||||
@@ -255,12 +252,10 @@ rdatasetstats(void **state, bool servestale) {
|
||||
}
|
||||
|
||||
/* Mark ancient */
|
||||
for (i = 0; i <= 255; i++) {
|
||||
for (i = 1; i <= 255; i++) {
|
||||
mark_stale(stats, (dns_rdatatype_t)i, from,
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT);
|
||||
}
|
||||
mark_stale(stats, dns_rdatatype_dlv, from,
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT);
|
||||
mark_stale(stats, (dns_rdatatype_t)1000, from,
|
||||
DNS_RDATASTATSTYPE_ATTR_ANCIENT);
|
||||
mark_nxdomain_stale(stats, from, DNS_RDATASTATSTYPE_ATTR_ANCIENT);
|
||||
|
||||
@@ -141,7 +141,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
|
||||
tsig.siglen = isc_buffer_usedlength(&sigbuf);
|
||||
assert_int_equal(sigsize, tsig.siglen);
|
||||
|
||||
CHECK(isc_buffer_allocate(dt_mctx, &dynbuf, 512));
|
||||
isc_buffer_allocate(dt_mctx, &dynbuf, 512);
|
||||
CHECK(dns_rdata_fromstruct(&rdata, dns_rdataclass_any,
|
||||
dns_rdatatype_tsig, &tsig, dynbuf));
|
||||
dns_rdatalist_init(&rdatalist);
|
||||
@@ -312,16 +312,14 @@ tsig_tcp_test(void **state) {
|
||||
/*
|
||||
* Create request.
|
||||
*/
|
||||
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
render(buf, 0, key, &tsigout, &querytsig, NULL);
|
||||
isc_buffer_free(&buf);
|
||||
|
||||
/*
|
||||
* Create response message 1.
|
||||
*/
|
||||
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
render(buf, DNS_MESSAGEFLAG_QR, key, &querytsig, &tsigout, NULL);
|
||||
|
||||
/*
|
||||
@@ -374,8 +372,7 @@ tsig_tcp_test(void **state) {
|
||||
/*
|
||||
* Create response message 2.
|
||||
*/
|
||||
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
render(buf, DNS_MESSAGEFLAG_QR, key, &tsigout, &tsigout, outctx);
|
||||
@@ -421,8 +418,7 @@ tsig_tcp_test(void **state) {
|
||||
/*
|
||||
* Create response message 3.
|
||||
*/
|
||||
result = isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(dt_mctx, &buf, 65535);
|
||||
render(buf, DNS_MESSAGEFLAG_QR, key, &tsigout, &tsigout, outctx);
|
||||
|
||||
result = add_tsig(outctx, key, buf);
|
||||
|
||||
+7
-7
@@ -164,7 +164,7 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata,
|
||||
RETERR(dns_message_gettemprdata(msg, &newrdata));
|
||||
|
||||
dns_rdata_toregion(rdata, &r);
|
||||
RETERR(isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length));
|
||||
isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length);
|
||||
isc_buffer_availableregion(tmprdatabuf, &newr);
|
||||
memmove(newr.base, r.base, r.length);
|
||||
dns_rdata_fromregion(newrdata, rdata->rdclass, rdata->type, &newr);
|
||||
@@ -438,7 +438,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name,
|
||||
RETERR(add_rdata_to_list(msg, &ourname, &ourkeyrdata, 0, namelist));
|
||||
|
||||
RETERR(dst_key_secretsize(tctx->dhkey, &sharedsize));
|
||||
RETERR(isc_buffer_allocate(msg->mctx, &shared, sharedsize));
|
||||
isc_buffer_allocate(msg->mctx, &shared, sharedsize);
|
||||
|
||||
result = dst_key_computesecret(pubkey, tctx->dhkey, shared);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
@@ -940,9 +940,9 @@ buildquery(dns_message_t *msg, const dns_name_t *name,
|
||||
dns_rdatatype_tkey);
|
||||
|
||||
len = 16 + tkey->algorithm.length + tkey->keylen + tkey->otherlen;
|
||||
RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, len));
|
||||
RETERR(isc_buffer_allocate(msg->mctx, &anamebuf, name->length));
|
||||
RETERR(isc_buffer_allocate(msg->mctx, &qnamebuf, name->length));
|
||||
isc_buffer_allocate(msg->mctx, &dynbuf, len);
|
||||
isc_buffer_allocate(msg->mctx, &anamebuf, name->length);
|
||||
isc_buffer_allocate(msg->mctx, &qnamebuf, name->length);
|
||||
RETERR(dns_message_gettemprdata(msg, &rdata));
|
||||
|
||||
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
||||
@@ -1046,7 +1046,7 @@ dns_tkey_builddhquery(dns_message_t *msg, dst_key_t *key,
|
||||
RETERR(buildquery(msg, name, &tkey, false));
|
||||
|
||||
RETERR(dns_message_gettemprdata(msg, &rdata));
|
||||
RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 1024));
|
||||
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
|
||||
RETERR(dst_key_todns(key, dynbuf));
|
||||
isc_buffer_usedregion(dynbuf, &r);
|
||||
dns_rdata_fromregion(rdata, dns_rdataclass_any,
|
||||
@@ -1265,7 +1265,7 @@ dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg,
|
||||
rmsg->mctx, &theirkey));
|
||||
|
||||
RETERR(dst_key_secretsize(key, &sharedsize));
|
||||
RETERR(isc_buffer_allocate(rmsg->mctx, &shared, sharedsize));
|
||||
isc_buffer_allocate(rmsg->mctx, &shared, sharedsize);
|
||||
|
||||
RETERR(dst_key_computesecret(theirkey, key, shared));
|
||||
|
||||
|
||||
+1
-3
@@ -975,9 +975,7 @@ dns_tsig_sign(dns_message_t *msg) {
|
||||
ret = dns_message_gettemprdata(msg, &rdata);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
goto cleanup_signature;
|
||||
ret = isc_buffer_allocate(msg->mctx, &dynbuf, 512);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
goto cleanup_rdata;
|
||||
isc_buffer_allocate(msg->mctx, &dynbuf, 512);
|
||||
ret = dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
||||
dns_rdatatype_tsig, &tsig, dynbuf);
|
||||
if (ret != ISC_R_SUCCESS)
|
||||
|
||||
@@ -279,6 +279,8 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
view, NULL, NULL, NULL);
|
||||
view->viewlist = NULL;
|
||||
view->magic = DNS_VIEW_MAGIC;
|
||||
/* TODO we might destroy the view (and LOWAC) when we still need it on shutdown! */
|
||||
view->lowac = dns_lowac_create(view->mctx);
|
||||
|
||||
*viewp = view;
|
||||
|
||||
@@ -610,6 +612,9 @@ view_flushanddetach(dns_view_t **viewp, bool flush) {
|
||||
if (view->catzs != NULL) {
|
||||
dns_catz_catzs_detach(&view->catzs);
|
||||
}
|
||||
if (view->lowac != NULL) {
|
||||
dns_lowac_destroy(view->lowac);
|
||||
}
|
||||
UNLOCK(&view->lock);
|
||||
|
||||
/* Need to detach zones outside view lock */
|
||||
|
||||
@@ -1432,6 +1432,7 @@ dst_key_getprivateformat
|
||||
dst_key_getstate
|
||||
dst_key_gettime
|
||||
dst_key_getttl
|
||||
dst_key_goal
|
||||
dst_key_id
|
||||
dst_key_is_active
|
||||
dst_key_is_published
|
||||
|
||||
+96
-44
@@ -13428,17 +13428,18 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
|
||||
|
||||
cleanup:
|
||||
cancel_refresh(zone);
|
||||
if (stub != NULL) {
|
||||
stub->magic = 0;
|
||||
if (stub->version != NULL)
|
||||
dns_db_closeversion(stub->db, &stub->version,
|
||||
false);
|
||||
if (stub->db != NULL)
|
||||
dns_db_detach(&stub->db);
|
||||
if (stub->zone != NULL)
|
||||
zone_idetach(&stub->zone);
|
||||
isc_mem_put(stub->mctx, stub, sizeof(*stub));
|
||||
stub->magic = 0;
|
||||
if (stub->version != NULL) {
|
||||
dns_db_closeversion(stub->db, &stub->version,
|
||||
false);
|
||||
}
|
||||
if (stub->db != NULL) {
|
||||
dns_db_detach(&stub->db);
|
||||
}
|
||||
if (stub->zone != NULL) {
|
||||
zone_idetach(&stub->zone);
|
||||
}
|
||||
isc_mem_put(stub->mctx, stub, sizeof(*stub));
|
||||
if (message != NULL)
|
||||
dns_message_destroy(&message);
|
||||
unlock:
|
||||
@@ -13822,9 +13823,7 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags,
|
||||
goto soa_cleanup;
|
||||
dns_rdataset_current(&rdataset, &rdata);
|
||||
dns_rdata_toregion(&rdata, &r);
|
||||
result = isc_buffer_allocate(zone->mctx, &b, r.length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto soa_cleanup;
|
||||
isc_buffer_allocate(zone->mctx, &b, r.length);
|
||||
isc_buffer_putmem(b, r.base, r.length);
|
||||
isc_buffer_usedregion(b, &r);
|
||||
dns_rdata_init(temprdata);
|
||||
@@ -16712,9 +16711,7 @@ dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = isc_buffer_allocate(zone->mctx, &forward->msgbuf, mr->length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_buffer_allocate(zone->mctx, &forward->msgbuf, mr->length);
|
||||
result = isc_buffer_copyregion(forward->msgbuf, mr);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
@@ -19137,11 +19134,14 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
unsigned char algorithms[256];
|
||||
unsigned int i;
|
||||
|
||||
enum { notexpected = 0, expected = 1, found = 2 };
|
||||
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
|
||||
result = dns_db_getoriginnode(db, &node);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_rdataset_init(&cds);
|
||||
dns_rdataset_init(&dnskey);
|
||||
@@ -19149,16 +19149,19 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
|
||||
result = dns_db_findrdataset(db, node, version, dns_rdatatype_cds,
|
||||
dns_rdatatype_none, 0, &cds, NULL);
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND)
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
result = dns_db_findrdataset(db, node, version, dns_rdatatype_cdnskey,
|
||||
dns_rdatatype_none, 0, &cdnskey, NULL);
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND)
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (!dns_rdataset_isassociated(&cds) &&
|
||||
!dns_rdataset_isassociated(&cdnskey)) {
|
||||
!dns_rdataset_isassociated(&cdnskey))
|
||||
{
|
||||
result = ISC_R_SUCCESS;
|
||||
goto failure;
|
||||
}
|
||||
@@ -19166,21 +19169,25 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
result = dns_db_findrdataset(db, node, version, dns_rdatatype_dnskey,
|
||||
dns_rdatatype_none, 0, &dnskey, NULL);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
if (dns_rdataset_isassociated(&cds))
|
||||
if (dns_rdataset_isassociated(&cds)) {
|
||||
result = DNS_R_BADCDS;
|
||||
else
|
||||
} else {
|
||||
result = DNS_R_BADCDNSKEY;
|
||||
}
|
||||
goto failure;
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/*
|
||||
* For each DNSSEC algorithm in the CDS RRset there must be
|
||||
* a matching DNSKEY record.
|
||||
* a matching DNSKEY record with the exception of a CDS deletion
|
||||
* record which must be by itself.
|
||||
*/
|
||||
if (dns_rdataset_isassociated(&cds)) {
|
||||
memset(algorithms, 0, sizeof(algorithms));
|
||||
bool delete = false;
|
||||
memset(algorithms, notexpected, sizeof(algorithms));
|
||||
for (result = dns_rdataset_first(&cds);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&cds)) {
|
||||
@@ -19188,9 +19195,21 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
dns_rdata_cds_t structcds;
|
||||
|
||||
dns_rdataset_current(&cds, &crdata);
|
||||
/*
|
||||
* CDS deletion record has this form "0 0 0 00" which
|
||||
* is 5 zero octets.
|
||||
*/
|
||||
if (crdata.length == 5U &&
|
||||
memcmp(crdata.data,
|
||||
(unsigned char[5]){ 0, 0, 0, 0, 0 }, 5) == 0)
|
||||
{
|
||||
delete = true;
|
||||
continue;
|
||||
}
|
||||
CHECK(dns_rdata_tostruct(&crdata, &structcds, NULL));
|
||||
if (algorithms[structcds.algorithm] == 0)
|
||||
algorithms[structcds.algorithm] = 1;
|
||||
if (algorithms[structcds.algorithm] == 0) {
|
||||
algorithms[structcds.algorithm] = expected;
|
||||
}
|
||||
for (result = dns_rdataset_first(&dnskey);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&dnskey)) {
|
||||
@@ -19203,16 +19222,23 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
buffer, &dsrdata));
|
||||
if (crdata.length == dsrdata.length &&
|
||||
memcmp(crdata.data, dsrdata.data,
|
||||
dsrdata.length) == 0) {
|
||||
algorithms[structcds.algorithm] = 2;
|
||||
dsrdata.length) == 0)
|
||||
{
|
||||
algorithms[structcds.algorithm] = found;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_NOMORE)
|
||||
if (result != ISC_R_NOMORE) {
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < sizeof(algorithms); i++) {
|
||||
if (algorithms[i] == 1) {
|
||||
result = DNS_R_BADCDNSKEY;
|
||||
if (delete) {
|
||||
if (algorithms[i] != notexpected) {
|
||||
result = DNS_R_BADCDS;
|
||||
goto failure;
|
||||
}
|
||||
} else if (algorithms[i] == expected) {
|
||||
result = DNS_R_BADCDS;
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
@@ -19220,10 +19246,12 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
|
||||
/*
|
||||
* For each DNSSEC algorithm in the CDNSKEY RRset there must be
|
||||
* a matching DNSKEY record.
|
||||
* a matching DNSKEY record with the exception of a CDNSKEY deletion
|
||||
* record which must be by itself.
|
||||
*/
|
||||
if (dns_rdataset_isassociated(&cdnskey)) {
|
||||
memset(algorithms, 0, sizeof(algorithms));
|
||||
bool delete = false;
|
||||
memset(algorithms, notexpected, sizeof(algorithms));
|
||||
for (result = dns_rdataset_first(&cdnskey);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&cdnskey)) {
|
||||
@@ -19231,10 +19259,23 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
dns_rdata_cdnskey_t structcdnskey;
|
||||
|
||||
dns_rdataset_current(&cdnskey, &crdata);
|
||||
/*
|
||||
* CDNSKEY deletion record has this form
|
||||
* "0 3 0 AA==" which is 2 zero octets, a 3,
|
||||
* and 2 zero octets.
|
||||
*/
|
||||
if (crdata.length == 5U &&
|
||||
memcmp(crdata.data,
|
||||
(unsigned char[5]){ 0, 0, 3, 0, 0 }, 5) == 0)
|
||||
{
|
||||
delete = true;
|
||||
continue;
|
||||
}
|
||||
CHECK(dns_rdata_tostruct(&crdata, &structcdnskey,
|
||||
NULL));
|
||||
if (algorithms[structcdnskey.algorithm] == 0)
|
||||
algorithms[structcdnskey.algorithm] = 1;
|
||||
if (algorithms[structcdnskey.algorithm] == 0) {
|
||||
algorithms[structcdnskey.algorithm] = expected;
|
||||
}
|
||||
for (result = dns_rdataset_first(&dnskey);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(&dnskey)) {
|
||||
@@ -19243,16 +19284,24 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
dns_rdataset_current(&dnskey, &rdata);
|
||||
if (crdata.length == rdata.length &&
|
||||
memcmp(crdata.data, rdata.data,
|
||||
rdata.length) == 0) {
|
||||
algorithms[structcdnskey.algorithm] = 2;
|
||||
rdata.length) == 0)
|
||||
{
|
||||
algorithms[structcdnskey.algorithm] =
|
||||
found;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_NOMORE)
|
||||
if (result != ISC_R_NOMORE) {
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < sizeof(algorithms); i++) {
|
||||
if (algorithms[i] == 1) {
|
||||
result = DNS_R_BADCDS;
|
||||
if (delete) {
|
||||
if (algorithms[i] != notexpected) {
|
||||
result = DNS_R_BADCDNSKEY;
|
||||
goto failure;
|
||||
}
|
||||
} else if (algorithms[i] == expected) {
|
||||
result = DNS_R_BADCDNSKEY;
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
@@ -19260,12 +19309,15 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) {
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
failure:
|
||||
if (dns_rdataset_isassociated(&cds))
|
||||
if (dns_rdataset_isassociated(&cds)) {
|
||||
dns_rdataset_disassociate(&cds);
|
||||
if (dns_rdataset_isassociated(&dnskey))
|
||||
}
|
||||
if (dns_rdataset_isassociated(&dnskey)) {
|
||||
dns_rdataset_disassociate(&dnskey);
|
||||
if (dns_rdataset_isassociated(&cdnskey))
|
||||
}
|
||||
if (dns_rdataset_isassociated(&cdnskey)) {
|
||||
dns_rdataset_disassociate(&cdnskey);
|
||||
}
|
||||
dns_db_detachnode(db, &node);
|
||||
return (result);
|
||||
}
|
||||
|
||||
+47
-28
@@ -1122,7 +1122,7 @@ free_element_heap(void *element, void *uap) {
|
||||
}
|
||||
|
||||
static bool
|
||||
checknext(const vctx_t *vctx, const struct nsec3_chain_fixed *first,
|
||||
_checknext(const vctx_t *vctx, const struct nsec3_chain_fixed *first,
|
||||
const struct nsec3_chain_fixed *e)
|
||||
{
|
||||
char buf[512];
|
||||
@@ -1162,6 +1162,37 @@ checknext(const vctx_t *vctx, const struct nsec3_chain_fixed *first,
|
||||
return (false);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
checknext(isc_mem_t *mctx,
|
||||
const vctx_t *vctx,
|
||||
const struct nsec3_chain_fixed *first,
|
||||
struct nsec3_chain_fixed *prev,
|
||||
const struct nsec3_chain_fixed *cur)
|
||||
{
|
||||
bool result = _checknext(vctx, prev, cur);
|
||||
|
||||
if (prev != first) {
|
||||
free_element(mctx, prev);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
checklast(isc_mem_t *mctx,
|
||||
const vctx_t *vctx,
|
||||
struct nsec3_chain_fixed *first,
|
||||
struct nsec3_chain_fixed *prev)
|
||||
{
|
||||
bool result = _checknext(vctx, prev, first);
|
||||
if (prev != first) {
|
||||
free_element(mctx, prev);
|
||||
}
|
||||
free_element(mctx, first);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
@@ -1214,39 +1245,27 @@ verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) {
|
||||
"not equal");
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
if (first == NULL || newchain(first, e)) {
|
||||
if (prev != NULL) {
|
||||
if (!checknext(vctx, prev, first)) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
if (prev != first) {
|
||||
free_element(mctx, prev);
|
||||
}
|
||||
}
|
||||
if (first != NULL) {
|
||||
free_element(mctx, first);
|
||||
}
|
||||
|
||||
if (first == NULL) {
|
||||
prev = first = e;
|
||||
continue;
|
||||
} else if (newchain(first, e)) {
|
||||
if (!checklast(mctx, vctx, first, prev)) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
|
||||
prev = first = e;
|
||||
} else {
|
||||
if (!checknext(mctx, vctx, first, prev, e)) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
|
||||
prev = e;
|
||||
}
|
||||
if (!checknext(vctx, prev, e)) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
if (prev != first) {
|
||||
free_element(mctx, prev);
|
||||
}
|
||||
prev = e;
|
||||
}
|
||||
if (prev != NULL) {
|
||||
if (!checknext(vctx, prev, first)) {
|
||||
if (!checklast(mctx, vctx, first, prev)) {
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
if (prev != first) {
|
||||
free_element(mctx, prev);
|
||||
}
|
||||
}
|
||||
if (first != NULL) {
|
||||
free_element(mctx, first);
|
||||
}
|
||||
do {
|
||||
if (f != NULL) {
|
||||
|
||||
+1
-5
@@ -109,11 +109,7 @@ configure_key(isc_mem_t *mctx, const cfg_obj_t *key, irs_dnsconf_t *conf,
|
||||
return (result);
|
||||
}
|
||||
isc_buffer_usedregion(&rrdatabuf, &r);
|
||||
result = isc_buffer_allocate(mctx, &keydatabuf,
|
||||
r.length);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
isc_buffer_allocate(mctx, &keydatabuf, r.length);
|
||||
result = isc_buffer_copyregion(keydatabuf, &r);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup;
|
||||
|
||||
+5
-13
@@ -500,9 +500,7 @@ isc_buffer_dup(isc_mem_t *mctx, isc_buffer_t **dstp, const isc_buffer_t *src) {
|
||||
|
||||
isc_buffer_usedregion(src, ®ion);
|
||||
|
||||
result = isc_buffer_allocate(mctx, &dst, region.length);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(mctx, &dst, region.length);
|
||||
|
||||
result = isc_buffer_copyregion(dst, ®ion);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS); /* NOSPACE is impossible */
|
||||
@@ -536,18 +534,14 @@ isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
|
||||
unsigned int length)
|
||||
{
|
||||
isc_buffer_t *dbuf;
|
||||
unsigned char * bdata;
|
||||
REQUIRE(dynbuffer != NULL);
|
||||
REQUIRE(*dynbuffer == NULL);
|
||||
REQUIRE(dynbuffer != NULL && *dynbuffer == NULL);
|
||||
|
||||
dbuf = isc_mem_get(mctx, sizeof(isc_buffer_t));
|
||||
|
||||
bdata = isc_mem_get(mctx, length);
|
||||
isc_buffer_t *dbuf = isc_mem_get(mctx, sizeof(isc_buffer_t));
|
||||
unsigned char *bdata = isc_mem_get(mctx, length);
|
||||
|
||||
isc_buffer_init(dbuf, bdata, length);
|
||||
|
||||
@@ -556,8 +550,6 @@ isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
|
||||
dbuf->mctx = mctx;
|
||||
|
||||
*dynbuffer = dbuf;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ void
|
||||
isc_hp_destroy(isc_hp_t *hp) {
|
||||
for (int i = 0; i < isc__hp_max_threads; i++) {
|
||||
isc_mem_put(hp->mctx, hp->hp[i],
|
||||
CLPAD * 2 * sizeof(uintptr_t));
|
||||
CLPAD * 2 * sizeof(hp->hp[i][0]));
|
||||
|
||||
for (int j = 0; j < hp->rl[i]->size; j++) {
|
||||
void *data = (void *)hp->rl[i]->list[j];
|
||||
|
||||
@@ -192,7 +192,7 @@ struct isc_buffer {
|
||||
*** Functions
|
||||
***/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
|
||||
unsigned int length);
|
||||
/*!<
|
||||
@@ -204,10 +204,6 @@ isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
|
||||
*
|
||||
*\li "dynbuffer" is non-NULL, and "*dynbuffer" is NULL.
|
||||
*
|
||||
* Returns:
|
||||
*\li ISC_R_SUCCESS - success
|
||||
*\li ISC_R_NOMEMORY - no memory available
|
||||
*
|
||||
* Note:
|
||||
*\li Changing the buffer's length field is not permitted.
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
/*%
|
||||
* Performance
|
||||
*/
|
||||
#ifdef CPPCHECK
|
||||
#define ISC_LIKELY(x) (x)
|
||||
#define ISC_UNLIKELY(x) (x)
|
||||
#else
|
||||
#ifdef HAVE_BUILTIN_EXPECT
|
||||
#define ISC_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
@@ -22,5 +26,6 @@
|
||||
#define ISC_LIKELY(x) (x)
|
||||
#define ISC_UNLIKELY(x) (x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* ISC_LIKELY_H */
|
||||
|
||||
@@ -451,7 +451,7 @@ isc_mem_renderjson(void *memobj0);
|
||||
* Memory pools
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp);
|
||||
/*%<
|
||||
* Create a memory pool.
|
||||
|
||||
@@ -285,12 +285,17 @@ extern void mock_assert(const int result, const char* const expression,
|
||||
#ifdef UNIT_TESTING
|
||||
|
||||
#define RUNTIME_CHECK(expression) \
|
||||
mock_assert((int)(expression), #expression, __FILE__, __LINE__)
|
||||
((!(expression)) ? \
|
||||
(mock_assert(0, #expression, __FILE__, __LINE__), abort()) : (void)0)
|
||||
|
||||
#else /* UNIT_TESTING */
|
||||
|
||||
#ifndef CPPCHECK
|
||||
/*% Runtime Check */
|
||||
#define RUNTIME_CHECK(cond) ISC_ERROR_RUNTIMECHECK(cond)
|
||||
#else
|
||||
#define RUNTIME_CHECK(e) if (!(e)) abort()
|
||||
#endif
|
||||
|
||||
#endif /* UNIT_TESTING */
|
||||
|
||||
|
||||
+3
-11
@@ -181,7 +181,6 @@ new_source(isc_lex_t *lex, bool is_file, bool need_close,
|
||||
void *input, const char *name)
|
||||
{
|
||||
inputsource *source;
|
||||
isc_result_t result;
|
||||
|
||||
source = isc_mem_get(lex->mctx, sizeof(*source));
|
||||
source->result = ISC_R_SUCCESS;
|
||||
@@ -192,13 +191,8 @@ new_source(isc_lex_t *lex, bool is_file, bool need_close,
|
||||
source->input = input;
|
||||
source->name = isc_mem_strdup(lex->mctx, name);
|
||||
source->pushback = NULL;
|
||||
result = isc_buffer_allocate(lex->mctx, &source->pushback,
|
||||
(unsigned int)lex->max_token);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_free(lex->mctx, source->name);
|
||||
isc_mem_put(lex->mctx, source, sizeof(*source));
|
||||
return (result);
|
||||
}
|
||||
isc_buffer_allocate(lex->mctx, &source->pushback,
|
||||
(unsigned int)lex->max_token);
|
||||
source->ignored = 0;
|
||||
source->line = 1;
|
||||
ISC_LIST_INITANDPREPEND(lex->sources, source, link);
|
||||
@@ -320,9 +314,7 @@ pushandgrow(isc_lex_t *lex, inputsource *source, int c) {
|
||||
isc_result_t result;
|
||||
|
||||
oldlen = isc_buffer_length(source->pushback);
|
||||
result = isc_buffer_allocate(lex->mctx, &tbuf, oldlen * 2);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
isc_buffer_allocate(lex->mctx, &tbuf, oldlen * 2);
|
||||
isc_buffer_usedregion(source->pushback, &used);
|
||||
result = isc_buffer_copyregion(tbuf, &used);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
|
||||
+15
-17
@@ -321,17 +321,15 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
|
||||
|
||||
lcfg = isc_mem_get(lctx->mctx, sizeof(*lcfg));
|
||||
|
||||
{
|
||||
lcfg->lctx = lctx;
|
||||
lcfg->channellists = NULL;
|
||||
lcfg->channellist_count = 0;
|
||||
lcfg->duplicate_interval = 0;
|
||||
lcfg->highest_level = level;
|
||||
lcfg->tag = NULL;
|
||||
lcfg->dynamic = false;
|
||||
ISC_LIST_INIT(lcfg->channels);
|
||||
lcfg->magic = LCFG_MAGIC;
|
||||
}
|
||||
lcfg->lctx = lctx;
|
||||
lcfg->channellists = NULL;
|
||||
lcfg->channellist_count = 0;
|
||||
lcfg->duplicate_interval = 0;
|
||||
lcfg->highest_level = level;
|
||||
lcfg->tag = NULL;
|
||||
lcfg->dynamic = false;
|
||||
ISC_LIST_INIT(lcfg->channels);
|
||||
lcfg->magic = LCFG_MAGIC;
|
||||
|
||||
/*
|
||||
* Create the default channels:
|
||||
@@ -377,18 +375,18 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
|
||||
ISC_LOG_PRINTTIME);
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
result = isc_log_createchannel(lcfg, "null",
|
||||
ISC_LOG_TONULL,
|
||||
ISC_LOG_DYNAMIC,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
*lcfgp = lcfg;
|
||||
|
||||
else
|
||||
if (lcfg != NULL)
|
||||
isc_logconfig_destroy(&lcfg);
|
||||
} else {
|
||||
isc_logconfig_destroy(&lcfg);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
+98
-98
@@ -126,6 +126,11 @@ static isc_mutex_t contextslock;
|
||||
*/
|
||||
static uint64_t totallost;
|
||||
|
||||
/*%
|
||||
* Memory allocation and free function definitions.
|
||||
* isc__memalloc_t must deal with memory allocation failure
|
||||
* and must never return NULL.
|
||||
*/
|
||||
typedef void * (*isc__memalloc_t)(size_t);
|
||||
typedef void (*isc__memfree_t)(void *);
|
||||
|
||||
@@ -363,7 +368,6 @@ more_basic_blocks(isc__mem_t *ctx) {
|
||||
if (ctx->basic_table_count == ctx->basic_table_size) {
|
||||
table_size = ctx->basic_table_size + TABLE_INCREMENT;
|
||||
table = (ctx->memalloc)(table_size * sizeof(unsigned char *));
|
||||
RUNTIME_CHECK(table != NULL);
|
||||
ctx->malloced += table_size * sizeof(unsigned char *);
|
||||
if (ctx->malloced > ctx->maxmalloced)
|
||||
ctx->maxmalloced = ctx->malloced;
|
||||
@@ -380,7 +384,6 @@ more_basic_blocks(isc__mem_t *ctx) {
|
||||
}
|
||||
|
||||
tmp = (ctx->memalloc)(NUM_BASIC_BLOCKS * ctx->mem_target);
|
||||
RUNTIME_CHECK(tmp != NULL);
|
||||
ctx->total += NUM_BASIC_BLOCKS * ctx->mem_target;;
|
||||
ctx->basic_table[ctx->basic_table_count] = tmp;
|
||||
ctx->basic_table_count++;
|
||||
@@ -473,7 +476,6 @@ mem_getunlocked(isc__mem_t *ctx, size_t size) {
|
||||
* memget() was called on something beyond our upper limit.
|
||||
*/
|
||||
ret = (ctx->memalloc)(size);
|
||||
RUNTIME_CHECK(ret != NULL);
|
||||
ctx->total += size;
|
||||
ctx->inuse += size;
|
||||
ctx->stats[ctx->max_size].gets++;
|
||||
@@ -596,7 +598,6 @@ mem_get(isc__mem_t *ctx, size_t size) {
|
||||
size += 1;
|
||||
#endif
|
||||
ret = (ctx->memalloc)(size);
|
||||
RUNTIME_CHECK(ret != NULL);
|
||||
|
||||
if (ISC_UNLIKELY((ctx->flags & ISC_MEMFLAG_FILL) != 0)) {
|
||||
if (ISC_LIKELY(ret != NULL))
|
||||
@@ -723,10 +724,10 @@ initialize_action(void) {
|
||||
static void
|
||||
mem_create(isc_mem_t **ctxp, unsigned int flags)
|
||||
{
|
||||
isc__mem_t *ctx;
|
||||
|
||||
REQUIRE(ctxp != NULL && *ctxp == NULL);
|
||||
|
||||
isc__mem_t *ctx;
|
||||
|
||||
STATIC_ASSERT((ALIGNMENT_SIZE & (ALIGNMENT_SIZE - 1)) == 0,
|
||||
"wrong alignment size");
|
||||
|
||||
@@ -774,7 +775,6 @@ mem_create(isc_mem_t **ctxp, unsigned int flags)
|
||||
ctx->highest = NULL;
|
||||
|
||||
ctx->stats = (ctx->memalloc)((ctx->max_size+1) * sizeof(struct stats));
|
||||
RUNTIME_CHECK(ctx->stats != NULL);
|
||||
|
||||
memset(ctx->stats, 0, (ctx->max_size + 1) * sizeof(struct stats));
|
||||
ctx->malloced += (ctx->max_size+1) * sizeof(struct stats);
|
||||
@@ -784,7 +784,6 @@ mem_create(isc_mem_t **ctxp, unsigned int flags)
|
||||
ctx->mem_target = DEF_MEM_TARGET;
|
||||
ctx->freelists = (ctx->memalloc)(ctx->max_size *
|
||||
sizeof(element *));
|
||||
RUNTIME_CHECK(ctx->freelists != NULL);
|
||||
memset(ctx->freelists, 0,
|
||||
ctx->max_size * sizeof(element *));
|
||||
ctx->malloced += ctx->max_size * sizeof(element *);
|
||||
@@ -797,7 +796,6 @@ mem_create(isc_mem_t **ctxp, unsigned int flags)
|
||||
|
||||
ctx->debuglist = (ctx->memalloc)((DEBUG_TABLE_COUNT *
|
||||
sizeof(debuglist_t)));
|
||||
RUNTIME_CHECK(ctx->debuglist != NULL);
|
||||
for (i = 0; i < DEBUG_TABLE_COUNT; i++)
|
||||
ISC_LIST_INIT(ctx->debuglist[i]);
|
||||
ctx->malloced += DEBUG_TABLE_COUNT * sizeof(debuglist_t);
|
||||
@@ -895,11 +893,11 @@ destroy(isc__mem_t *ctx) {
|
||||
|
||||
void
|
||||
isc_mem_attach(isc_mem_t *source0, isc_mem_t **targetp) {
|
||||
isc__mem_t *source = (isc__mem_t *)source0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(source));
|
||||
REQUIRE(VALID_CONTEXT(source0));
|
||||
REQUIRE(targetp != NULL && *targetp == NULL);
|
||||
|
||||
isc__mem_t *source = (isc__mem_t *)source0;
|
||||
|
||||
isc_refcount_increment(&source->references);
|
||||
|
||||
*targetp = (isc_mem_t *)source;
|
||||
@@ -908,6 +906,7 @@ isc_mem_attach(isc_mem_t *source0, isc_mem_t **targetp) {
|
||||
void
|
||||
isc_mem_detach(isc_mem_t **ctxp) {
|
||||
REQUIRE(ctxp != NULL && VALID_CONTEXT(*ctxp));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)*ctxp;
|
||||
*ctxp = NULL;
|
||||
|
||||
@@ -931,6 +930,7 @@ void
|
||||
isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) {
|
||||
REQUIRE(ctxp != NULL && VALID_CONTEXT(*ctxp));
|
||||
REQUIRE(ptr != NULL);
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)*ctxp;
|
||||
*ctxp = NULL;
|
||||
|
||||
@@ -970,16 +970,14 @@ destroy:
|
||||
|
||||
void
|
||||
isc_mem_destroy(isc_mem_t **ctxp) {
|
||||
isc__mem_t *ctx;
|
||||
|
||||
/*
|
||||
* This routine provides legacy support for callers who use mctxs
|
||||
* without attaching/detaching.
|
||||
*/
|
||||
|
||||
REQUIRE(ctxp != NULL);
|
||||
ctx = (isc__mem_t *)*ctxp;
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(ctxp != NULL && VALID_CONTEXT(*ctxp));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)*ctxp;
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
if (isc_refcount_decrement(&ctx->references) > 1) {
|
||||
@@ -996,12 +994,12 @@ isc_mem_destroy(isc_mem_t **ctxp) {
|
||||
|
||||
void *
|
||||
isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
void *ptr;
|
||||
bool call_water = false;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
|
||||
if (ISC_UNLIKELY((isc_mem_debugging &
|
||||
(ISC_MEM_DEBUGSIZE|ISC_MEM_DEBUGCTX)) != 0))
|
||||
return (isc__mem_allocate(ctx0, size FLARG_PASS));
|
||||
@@ -1040,14 +1038,14 @@ isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
|
||||
void
|
||||
isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
REQUIRE(ptr != NULL);
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
bool call_water = false;
|
||||
size_info *si;
|
||||
size_t oldsize;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(ptr != NULL);
|
||||
|
||||
if (ISC_UNLIKELY((isc_mem_debugging &
|
||||
(ISC_MEM_DEBUGSIZE|ISC_MEM_DEBUGCTX)) != 0))
|
||||
{
|
||||
@@ -1092,9 +1090,9 @@ isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
|
||||
void
|
||||
isc_mem_waterack(isc_mem_t *ctx0, int flag) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
MCTXLOCK(ctx);
|
||||
if (flag == ISC_MEM_LOWATER)
|
||||
@@ -1144,12 +1142,13 @@ print_active(isc__mem_t *mctx, FILE *out) {
|
||||
*/
|
||||
void
|
||||
isc_mem_stats(isc_mem_t *ctx0, FILE *out) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t i;
|
||||
const struct stats *s;
|
||||
const isc__mempool_t *pool;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
MCTXLOCK(ctx);
|
||||
|
||||
for (i = 0; i <= ctx->max_size; i++) {
|
||||
@@ -1232,12 +1231,12 @@ mem_allocateunlocked(isc_mem_t *ctx0, size_t size) {
|
||||
|
||||
void *
|
||||
isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_info *si;
|
||||
bool call_water = false;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
|
||||
MCTXLOCK(ctx);
|
||||
si = mem_allocateunlocked((isc_mem_t *)ctx, size);
|
||||
if (((ctx->flags & ISC_MEMFLAG_INTERNAL) == 0)) {
|
||||
@@ -1274,12 +1273,11 @@ isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) {
|
||||
|
||||
void *
|
||||
isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
void *new_ptr = NULL;
|
||||
size_t oldsize, copysize;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
|
||||
/*
|
||||
* This function emulates the realloc(3) standard library function:
|
||||
* - if size > 0, allocate new memory; and if ptr is non NULL, copy
|
||||
@@ -1315,14 +1313,14 @@ isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
|
||||
|
||||
void
|
||||
isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
REQUIRE(ptr != NULL);
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_info *si;
|
||||
size_t size;
|
||||
bool call_water= false;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(ptr != NULL);
|
||||
|
||||
if (ISC_UNLIKELY((isc_mem_debugging & ISC_MEM_DEBUGCTX) != 0)) {
|
||||
si = &(((size_info *)ptr)[-2]);
|
||||
REQUIRE(si->u.ctx == ctx);
|
||||
@@ -1373,13 +1371,13 @@ isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) {
|
||||
|
||||
char *
|
||||
isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) {
|
||||
REQUIRE(VALID_CONTEXT(mctx0));
|
||||
REQUIRE(s != NULL);
|
||||
|
||||
isc__mem_t *mctx = (isc__mem_t *)mctx0;
|
||||
size_t len;
|
||||
char *ns;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(mctx));
|
||||
REQUIRE(s != NULL);
|
||||
|
||||
len = strlen(s) + 1;
|
||||
|
||||
ns = isc__mem_allocate((isc_mem_t *)mctx, len FLARG_PASS);
|
||||
@@ -1392,9 +1390,10 @@ isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) {
|
||||
|
||||
void
|
||||
isc_mem_setdestroycheck(isc_mem_t *ctx0, bool flag) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
MCTXLOCK(ctx);
|
||||
|
||||
ctx->checkfree = flag;
|
||||
@@ -1404,10 +1403,11 @@ isc_mem_setdestroycheck(isc_mem_t *ctx0, bool flag) {
|
||||
|
||||
size_t
|
||||
isc_mem_inuse(isc_mem_t *ctx0) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t inuse;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
MCTXLOCK(ctx);
|
||||
|
||||
inuse = ctx->inuse;
|
||||
@@ -1419,10 +1419,11 @@ isc_mem_inuse(isc_mem_t *ctx0) {
|
||||
|
||||
size_t
|
||||
isc_mem_maxinuse(isc_mem_t *ctx0) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t maxinuse;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
MCTXLOCK(ctx);
|
||||
|
||||
maxinuse = ctx->maxinuse;
|
||||
@@ -1434,10 +1435,11 @@ isc_mem_maxinuse(isc_mem_t *ctx0) {
|
||||
|
||||
size_t
|
||||
isc_mem_total(isc_mem_t *ctx0) {
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t total;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
MCTXLOCK(ctx);
|
||||
|
||||
total = ctx->total;
|
||||
@@ -1451,14 +1453,14 @@ void
|
||||
isc_mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg,
|
||||
size_t hiwater, size_t lowater)
|
||||
{
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
REQUIRE(hiwater >= lowater);
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
bool callwater = false;
|
||||
isc_mem_water_t oldwater;
|
||||
void *oldwater_arg;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(hiwater >= lowater);
|
||||
|
||||
MCTXLOCK(ctx);
|
||||
oldwater = ctx->water;
|
||||
oldwater_arg = ctx->water_arg;
|
||||
@@ -1486,9 +1488,9 @@ isc_mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg,
|
||||
|
||||
bool
|
||||
isc_mem_isovermem(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
/*
|
||||
* We don't bother to lock the context because 100% accuracy isn't
|
||||
@@ -1500,9 +1502,9 @@ isc_mem_isovermem(isc_mem_t *ctx0) {
|
||||
|
||||
void
|
||||
isc_mem_setname(isc_mem_t *ctx0, const char *name, void *tag) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
LOCK(&ctx->lock);
|
||||
strlcpy(ctx->name, name, sizeof(ctx->name));
|
||||
@@ -1512,9 +1514,9 @@ isc_mem_setname(isc_mem_t *ctx0, const char *name, void *tag) {
|
||||
|
||||
const char *
|
||||
isc_mem_getname(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
if (ctx->name[0] == 0)
|
||||
return ("");
|
||||
@@ -1524,9 +1526,9 @@ isc_mem_getname(isc_mem_t *ctx0) {
|
||||
|
||||
void *
|
||||
isc_mem_gettag(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
return (ctx->tag);
|
||||
}
|
||||
@@ -1535,21 +1537,20 @@ isc_mem_gettag(isc_mem_t *ctx0) {
|
||||
* Memory pool stuff
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) {
|
||||
isc__mem_t *mctx = (isc__mem_t *)mctx0;
|
||||
isc__mempool_t *mpctx;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(mctx));
|
||||
REQUIRE(VALID_CONTEXT(mctx0));
|
||||
REQUIRE(size > 0U);
|
||||
REQUIRE(mpctxp != NULL && *mpctxp == NULL);
|
||||
|
||||
isc__mem_t *mctx = (isc__mem_t *)mctx0;
|
||||
isc__mempool_t *mpctx;
|
||||
|
||||
/*
|
||||
* Allocate space for this pool, initialize values, and if all works
|
||||
* well, attach to the memory context.
|
||||
*/
|
||||
mpctx = isc_mem_get((isc_mem_t *)mctx, sizeof(isc__mempool_t));
|
||||
RUNTIME_CHECK(mpctx != NULL);
|
||||
|
||||
mpctx->common.impmagic = MEMPOOL_MAGIC;
|
||||
mpctx->common.magic = ISCAPI_MPOOL_MAGIC;
|
||||
@@ -1579,16 +1580,14 @@ isc_mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) {
|
||||
ISC_LIST_INITANDAPPEND(mctx->pools, mpctx, link);
|
||||
mctx->poolcnt++;
|
||||
MCTXUNLOCK(mctx);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
isc_mempool_setname(isc_mempool_t *mpctx0, const char *name) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
#if ISC_MEMPOOL_NAMES
|
||||
if (mpctx->lock != NULL)
|
||||
@@ -1606,14 +1605,15 @@ isc_mempool_setname(isc_mempool_t *mpctx0, const char *name) {
|
||||
|
||||
void
|
||||
isc_mempool_destroy(isc_mempool_t **mpctxp) {
|
||||
REQUIRE(mpctxp != NULL);
|
||||
REQUIRE(VALID_MEMPOOL(*mpctxp));
|
||||
|
||||
isc__mempool_t *mpctx;
|
||||
isc__mem_t *mctx;
|
||||
isc_mutex_t *lock;
|
||||
element *item;
|
||||
|
||||
REQUIRE(mpctxp != NULL);
|
||||
mpctx = (isc__mempool_t *)*mpctxp;
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
#if ISC_MEMPOOL_NAMES
|
||||
if (mpctx->allocated > 0)
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
@@ -1670,24 +1670,25 @@ isc_mempool_destroy(isc_mempool_t **mpctxp) {
|
||||
|
||||
void
|
||||
isc_mempool_associatelock(isc_mempool_t *mpctx0, isc_mutex_t *lock) {
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
REQUIRE(lock != NULL);
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
REQUIRE(mpctx->lock == NULL);
|
||||
REQUIRE(lock != NULL);
|
||||
|
||||
mpctx->lock = lock;
|
||||
}
|
||||
|
||||
void *
|
||||
isc__mempool_get(isc_mempool_t *mpctx0 FLARG) {
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
element *item;
|
||||
isc__mem_t *mctx;
|
||||
unsigned int i;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
mctx = mpctx->mctx;
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
@@ -1757,14 +1758,12 @@ isc__mempool_get(isc_mempool_t *mpctx0 FLARG) {
|
||||
/* coverity[+free : arg-1] */
|
||||
void
|
||||
isc__mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
isc__mem_t *mctx;
|
||||
element *item;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
REQUIRE(mem != NULL);
|
||||
|
||||
mctx = mpctx->mctx;
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
isc__mem_t *mctx = mpctx->mctx;
|
||||
element *item;
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
@@ -1815,9 +1814,9 @@ isc__mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) {
|
||||
|
||||
void
|
||||
isc_mempool_setfreemax(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
@@ -1830,11 +1829,11 @@ isc_mempool_setfreemax(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
|
||||
unsigned int
|
||||
isc_mempool_getfreemax(isc_mempool_t *mpctx0) {
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
unsigned int freemax;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
|
||||
@@ -1848,10 +1847,11 @@ isc_mempool_getfreemax(isc_mempool_t *mpctx0) {
|
||||
|
||||
unsigned int
|
||||
isc_mempool_getfreecount(isc_mempool_t *mpctx0) {
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
unsigned int freecount;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
@@ -1866,11 +1866,10 @@ isc_mempool_getfreecount(isc_mempool_t *mpctx0) {
|
||||
|
||||
void
|
||||
isc_mempool_setmaxalloc(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
REQUIRE(limit > 0);
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
@@ -1883,11 +1882,11 @@ isc_mempool_setmaxalloc(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
|
||||
unsigned int
|
||||
isc_mempool_getmaxalloc(isc_mempool_t *mpctx0) {
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
unsigned int maxalloc;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
|
||||
@@ -1901,10 +1900,11 @@ isc_mempool_getmaxalloc(isc_mempool_t *mpctx0) {
|
||||
|
||||
unsigned int
|
||||
isc_mempool_getallocated(isc_mempool_t *mpctx0) {
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
unsigned int allocated;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
@@ -1919,10 +1919,10 @@ isc_mempool_getallocated(isc_mempool_t *mpctx0) {
|
||||
|
||||
void
|
||||
isc_mempool_setfillcount(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
REQUIRE(limit > 0);
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
@@ -1935,12 +1935,12 @@ isc_mempool_setfillcount(isc_mempool_t *mpctx0, unsigned int limit) {
|
||||
|
||||
unsigned int
|
||||
isc_mempool_getfillcount(isc_mempool_t *mpctx0) {
|
||||
REQUIRE(VALID_MEMPOOL(mpctx0));
|
||||
|
||||
isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0;
|
||||
|
||||
unsigned int fillcount;
|
||||
|
||||
REQUIRE(VALID_MEMPOOL(mpctx));
|
||||
|
||||
if (mpctx->lock != NULL)
|
||||
LOCK(mpctx->lock);
|
||||
|
||||
@@ -2013,10 +2013,10 @@ static int
|
||||
xml_renderctx(isc__mem_t *ctx, summarystat_t *summary,
|
||||
xmlTextWriterPtr writer)
|
||||
{
|
||||
int xmlrc;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
|
||||
int xmlrc;
|
||||
|
||||
MCTXLOCK(ctx);
|
||||
|
||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "context"));
|
||||
@@ -2198,13 +2198,13 @@ isc_mem_renderxml(void *writer0) {
|
||||
|
||||
static isc_result_t
|
||||
json_renderctx(isc__mem_t *ctx, summarystat_t *summary, json_object *array) {
|
||||
json_object *ctxobj, *obj;
|
||||
char buf[1024];
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(summary != NULL);
|
||||
REQUIRE(array != NULL);
|
||||
|
||||
json_object *ctxobj, *obj;
|
||||
char buf[1024];
|
||||
|
||||
MCTXLOCK(ctx);
|
||||
|
||||
summary->contextsize += sizeof(*ctx) +
|
||||
@@ -2411,11 +2411,11 @@ isc__mem_free(isc_mem_t *mctx, void *ptr FLARG) {
|
||||
void
|
||||
isc__mem_printactive(isc_mem_t *ctx0, FILE *file) {
|
||||
#if ISC_MEM_TRACKLINES
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(VALID_CONTEXT(ctx0));
|
||||
REQUIRE(file != NULL);
|
||||
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
print_active(ctx, file);
|
||||
#else
|
||||
UNUSED(ctx0);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "uv-compat.h"
|
||||
|
||||
#define ISC_NETMGR_TID_UNKNOWN -1
|
||||
|
||||
#define ISC_NETMGR_RECVBUF_SIZE (20*65536)
|
||||
/*
|
||||
* Single network event loop worker.
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ typedef struct isc__networker {
|
||||
* worker is paused */
|
||||
isc_refcount_t references;
|
||||
atomic_int_fast64_t pktcount;
|
||||
char recvbuf[65536];
|
||||
char * recvbuf;
|
||||
bool recvbuf_inuse;
|
||||
} isc__networker_t;
|
||||
|
||||
|
||||
+11
-6
@@ -210,6 +210,7 @@ isc_nm_start(isc_mem_t *mctx, uint32_t workers) {
|
||||
|
||||
worker->ievents = isc_queue_new(mgr->mctx, 128);
|
||||
worker->ievents_prio = isc_queue_new(mgr->mctx, 128);
|
||||
worker->recvbuf = isc_mem_get(mctx, ISC_NETMGR_RECVBUF_SIZE);
|
||||
|
||||
/*
|
||||
* We need to do this here and not in nm_thread to avoid a
|
||||
@@ -281,6 +282,7 @@ nm_destroy(isc_nm_t **mgr0) {
|
||||
|
||||
isc_queue_destroy(worker->ievents);
|
||||
isc_queue_destroy(worker->ievents_prio);
|
||||
isc_mem_put(mgr->mctx, worker->recvbuf, ISC_NETMGR_RECVBUF_SIZE);
|
||||
isc_thread_join(worker->thread, NULL);
|
||||
}
|
||||
|
||||
@@ -921,8 +923,8 @@ isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
||||
.iface = iface,
|
||||
.fd = -1,
|
||||
.ah_size = 32,
|
||||
.inactivehandles = isc_astack_new(mgr->mctx, 60),
|
||||
.inactivereqs = isc_astack_new(mgr->mctx, 60)
|
||||
.inactivehandles = isc_astack_new(mgr->mctx, 600),
|
||||
.inactivereqs = isc_astack_new(mgr->mctx, 600)
|
||||
};
|
||||
|
||||
isc_nm_attach(mgr, &sock->mgr);
|
||||
@@ -956,8 +958,8 @@ isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
||||
} else {
|
||||
sock->statsindex = tcp6statsindex;
|
||||
}
|
||||
break;
|
||||
isc__nm_incstats(sock->mgr, sock->statsindex[STATID_ACTIVE]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -982,14 +984,14 @@ isc__nm_alloc_cb(uv_handle_t *handle, size_t size, uv_buf_t *buf) {
|
||||
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
REQUIRE(isc__nm_in_netthread());
|
||||
REQUIRE(size <= 65536);
|
||||
REQUIRE(size <= ISC_NETMGR_RECVBUF_SIZE);
|
||||
|
||||
worker = &sock->mgr->workers[sock->tid];
|
||||
INSIST(!worker->recvbuf_inuse);
|
||||
|
||||
buf->base = worker->recvbuf;
|
||||
worker->recvbuf_inuse = true;
|
||||
buf->len = size;
|
||||
buf->len = ISC_NETMGR_RECVBUF_SIZE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1004,8 +1006,11 @@ isc__nm_free_uvbuf(isc_nmsocket_t *sock, const uv_buf_t *buf) {
|
||||
worker = &sock->mgr->workers[sock->tid];
|
||||
|
||||
REQUIRE(worker->recvbuf_inuse);
|
||||
if (buf->base > worker->recvbuf && buf->base <= worker->recvbuf + ISC_NETMGR_RECVBUF_SIZE) {
|
||||
/* Can happen in case of recvmmsg */
|
||||
return;
|
||||
}
|
||||
REQUIRE(buf->base == worker->recvbuf);
|
||||
|
||||
worker->recvbuf_inuse = false;
|
||||
}
|
||||
|
||||
|
||||
+13
-5
@@ -291,8 +291,8 @@ udp_recv_cb(uv_udp_t *handle, ssize_t nrecv, const uv_buf_t *buf,
|
||||
isc_result_t result;
|
||||
isc_nmhandle_t *nmhandle = NULL;
|
||||
isc_sockaddr_t sockaddr;
|
||||
isc_sockaddr_t localaddr;
|
||||
struct sockaddr_storage laddr;
|
||||
/* isc_sockaddr_t localaddr;
|
||||
struct sockaddr_storage laddr; */
|
||||
isc_nmsocket_t *sock = uv_handle_get_data((uv_handle_t *)handle);
|
||||
isc_region_t region;
|
||||
uint32_t maxudp;
|
||||
@@ -326,13 +326,13 @@ udp_recv_cb(uv_udp_t *handle, ssize_t nrecv, const uv_buf_t *buf,
|
||||
|
||||
result = isc_sockaddr_fromsockaddr(&sockaddr, addr);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
uv_udp_getsockname(handle, (struct sockaddr *) &laddr,
|
||||
/* uv_udp_getsockname(handle, (struct sockaddr *) &laddr,
|
||||
&(int){sizeof(struct sockaddr_storage)});
|
||||
result = isc_sockaddr_fromsockaddr(&localaddr,
|
||||
(struct sockaddr *) &laddr);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS); */
|
||||
|
||||
nmhandle = isc__nmhandle_get(sock, &sockaddr, &localaddr);
|
||||
nmhandle = isc__nmhandle_get(sock, &sockaddr, NULL);
|
||||
region.base = (unsigned char *) buf->base;
|
||||
region.length = nrecv;
|
||||
|
||||
@@ -391,8 +391,16 @@ isc__nm_udp_send(isc_nmhandle_t *handle, isc_region_t *region,
|
||||
return (ISC_R_CANCELED);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're in netthread - send it directly
|
||||
* If the original packet was received over a regular socket
|
||||
* - send it over the same thread (assuming cpu affinity)
|
||||
* Otherwise - use a random thread.
|
||||
*/
|
||||
if (isc__nm_in_netthread()) {
|
||||
ntid = isc_nm_tid();
|
||||
} else if (sock->type == isc_nm_udpsocket) {
|
||||
ntid = sock->tid;
|
||||
} else {
|
||||
ntid = (int) isc_random_uniform(sock->nchildren);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <isc/util.h>
|
||||
#include "uv-compat.h"
|
||||
|
||||
#ifndef HAVE_UV_IMPORT
|
||||
/*
|
||||
* XXXWPK: This code goes into libuv internals and it's platform dependent.
|
||||
* It's ugly, we shouldn't do it, but the alternative with passing sockets
|
||||
@@ -190,3 +191,5 @@ isc_uv_import(uv_stream_t *stream, isc_uv_stream_info_t *info) {
|
||||
return (uv_tcp_open(tcp, info->fd));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,14 @@ uv_handle_set_data(uv_handle_t *handle, void *data) {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UV_IMPORT
|
||||
|
||||
#define isc_uv_stream_info_t uv_stream_info_t
|
||||
#define isc_uv_export uv_export
|
||||
#define isc_uv_import uv_import
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* These functions are not available in libuv, but they're very internal
|
||||
* to libuv. We should try to get them merged upstream.
|
||||
@@ -69,3 +77,5 @@ isc_uv_import(uv_stream_t *stream, isc_uv_stream_info_t *info);
|
||||
* Imports uv_stream_info_t value into uv_stream_t to initialize a
|
||||
* shared stream.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
+8
-6
@@ -14,6 +14,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
@@ -21,6 +22,7 @@
|
||||
#include <isc/platform.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/stdio.h>
|
||||
#include <isc/strerr.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/thread.h>
|
||||
#include <isc/util.h>
|
||||
@@ -151,8 +153,12 @@ pk11_mem_get(size_t size) {
|
||||
ptr = isc_mem_get(pk11_mctx, size);
|
||||
else {
|
||||
ptr = malloc(size);
|
||||
if (ptr != NULL)
|
||||
allocsize += (int)size;
|
||||
if (ptr == NULL && size != 0) {
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
isc_error_fatal(__FILE__, __LINE__, "malloc failed: %s",
|
||||
strbuf);
|
||||
}
|
||||
}
|
||||
UNLOCK(&alloclock);
|
||||
|
||||
@@ -323,8 +329,6 @@ pk11_get_session(pk11_context_t *ctx, pk11_optype_t optype,
|
||||
UNLOCK(&sessionlock);
|
||||
|
||||
sp = pk11_mem_get(sizeof(*sp));
|
||||
if (sp == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
sp->magic = SES_MAGIC;
|
||||
sp->token = token;
|
||||
sp->session = CK_INVALID_HANDLE;
|
||||
@@ -479,7 +483,6 @@ scan_slots(void) {
|
||||
if (slotCount == 0)
|
||||
return;
|
||||
slotList = pk11_mem_get(sizeof(CK_SLOT_ID) * slotCount);
|
||||
RUNTIME_CHECK(slotList != NULL);
|
||||
PK11_FATALCHECK(pkcs_C_GetSlotList, (CK_FALSE, slotList, &slotCount));
|
||||
|
||||
for (i = 0; i < slotCount; i++) {
|
||||
@@ -490,7 +493,6 @@ scan_slots(void) {
|
||||
if (rv != CKR_OK)
|
||||
continue;
|
||||
token = pk11_mem_get(sizeof(*token));
|
||||
RUNTIME_CHECK(token != NULL);
|
||||
token->magic = TOK_MAGIC;
|
||||
token->slotid = slot;
|
||||
ISC_LINK_INIT(token, link);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user