From c8aa1ee9e6d763a1da577e2bab22d80c58c23ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Kr=C4=99cicki?= Date: Thu, 5 Apr 2018 16:27:36 +0200 Subject: [PATCH] libdns refactoring: get rid of multiple versions of dns_dt_create, dns_view_setcache, dns_zt_apply, dns_message_logfmtpacket, dns_message_logpacket, dns_ssutable_checkrules and dns_ttl_totext --- bin/named/server.c | 8 ++--- bin/named/statschannel.c | 8 +++-- bin/tests/optional/adb_test.c | 2 +- bin/tests/optional/byaddr_test.c | 2 +- bin/tests/optional/byname_test.c | 2 +- contrib/sdb/bdb/zone2bdb.c | 2 +- lib/dns/dnstap.c | 11 ++----- lib/dns/include/dns/dnstap.h | 8 ++--- lib/dns/include/dns/message.h | 16 +++------ lib/dns/include/dns/ssu.h | 4 --- lib/dns/include/dns/ttl.h | 5 +-- lib/dns/include/dns/view.h | 4 +-- lib/dns/include/dns/zt.h | 6 +--- lib/dns/masterdump.c | 5 +-- lib/dns/message.c | 31 ++++-------------- lib/dns/rdata/generic/soa_6.c | 3 +- lib/dns/resolver.c | 56 ++++++++++++++++---------------- lib/dns/ssu.c | 14 ++------ lib/dns/tests/dnstap_test.c | 8 ++--- lib/dns/tests/zt_test.c | 3 +- lib/dns/ttl.c | 9 ++--- lib/dns/view.c | 9 ++--- lib/dns/win32/libdns.def.in | 7 ---- lib/dns/xfrin.c | 10 +++--- lib/dns/zt.c | 19 ++++------- lib/ns/tests/nstest.c | 2 +- lib/ns/update.c | 16 ++++----- 27 files changed, 96 insertions(+), 174 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index 789b064949..515127dbc5 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -4229,7 +4229,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, ISC_LINK_INIT(nsc, link); ISC_LIST_APPEND(*cachelist, nsc, link); } - dns_view_setcache2(view, cache, shared_cache); + dns_view_setcache(view, cache, shared_cache); /* * cache-file cannot be inherited if views are present, but this @@ -9013,7 +9013,7 @@ load_configuration(const char *filename, named_server_t *server, { dns_view_setviewrevert(view); (void)dns_zt_apply(view->zonetable, ISC_FALSE, - removed, view); + NULL, removed, view); } dns_view_detach(&view); } @@ -10380,7 +10380,7 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) { ISC_LIST_INIT(vle->zonelist); ISC_LIST_APPEND(dctx->viewlist, vle, link); if (dctx->dumpzones) - result = dns_zt_apply(view->zonetable, ISC_TRUE, + result = dns_zt_apply(view->zonetable, ISC_TRUE, NULL, add_zone_tolist, dctx); return (result); } @@ -11622,7 +11622,7 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) { view != NULL; view = ISC_LIST_NEXT(view, link)) { result = dns_zt_apply(view->zonetable, ISC_FALSE, - synczone, &cleanup); + NULL, synczone, &cleanup); if (result != ISC_R_SUCCESS && tresult == ISC_R_SUCCESS) tresult = result; diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 0080ead9c0..760aaa7952 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -1916,7 +1916,7 @@ generatexml(named_server_t *server, isc_uint32_t flags, TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "zones")); result = dns_zt_apply(view->zonetable, ISC_TRUE, - zone_xmlrender, writer); + NULL, zone_xmlrender, writer); if (result != ISC_R_SUCCESS) goto error; TRY0(xmlTextWriterEndElement(writer)); /* /zones */ @@ -2609,8 +2609,10 @@ generatejson(named_server_t *server, size_t *msglen, CHECKMEM(za); if ((flags & STATS_JSON_ZONES) != 0) { - result = dns_zt_apply(view->zonetable, ISC_TRUE, - zone_jsonrender, za); + result = dns_zt_apply(view->zonetable, + ISC_TRUE, + NULL, zone_jsonrender, + za); if (result != ISC_R_SUCCESS) { goto error; } diff --git a/bin/tests/optional/adb_test.c b/bin/tests/optional/adb_test.c index 0d6995d9c3..2dfaa09a8c 100644 --- a/bin/tests/optional/adb_test.c +++ b/bin/tests/optional/adb_test.c @@ -184,7 +184,7 @@ create_view(void) { dns_rdataclass_in, "", "rbt", 0, NULL, &cache); check_result(result, "dns_cache_create"); - dns_view_setcache(view, cache); + dns_view_setcache(view, cache, ISC_FALSE); dns_cache_detach(&cache); { diff --git a/bin/tests/optional/byaddr_test.c b/bin/tests/optional/byaddr_test.c index 7d95c05bb5..8089942d20 100644 --- a/bin/tests/optional/byaddr_test.c +++ b/bin/tests/optional/byaddr_test.c @@ -205,7 +205,7 @@ main(int argc, char *argv[]) { == ISC_R_SUCCESS); } - dns_view_setcache(view, cache); + dns_view_setcache(view, cache, ISC_FALSE); dns_view_freeze(view); dns_cache_detach(&cache); diff --git a/bin/tests/optional/byname_test.c b/bin/tests/optional/byname_test.c index 89c9a263dd..384e5b01da 100644 --- a/bin/tests/optional/byname_test.c +++ b/bin/tests/optional/byname_test.c @@ -322,7 +322,7 @@ main(int argc, char *argv[]) { == ISC_R_SUCCESS); } - dns_view_setcache(view, cache); + dns_view_setcache(view, cache, ISC_FALSE); dns_view_freeze(view); dns_cache_detach(&cache); diff --git a/contrib/sdb/bdb/zone2bdb.c b/contrib/sdb/bdb/zone2bdb.c index 1d92804b65..7db731eb8a 100644 --- a/contrib/sdb/bdb/zone2bdb.c +++ b/contrib/sdb/bdb/zone2bdb.c @@ -77,7 +77,7 @@ bdb_putrdata(DB *db, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) isc_buffer_init(&databuf, rdatatext, MAX_RDATATEXT); - dns_ttl_totext(ttl, ISC_FALSE, &databuf); + dns_ttl_totext(ttl, ISC_FALSE, ISC_TRUE, &databuf); *(char *)isc_buffer_used(&databuf) = ' '; isc_buffer_add(&databuf, 1); diff --git a/lib/dns/dnstap.c b/lib/dns/dnstap.c index 54ae1e9cd9..35b325f207 100644 --- a/lib/dns/dnstap.c +++ b/lib/dns/dnstap.c @@ -185,15 +185,8 @@ unlock: isc_result_t dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path, - struct fstrm_iothr_options **foptp, dns_dtenv_t **envp) -{ - return (dns_dt_create2(mctx, mode, path, foptp, NULL, envp)); -} - -isc_result_t -dns_dt_create2(isc_mem_t *mctx, dns_dtmode_t mode, const char *path, - struct fstrm_iothr_options **foptp, isc_task_t *reopen_task, - dns_dtenv_t **envp) + struct fstrm_iothr_options **foptp, isc_task_t *reopen_task, + dns_dtenv_t **envp) { isc_result_t result = ISC_R_SUCCESS; fstrm_res res; diff --git a/lib/dns/include/dns/dnstap.h b/lib/dns/include/dns/dnstap.h index 54d3f9474e..a37ed1a74c 100644 --- a/lib/dns/include/dns/dnstap.h +++ b/lib/dns/include/dns/dnstap.h @@ -118,12 +118,8 @@ struct dns_dtdata { isc_result_t dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path, - struct fstrm_iothr_options **foptp, dns_dtenv_t **envp); - -isc_result_t -dns_dt_create2(isc_mem_t *mctx, dns_dtmode_t mode, const char *path, - struct fstrm_iothr_options **foptp, isc_task_t *reopen_task, - dns_dtenv_t **envp); + struct fstrm_iothr_options **foptp, isc_task_t *reopen_task, + dns_dtenv_t **envp); /*%< * Create and initialize the dnstap environment. * diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index 58839cfd29..3d8493e409 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -1375,25 +1375,17 @@ dns_message_gettimeadjust(dns_message_t *msg); */ void -dns_message_logpacket(dns_message_t *message, const char *description, +dns_message_logpacket(dns_message_t *message, + const char *description, const isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_mem_t *mctx); -void -dns_message_logpacket2(dns_message_t *message, - const char *description, const isc_sockaddr_t *address, - isc_logcategory_t *category, isc_logmodule_t *module, - int level, isc_mem_t *mctx); + void dns_message_logfmtpacket(dns_message_t *message, const char *description, + const isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, const dns_master_style_t *style, int level, isc_mem_t *mctx); -void -dns_message_logfmtpacket2(dns_message_t *message, const char *description, - const isc_sockaddr_t *address, - isc_logcategory_t *category, isc_logmodule_t *module, - const dns_master_style_t *style, int level, - isc_mem_t *mctx); /*%< * Log 'message' at the specified logging parameters. * diff --git a/lib/dns/include/dns/ssu.h b/lib/dns/include/dns/ssu.h index 281ca2f2e0..ed7f61e3d0 100644 --- a/lib/dns/include/dns/ssu.h +++ b/lib/dns/include/dns/ssu.h @@ -129,10 +129,6 @@ dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant, isc_boolean_t dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer, - const dns_name_t *name, const isc_netaddr_t *addr, - dns_rdatatype_t type, const dst_key_t *key); -isc_boolean_t -dns_ssutable_checkrules2(dns_ssutable_t *table, const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *addr, isc_boolean_t tcp, const dns_aclenv_t *env, dns_rdatatype_t type, const dst_key_t *key); diff --git a/lib/dns/include/dns/ttl.h b/lib/dns/include/dns/ttl.h index 887f4cb583..ea26d09ebd 100644 --- a/lib/dns/include/dns/ttl.h +++ b/lib/dns/include/dns/ttl.h @@ -31,10 +31,7 @@ ISC_LANG_BEGINDECLS isc_result_t dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, - isc_buffer_t *target); -isc_result_t -dns_ttl_totext2(isc_uint32_t src, isc_boolean_t verbose, - isc_boolean_t upcase, isc_buffer_t *target); + isc_boolean_t upcase, isc_buffer_t *target); /*%< * Output a TTL or other time interval in a human-readable form. * The time interval is given as a count of seconds in 'src'. diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index a28bd7b410..df49832e5d 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -416,9 +416,7 @@ dns_view_createresolver(dns_view_t *view, */ void -dns_view_setcache(dns_view_t *view, dns_cache_t *cache); -void -dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared); +dns_view_setcache(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared); /*%< * Set the view's cache database. If 'shared' is true, this means the cache * is created by another view and is shared with that view. dns_view_setcache() diff --git a/lib/dns/include/dns/zt.h b/lib/dns/include/dns/zt.h index 0af2a1aee3..1194a9ac97 100644 --- a/lib/dns/include/dns/zt.h +++ b/lib/dns/include/dns/zt.h @@ -172,12 +172,8 @@ dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze); */ isc_result_t -dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, +dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, isc_result_t (*action)(dns_zone_t *, void *), void *uap); - -isc_result_t -dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, - isc_result_t (*action)(dns_zone_t *, void *), void *uap); /*%< * Apply a given 'action' to all zone zones in the table. * If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 6fd0d29a40..28dad9061a 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -558,7 +558,7 @@ rdataset_totext(dns_rdataset_t *rdataset, INDENT_TO(ttl_column); if ((ctx->style.flags & DNS_STYLEFLAG_TTL_UNITS) != 0) { length = target->used; - result = dns_ttl_totext2(rdataset->ttl, + result = dns_ttl_totext(rdataset->ttl, ISC_FALSE, ISC_FALSE, target); if (result != ISC_R_SUCCESS) @@ -880,7 +880,8 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name, { isc_buffer_clear(buffer); result = dns_ttl_totext(rdataset->ttl, - ISC_TRUE, buffer); + ISC_TRUE, ISC_TRUE, + buffer); INSIST(result == ISC_R_SUCCESS); isc_buffer_usedregion(buffer, &r); fprintf(f, "$TTL %u\t; %.*s\n", rdataset->ttl, diff --git a/lib/dns/message.c b/lib/dns/message.c index e3f2858e33..cb1aaa1b1e 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -3604,6 +3604,7 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, ADD_STRING(target, buf); ADD_STRING(target, " ("); result = dns_ttl_totext(secs, + ISC_TRUE, ISC_TRUE, target); if (result != ISC_R_SUCCESS) @@ -3855,6 +3856,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg, ADD_STRING(target, buf); ADD_STRING(target, " ("); result = dns_ttl_totext(secs, + ISC_TRUE, ISC_TRUE, target); if (result != ISC_R_SUCCESS) @@ -4248,19 +4250,10 @@ dns_opcode_totext(dns_opcode_t opcode, isc_buffer_t *target) { } void -dns_message_logpacket(dns_message_t *message, const char *description, +dns_message_logpacket(dns_message_t *message, + const char *description, const isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_mem_t *mctx) -{ - logfmtpacket(message, description, NULL, category, module, - &dns_master_style_debug, level, mctx); -} - -void -dns_message_logpacket2(dns_message_t *message, - const char *description, const isc_sockaddr_t *address, - isc_logcategory_t *category, isc_logmodule_t *module, - int level, isc_mem_t *mctx) { REQUIRE(address != NULL); @@ -4269,22 +4262,12 @@ dns_message_logpacket2(dns_message_t *message, } void -dns_message_logfmtpacket(dns_message_t *message, const char *description, +dns_message_logfmtpacket(dns_message_t *message, + const char *description, + const isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, const dns_master_style_t *style, int level, isc_mem_t *mctx) -{ - logfmtpacket(message, description, NULL, category, module, style, - level, mctx); -} - -void -dns_message_logfmtpacket2(dns_message_t *message, - const char *description, - const isc_sockaddr_t *address, - isc_logcategory_t *category, isc_logmodule_t *module, - const dns_master_style_t *style, int level, - isc_mem_t *mctx) { REQUIRE(address != NULL); diff --git a/lib/dns/rdata/generic/soa_6.c b/lib/dns/rdata/generic/soa_6.c index 25f5e100d1..3ab5f5ec04 100644 --- a/lib/dns/rdata/generic/soa_6.c +++ b/lib/dns/rdata/generic/soa_6.c @@ -138,7 +138,8 @@ totext_soa(ARGS_TOTEXT) { /* Print times in week/day/hour/minute/second form */ if (i >= 1) { RETERR(str_totext(" (", target)); - RETERR(dns_ttl_totext(num, ISC_TRUE, target)); + RETERR(dns_ttl_totext(num, ISC_TRUE, + ISC_TRUE, target)); RETERR(str_totext(")", target)); } RETERR(str_totext(tctx->linebreak, target)); diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 3933147791..d8a83e4e58 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -2762,13 +2762,13 @@ resquery_send(resquery_t *query) { /* * Log the outgoing packet. */ - dns_message_logfmtpacket2(fctx->qmessage, "sending packet to", - &query->addrinfo->sockaddr, - DNS_LOGCATEGORY_RESOLVER, - DNS_LOGMODULE_PACKETS, - &dns_master_style_comment, - ISC_LOG_DEBUG(11), - fctx->res->mctx); + dns_message_logfmtpacket(fctx->qmessage, "sending packet to", + &query->addrinfo->sockaddr, + DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_PACKETS, + &dns_master_style_comment, + ISC_LOG_DEBUG(11), + fctx->res->mctx); /* * We're now done with the query message. @@ -7692,13 +7692,13 @@ rctx_edns(respctx_t *rctx) { fctx->rmessage->rcode == dns_rcode_yxdomain) && bad_edns(fctx, &query->addrinfo->sockaddr)) { - dns_message_logpacket2(fctx->rmessage, - "received packet (bad edns) from", - &query->addrinfo->sockaddr, - DNS_LOGCATEGORY_RESOLVER, - DNS_LOGMODULE_RESOLVER, - ISC_LOG_DEBUG(3), - fctx->res->mctx); + dns_message_logpacket(fctx->rmessage, + "received packet (bad edns) from", + &query->addrinfo->sockaddr, + DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, + ISC_LOG_DEBUG(3), + fctx->res->mctx); dns_adb_changeflags(fctx->adb, query->addrinfo, DNS_FETCHOPT_NOEDNS0, DNS_FETCHOPT_NOEDNS0); @@ -7720,12 +7720,12 @@ rctx_edns(respctx_t *rctx) { * should be safe to do for any rcode we limit it to NOERROR * and NXDOMAIN. */ - dns_message_logpacket2(fctx->rmessage, - "received packet (no opt) from", - &query->addrinfo->sockaddr, - DNS_LOGCATEGORY_RESOLVER, - DNS_LOGMODULE_RESOLVER, - ISC_LOG_DEBUG(3), fctx->res->mctx); + dns_message_logpacket(fctx->rmessage, + "received packet (no opt) from", + &query->addrinfo->sockaddr, + DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, + ISC_LOG_DEBUG(3), fctx->res->mctx); dns_adb_changeflags(fctx->adb, query->addrinfo, DNS_FETCHOPT_NOEDNS0, DNS_FETCHOPT_NOEDNS0); @@ -9221,14 +9221,14 @@ rctx_logpacket(respctx_t *rctx) { isc_buffer_t zb; #endif /* HAVE_DNSTAP */ - dns_message_logfmtpacket2(rctx->fctx->rmessage, - "received packet from", - &rctx->query->addrinfo->sockaddr, - DNS_LOGCATEGORY_RESOLVER, - DNS_LOGMODULE_PACKETS, - &dns_master_style_comment, - ISC_LOG_DEBUG(10), - rctx->fctx->res->mctx); + dns_message_logfmtpacket(rctx->fctx->rmessage, + "received packet from", + &rctx->query->addrinfo->sockaddr, + DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_PACKETS, + &dns_master_style_comment, + ISC_LOG_DEBUG(10), + rctx->fctx->res->mctx); #ifdef HAVE_DNSTAP /* diff --git a/lib/dns/ssu.c b/lib/dns/ssu.c index 2fc9c61435..12894068dd 100644 --- a/lib/dns/ssu.c +++ b/lib/dns/ssu.c @@ -343,19 +343,9 @@ stf_from_address(dns_name_t *stfself, const isc_netaddr_t *tcpaddr) { isc_boolean_t dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer, - const dns_name_t *name, const isc_netaddr_t *tcpaddr, + const dns_name_t *name, const isc_netaddr_t *addr, + isc_boolean_t tcp, const dns_aclenv_t *env, dns_rdatatype_t type, const dst_key_t *key) -{ - return (dns_ssutable_checkrules2 - (table, signer, name, tcpaddr, - tcpaddr == NULL ? ISC_FALSE : ISC_TRUE, - NULL, type, key)); -} -isc_boolean_t -dns_ssutable_checkrules2(dns_ssutable_t *table, const dns_name_t *signer, - const dns_name_t *name, const isc_netaddr_t *addr, - isc_boolean_t tcp, const dns_aclenv_t *env, - dns_rdatatype_t type, const dst_key_t *key) { dns_ssurule_t *rule; unsigned int i; diff --git a/lib/dns/tests/dnstap_test.c b/lib/dns/tests/dnstap_test.c index 9f9f09c297..c21a28aedc 100644 --- a/lib/dns/tests/dnstap_test.c +++ b/lib/dns/tests/dnstap_test.c @@ -72,7 +72,7 @@ ATF_TC_BODY(create, tc) { ATF_REQUIRE(fopt != NULL); fstrm_iothr_options_set_num_input_queues(fopt, 1); - result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, &dtenv); + result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, NULL, &dtenv); ATF_CHECK_EQ(result, ISC_R_SUCCESS); if (dtenv != NULL) dns_dt_detach(&dtenv); @@ -85,7 +85,7 @@ ATF_TC_BODY(create, tc) { ATF_REQUIRE(fopt != NULL); fstrm_iothr_options_set_num_input_queues(fopt, 1); - result = dns_dt_create(mctx, dns_dtmode_unix, TAPSOCK, &fopt, &dtenv); + result = dns_dt_create(mctx, dns_dtmode_unix, TAPSOCK, &fopt, NULL, &dtenv); ATF_CHECK_EQ(result, ISC_R_SUCCESS); if (dtenv != NULL) dns_dt_detach(&dtenv); @@ -99,7 +99,7 @@ ATF_TC_BODY(create, tc) { ATF_REQUIRE(fopt != NULL); fstrm_iothr_options_set_num_input_queues(fopt, 1); - result = dns_dt_create(mctx, 33, TAPSOCK, &fopt, &dtenv); + result = dns_dt_create(mctx, 33, TAPSOCK, &fopt, NULL, &dtenv); ATF_CHECK_EQ(result, ISC_R_FAILURE); ATF_CHECK_EQ(dtenv, NULL); if (dtenv != NULL) @@ -154,7 +154,7 @@ ATF_TC_BODY(send, tc) { ATF_REQUIRE(fopt != NULL); fstrm_iothr_options_set_num_input_queues(fopt, 1); - result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, &dtenv); + result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, NULL, &dtenv); ATF_REQUIRE(result == ISC_R_SUCCESS); dns_dt_attach(dtenv, &view->dtenv); diff --git a/lib/dns/tests/zt_test.c b/lib/dns/tests/zt_test.c index bf3b96bbc4..6fed4a4769 100644 --- a/lib/dns/tests/zt_test.c +++ b/lib/dns/tests/zt_test.c @@ -118,7 +118,8 @@ ATF_TC_BODY(apply, tc) { ATF_REQUIRE(view->zonetable != NULL); ATF_CHECK_EQ(0, nzones); - result = dns_zt_apply(view->zonetable, ISC_FALSE, count_zone, &nzones); + result = dns_zt_apply(view->zonetable, ISC_FALSE, NULL, count_zone, + &nzones); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK_EQ(1, nzones); diff --git a/lib/dns/ttl.c b/lib/dns/ttl.c index 1f75daf333..557058ea16 100644 --- a/lib/dns/ttl.c +++ b/lib/dns/ttl.c @@ -72,13 +72,8 @@ ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose, * Derived from bind8 ns_format_ttl(). */ isc_result_t -dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target) { - return (dns_ttl_totext2(src, verbose, ISC_TRUE, target)); -} - -isc_result_t -dns_ttl_totext2(isc_uint32_t src, isc_boolean_t verbose, - isc_boolean_t upcase, isc_buffer_t *target) +dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, + isc_boolean_t upcase, isc_buffer_t *target) { unsigned secs, mins, hours, days, weeks, x; diff --git a/lib/dns/view.c b/lib/dns/view.c index c96e0a2681..f5409cbbab 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -652,7 +652,7 @@ dns_view_dialup(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(view->zonetable != NULL); - (void)dns_zt_apply(view->zonetable, ISC_FALSE, dialup, NULL); + (void)dns_zt_apply(view->zonetable, ISC_FALSE, NULL, dialup, NULL); } void @@ -845,12 +845,7 @@ dns_view_createresolver(dns_view_t *view, } void -dns_view_setcache(dns_view_t *view, dns_cache_t *cache) { - dns_view_setcache2(view, cache, ISC_FALSE); -} - -void -dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) { +dns_view_setcache(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(!view->frozen); diff --git a/lib/dns/win32/libdns.def.in b/lib/dns/win32/libdns.def.in index 0382bdcc8c..f81efeff9c 100644 --- a/lib/dns/win32/libdns.def.in +++ b/lib/dns/win32/libdns.def.in @@ -339,7 +339,6 @@ dns_dsdigest_totext dns_dt_attach dns_dt_close dns_dt_create -dns_dt_create2 dns_dt_datatotext dns_dt_detach dns_dt_getframe @@ -496,9 +495,7 @@ dns_message_gettimeadjust dns_message_gettsig dns_message_gettsigkey dns_message_logfmtpacket -dns_message_logfmtpacket2 dns_message_logpacket -dns_message_logpacket2 dns_message_movename dns_message_nextname dns_message_parse @@ -978,7 +975,6 @@ dns_ssu_mtypefromstring dns_ssutable_addrule dns_ssutable_attach dns_ssutable_checkrules -dns_ssutable_checkrules2 dns_ssutable_create dns_ssutable_createdlz dns_ssutable_detach @@ -1030,7 +1026,6 @@ dns_tsigrcode_fromtext dns_tsigrcode_totext dns_ttl_fromtext dns_ttl_totext -dns_ttl_totext2 dns_update_signatures dns_update_signaturesinc dns_update_soaserial @@ -1084,7 +1079,6 @@ dns_view_saventa dns_view_searchdlz dns_view_setadbstats dns_view_setcache -dns_view_setcache2 dns_view_setdstport dns_view_setdynamickeyring dns_view_setfailttl @@ -1335,7 +1329,6 @@ dns_zonemgr_unreachable dns_zonemgr_unreachableadd dns_zonemgr_unreachabledel dns_zt_apply -dns_zt_apply2 dns_zt_asyncload dns_zt_attach dns_zt_create diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index 8e192ace10..0a970da201 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -1234,11 +1234,11 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { DNS_MESSAGEPARSE_PRESERVEORDER); if (result == ISC_R_SUCCESS) - dns_message_logpacket2(msg, "received message from", - &tcpmsg->address, - DNS_LOGCATEGORY_XFER_IN, - DNS_LOGMODULE_XFER_IN, - ISC_LOG_DEBUG(10), xfr->mctx); + dns_message_logpacket(msg, "received message from", + &tcpmsg->address, + DNS_LOGCATEGORY_XFER_IN, + DNS_LOGMODULE_XFER_IN, + ISC_LOG_DEBUG(10), xfr->mctx); else xfrin_log(xfr, ISC_LOG_DEBUG(10), "dns_message_parse: %s", dns_result_totext(result)); diff --git a/lib/dns/zt.c b/lib/dns/zt.c index 830deb51be..42787f5fca 100644 --- a/lib/dns/zt.c +++ b/lib/dns/zt.c @@ -199,7 +199,7 @@ flush(dns_zone_t *zone, void *uap) { static void zt_destroy(dns_zt_t *zt) { if (zt->flush) - (void)dns_zt_apply(zt, ISC_FALSE, flush, NULL); + (void)dns_zt_apply(zt, ISC_FALSE, NULL, flush, NULL); dns_rbt_destroy(&zt->table); isc_rwlock_destroy(&zt->rwlock); zt->magic = 0; @@ -249,7 +249,7 @@ dns_zt_load(dns_zt_t *zt, isc_boolean_t stop) { REQUIRE(VALID_ZT(zt)); RWLOCK(&zt->rwlock, isc_rwlocktype_read); - result = dns_zt_apply(zt, stop, load, NULL); + result = dns_zt_apply(zt, stop, NULL, load, NULL); RWUNLOCK(&zt->rwlock, isc_rwlocktype_read); return (result); } @@ -277,7 +277,7 @@ dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg) { RWLOCK(&zt->rwlock, isc_rwlocktype_write); INSIST(zt->loads_pending == 0); - result = dns_zt_apply2(zt, ISC_FALSE, NULL, asyncload, &dl); + result = dns_zt_apply(zt, ISC_FALSE, NULL, asyncload, &dl); pending = zt->loads_pending; if (pending != 0) { @@ -328,7 +328,7 @@ dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop) { REQUIRE(VALID_ZT(zt)); RWLOCK(&zt->rwlock, isc_rwlocktype_read); - result = dns_zt_apply(zt, stop, loadnew, NULL); + result = dns_zt_apply(zt, stop, NULL, loadnew, NULL); RWUNLOCK(&zt->rwlock, isc_rwlocktype_read); return (result); } @@ -352,7 +352,7 @@ dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze) { REQUIRE(VALID_ZT(zt)); RWLOCK(&zt->rwlock, isc_rwlocktype_read); - result = dns_zt_apply2(zt, ISC_FALSE, &tresult, freezezones, &freeze); + result = dns_zt_apply(zt, ISC_FALSE, &tresult, freezezones, &freeze); RWUNLOCK(&zt->rwlock, isc_rwlocktype_read); if (tresult == ISC_R_NOTFOUND) tresult = ISC_R_SUCCESS; @@ -475,15 +475,8 @@ dns_zt_setviewrevert(dns_zt_t *zt) { } isc_result_t -dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, +dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, isc_result_t (*action)(dns_zone_t *, void *), void *uap) -{ - return (dns_zt_apply2(zt, stop, NULL, action, uap)); -} - -isc_result_t -dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, - isc_result_t (*action)(dns_zone_t *, void *), void *uap) { dns_rbtnode_t *node; dns_rbtnodechain_t chain; diff --git a/lib/ns/tests/nstest.c b/lib/ns/tests/nstest.c index ce43815272..d95f5aa2b0 100644 --- a/lib/ns/tests/nstest.c +++ b/lib/ns/tests/nstest.c @@ -324,7 +324,7 @@ ns_test_makeview(const char *name, isc_boolean_t with_cache, CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr, dns_rdataclass_in, "", "rbt", 0, NULL, &cache)); - dns_view_setcache(view, cache); + dns_view_setcache(view, cache, ISC_FALSE); /* * Reference count for "cache" is now at 2, so decrement it in * order for the cache to be automatically freed when "view" diff --git a/lib/ns/update.c b/lib/ns/update.c index 6e99e4a38c..e649663ae7 100644 --- a/lib/ns/update.c +++ b/lib/ns/update.c @@ -895,10 +895,10 @@ ssu_checkrule(void *data, dns_rdataset_t *rrset) { if (rrset->type == dns_rdatatype_rrsig || rrset->type == dns_rdatatype_nsec) return (ISC_R_SUCCESS); - result = dns_ssutable_checkrules2(ssuinfo->table, ssuinfo->signer, - ssuinfo->name, ssuinfo->addr, - ssuinfo->tcp, ssuinfo->aclenv, - rrset->type, ssuinfo->key); + result = dns_ssutable_checkrules(ssuinfo->table, ssuinfo->signer, + ssuinfo->name, ssuinfo->addr, + ssuinfo->tcp, ssuinfo->aclenv, + rrset->type, ssuinfo->key); return (result == ISC_TRUE ? ISC_R_SUCCESS : ISC_R_FAILURE); } @@ -2750,10 +2750,10 @@ update_action(isc_task_t *task, isc_event_t *event) { tsigkey = client->message->tsigkey->key; if (rdata.type != dns_rdatatype_any) { - if (!dns_ssutable_checkrules2 - (ssutable, client->signer, name, &netaddr, - ISC_TF(TCPCLIENT(client)), - env, rdata.type, tsigkey)) + if (!dns_ssutable_checkrules + (ssutable, client->signer, name, &netaddr, + ISC_TF(TCPCLIENT(client)), + env, rdata.type, tsigkey)) { FAILC(DNS_R_REFUSED, "rejected by secure update");