From 42ee8c853ac5690a23cd968c257eaf165086f10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Kr=C4=99cicki?= Date: Tue, 3 Apr 2018 16:05:11 +0200 Subject: [PATCH] libdns refactoring: get rid of 3 versions of dns_resolver_createfetch --- bin/named/server.c | 6 ++-- lib/dns/adb.c | 12 ++++---- lib/dns/client.c | 3 +- lib/dns/include/dns/resolver.h | 28 ++---------------- lib/dns/lookup.c | 3 +- lib/dns/nta.c | 4 +-- lib/dns/resolver.c | 52 ++++++---------------------------- lib/dns/validator.c | 4 +-- lib/dns/win32/libdns.def.in | 2 -- lib/dns/zone.c | 8 +++--- lib/ns/query.c | 40 +++++++++++++------------- 11 files changed, 53 insertions(+), 109 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index 7240d5f8c0..7b7286ce95 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -6565,9 +6565,9 @@ dotat(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) { result = dns_resolver_createfetch(view->resolver, tatname, dns_rdatatype_null, NULL, NULL, - NULL, 0, tat->task, tat_done, tat, - &tat->rdataset, &tat->sigrdataset, - &tat->fetch); + NULL, NULL, 0, 0, 0, NULL, tat->task, + tat_done, tat, &tat->rdataset, + &tat->sigrdataset, &tat->fetch); if (result != ISC_R_SUCCESS) { isc_task_detach(&tat->task); diff --git a/lib/dns/adb.c b/lib/dns/adb.c index c052fa11ba..3c38d97a65 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -4043,12 +4043,12 @@ fetch_name(dns_adbname_t *adbname, isc_boolean_t start_at_zone, } fetch->depth = depth; - result = dns_resolver_createfetch3(adb->view->resolver, &adbname->name, - type, name, nameservers, NULL, - NULL, 0, options, depth, qc, - adb->task, fetch_callback, adbname, - &fetch->rdataset, NULL, - &fetch->fetch); + result = dns_resolver_createfetch(adb->view->resolver, &adbname->name, + type, name, nameservers, NULL, + NULL, 0, options, depth, qc, + adb->task, fetch_callback, adbname, + &fetch->rdataset, NULL, + &fetch->fetch); if (result != ISC_R_SUCCESS) goto cleanup; diff --git a/lib/dns/client.c b/lib/dns/client.c index 2d701e48f3..1535562ee6 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -773,7 +773,8 @@ start_fetch(resctx_t *rctx) { result = dns_resolver_createfetch(rctx->view->resolver, dns_fixedname_name(&rctx->name), rctx->type, - NULL, NULL, NULL, fopts, + NULL, NULL, NULL, NULL, 0, + fopts, 0, NULL, rctx->task, fetch_done, rctx, rctx->rdataset, rctx->sigrdataset, diff --git a/lib/dns/include/dns/resolver.h b/lib/dns/include/dns/resolver.h index d553021560..17418424ec 100644 --- a/lib/dns/include/dns/resolver.h +++ b/lib/dns/include/dns/resolver.h @@ -267,35 +267,13 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, const dns_name_t *domain, dns_rdataset_t *nameservers, dns_forwarders_t *forwarders, - unsigned int options, isc_task_t *task, + const isc_sockaddr_t *client, isc_uint16_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, isc_taskaction_t action, void *arg, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp); - -isc_result_t -dns_resolver_createfetch2(dns_resolver_t *res, const dns_name_t *name, - dns_rdatatype_t type, - const dns_name_t *domain, dns_rdataset_t *nameservers, - dns_forwarders_t *forwarders, - const isc_sockaddr_t *client, isc_uint16_t id, - unsigned int options, isc_task_t *task, - isc_taskaction_t action, void *arg, - dns_rdataset_t *rdataset, - dns_rdataset_t *sigrdataset, - dns_fetch_t **fetchp); -isc_result_t -dns_resolver_createfetch3(dns_resolver_t *res, const dns_name_t *name, - dns_rdatatype_t type, - const dns_name_t *domain, dns_rdataset_t *nameservers, - dns_forwarders_t *forwarders, - const isc_sockaddr_t *client, isc_uint16_t id, - unsigned int options, unsigned int depth, - isc_counter_t *qc, isc_task_t *task, - isc_taskaction_t action, void *arg, - dns_rdataset_t *rdataset, - dns_rdataset_t *sigrdataset, - dns_fetch_t **fetchp); /*%< * Recurse to answer a question. * diff --git a/lib/dns/lookup.c b/lib/dns/lookup.c index 889c802eec..152ece260b 100644 --- a/lib/dns/lookup.c +++ b/lib/dns/lookup.c @@ -85,7 +85,8 @@ start_fetch(dns_lookup_t *lookup) { result = dns_resolver_createfetch(lookup->view->resolver, dns_fixedname_name(&lookup->name), lookup->type, - NULL, NULL, NULL, 0, + NULL, NULL, NULL, NULL, 0, 0, 0, + NULL, lookup->task, fetch_done, lookup, &lookup->rdataset, &lookup->sigrdataset, diff --git a/lib/dns/nta.c b/lib/dns/nta.c index 7f2acfeaf4..383dc04c5e 100644 --- a/lib/dns/nta.c +++ b/lib/dns/nta.c @@ -268,8 +268,8 @@ checkbogus(isc_task_t *task, isc_event_t *event) { nta_ref(nta); result = dns_resolver_createfetch(view->resolver, nta->name, dns_rdatatype_nsec, - NULL, NULL, NULL, - DNS_FETCHOPT_NONTA, + NULL, NULL, NULL, NULL, 0, + DNS_FETCHOPT_NONTA, 0, NULL, task, fetch_done, nta, &nta->rdataset, &nta->sigrdataset, diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index e6352458f1..b38cff76ef 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -6855,8 +6855,8 @@ resume_dslookup(isc_task_t *task, isc_event_t *event) { result = dns_resolver_createfetch(fctx->res, &fctx->nsname, dns_rdatatype_ns, domain, - nsrdataset, NULL, - fctx->options, task, + nsrdataset, NULL, NULL, 0, + fctx->options, 0, NULL, task, resume_dslookup, fctx, &fctx->nsrrset, NULL, &fctx->nsfetch); @@ -9117,8 +9117,8 @@ rctx_chaseds(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo, isc_result_t result) result = dns_resolver_createfetch(fctx->res, &fctx->nsname, dns_rdatatype_ns, - NULL, NULL, NULL, - fctx->options, rctx->task, + NULL, NULL, NULL, NULL, 0, + fctx->options, 0, NULL, rctx->task, resume_dslookup, fctx, &fctx->nsrrset, NULL, &fctx->nsfetch); @@ -9982,7 +9982,8 @@ dns_resolver_prime(dns_resolver_t *res) { LOCK(&res->primelock); result = dns_resolver_createfetch(res, dns_rootname, dns_rdatatype_ns, - NULL, NULL, NULL, 0, + NULL, NULL, NULL, NULL, 0, 0, + 0, NULL, res->buckets[0].task, prime_done, res, rdataset, NULL, @@ -10176,48 +10177,13 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, const dns_name_t *domain, dns_rdataset_t *nameservers, dns_forwarders_t *forwarders, - unsigned int options, isc_task_t *task, + const isc_sockaddr_t *client, dns_messageid_t id, + unsigned int options, unsigned int depth, + isc_counter_t *qc, isc_task_t *task, isc_taskaction_t action, void *arg, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_fetch_t **fetchp) -{ - return (dns_resolver_createfetch3(res, name, type, domain, - nameservers, forwarders, NULL, 0, - options, 0, NULL, task, action, arg, - rdataset, sigrdataset, fetchp)); -} - -isc_result_t -dns_resolver_createfetch2(dns_resolver_t *res, const dns_name_t *name, - dns_rdatatype_t type, - const dns_name_t *domain, dns_rdataset_t *nameservers, - dns_forwarders_t *forwarders, - const isc_sockaddr_t *client, dns_messageid_t id, - unsigned int options, isc_task_t *task, - isc_taskaction_t action, void *arg, - dns_rdataset_t *rdataset, - dns_rdataset_t *sigrdataset, - dns_fetch_t **fetchp) -{ - return (dns_resolver_createfetch3(res, name, type, domain, - nameservers, forwarders, client, id, - options, 0, NULL, task, action, arg, - rdataset, sigrdataset, fetchp)); -} - -isc_result_t -dns_resolver_createfetch3(dns_resolver_t *res, const dns_name_t *name, - dns_rdatatype_t type, - const dns_name_t *domain, dns_rdataset_t *nameservers, - dns_forwarders_t *forwarders, - const isc_sockaddr_t *client, dns_messageid_t id, - unsigned int options, unsigned int depth, - isc_counter_t *qc, isc_task_t *task, - isc_taskaction_t action, void *arg, - dns_rdataset_t *rdataset, - dns_rdataset_t *sigrdataset, - dns_fetch_t **fetchp) { dns_fetch_t *fetch; fetchctx_t *fctx = NULL; diff --git a/lib/dns/validator.c b/lib/dns/validator.c index c6c0e20adc..f551a11c6b 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -1153,8 +1153,8 @@ create_fetch(dns_validator_t *val, dns_name_t *name, dns_rdatatype_t type, validator_logcreate(val, name, type, caller, "fetch"); return (dns_resolver_createfetch(val->view->resolver, name, type, - NULL, NULL, NULL, fopts, - val->event->ev_sender, + NULL, NULL, NULL, NULL, 0, fopts, + 0, NULL, val->event->ev_sender, callback, val, &val->frdataset, &val->fsigrdataset, diff --git a/lib/dns/win32/libdns.def.in b/lib/dns/win32/libdns.def.in index 1e4aa54b71..e31a8ce549 100644 --- a/lib/dns/win32/libdns.def.in +++ b/lib/dns/win32/libdns.def.in @@ -862,8 +862,6 @@ dns_resolver_attach dns_resolver_cancelfetch dns_resolver_create dns_resolver_createfetch -dns_resolver_createfetch2 -dns_resolver_createfetch3 dns_resolver_destroyfetch dns_resolver_detach dns_resolver_disable_algorithm diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 0642c932ba..da9b2a70fc 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -9790,11 +9790,11 @@ zone_refreshkeys(dns_zone_t *zone) { */ result = dns_resolver_createfetch(zone->view->resolver, kname, dns_rdatatype_dnskey, - NULL, NULL, NULL, - DNS_FETCHOPT_NOVALIDATE| - DNS_FETCHOPT_UNSHARED| + NULL, NULL, NULL, NULL, 0, + DNS_FETCHOPT_NOVALIDATE | + DNS_FETCHOPT_UNSHARED | DNS_FETCHOPT_NOCACHED, - zone->task, + 0, NULL, zone->task, keyfetch_done, kfetch, &kfetch->dnskeyset, &kfetch->dnskeysigset, diff --git a/lib/ns/query.c b/lib/ns/query.c index 990323aeea..0ecd1db1bf 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -2446,13 +2446,13 @@ query_prefetch(ns_client_t *client, dns_name_t *qname, peeraddr = NULL; ns_client_attach(client, &dummy); options = client->query.fetchoptions | DNS_FETCHOPT_PREFETCH; - result = dns_resolver_createfetch3(client->view->resolver, - qname, rdataset->type, NULL, NULL, - NULL, peeraddr, client->message->id, - options, 0, NULL, client->task, - prefetch_done, client, - tmprdataset, NULL, - &client->query.prefetch); + result = dns_resolver_createfetch(client->view->resolver, + qname, rdataset->type, NULL, NULL, + NULL, peeraddr, client->message->id, + options, 0, NULL, client->task, + prefetch_done, client, + tmprdataset, NULL, + &client->query.prefetch); if (result != ISC_R_SUCCESS) { query_putrdataset(client, &tmprdataset); ns_client_detach(&dummy); @@ -2653,12 +2653,12 @@ query_rpzfetch(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t type) { peeraddr = NULL; ns_client_attach(client, &dummy); options = client->query.fetchoptions; - result = dns_resolver_createfetch3(client->view->resolver, qname, type, - NULL, NULL, NULL, peeraddr, - client->message->id, options, 0, - NULL, client->task, prefetch_done, - client, tmprdataset, NULL, - &client->query.prefetch); + result = dns_resolver_createfetch(client->view->resolver, qname, type, + NULL, NULL, NULL, peeraddr, + client->message->id, options, 0, + NULL, client->task, prefetch_done, + client, tmprdataset, NULL, + &client->query.prefetch); if (result != ISC_R_SUCCESS) { query_putrdataset(client, &tmprdataset); ns_client_detach(&dummy); @@ -5650,13 +5650,13 @@ query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, peeraddr = &client->peeraddr; } - result = dns_resolver_createfetch3(client->view->resolver, - qname, qtype, qdomain, nameservers, - NULL, peeraddr, client->message->id, - client->query.fetchoptions, 0, NULL, - client->task, fetch_callback, - client, rdataset, sigrdataset, - &client->query.fetch); + result = dns_resolver_createfetch(client->view->resolver, + qname, qtype, qdomain, nameservers, + NULL, peeraddr, client->message->id, + client->query.fetchoptions, 0, NULL, + client->task, fetch_callback, + client, rdataset, sigrdataset, + &client->query.fetch); if (result != ISC_R_SUCCESS) { query_putrdataset(client, &rdataset); if (sigrdataset != NULL) {