commit 6943c3c: [Minor] Refactor DNS resolver invocations
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Apr 11 17:21:09 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-04-11 15:00:01 +0100
URL: https://github.com/rspamd/rspamd/commit/6943c3c3a4dd1334aa041fcd7df9598ecec3f152
[Minor] Refactor DNS resolver invocations
---
src/controller.c | 2 +-
src/fuzzy_storage.c | 8 ++++----
src/libserver/dkim.c | 10 +++++-----
src/libserver/dns.c | 42 +++++++++++++++++++++---------------------
src/libserver/dns.h | 38 +++++++++++++++++++-------------------
src/libserver/spf.c | 24 ++++++++++++------------
src/log_helper.c | 6 +++---
src/lua/lua_config.c | 2 +-
src/lua/lua_dns.c | 18 +++++++++---------
src/lua/lua_dns_resolver.c | 8 ++++----
src/lua/lua_http.c | 6 +++---
src/lua/lua_task.c | 2 +-
src/lua/lua_tcp.c | 14 +++++++-------
src/lua/lua_util.c | 2 +-
src/lua_worker.c | 2 +-
src/plugins/surbl.c | 6 +++---
src/rspamd_proxy.c | 2 +-
src/worker.c | 2 +-
test/rspamd_dns_test.c | 19 ++++++++++---------
test/rspamd_upstream_test.c | 2 +-
20 files changed, 108 insertions(+), 107 deletions(-)
diff --git a/src/controller.c b/src/controller.c
index 7b48462ee..a1fa85ebf 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -3891,7 +3891,7 @@ start_controller_worker (struct rspamd_worker *worker)
rspamd_http_router_set_unknown_handler (ctx->http,
rspamd_controller_handle_unknown);
- ctx->resolver = dns_resolver_init (worker->srv->logger,
+ ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
ctx->ev_base,
worker->srv->cfg);
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index e82e9062a..43c975459 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -2989,7 +2989,7 @@ start_fuzzy (struct rspamd_worker *worker)
ctx->cfg = worker->srv->cfg;
double_to_tv (ctx->master_timeout, &ctx->master_io_tv);
- ctx->resolver = dns_resolver_init (worker->srv->logger,
+ ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
ctx->ev_base,
worker->srv->cfg);
rspamd_upstreams_library_config (worker->srv->cfg, ctx->cfg->ups_ctx,
@@ -3167,9 +3167,9 @@ start_fuzzy (struct rspamd_worker *worker)
}
/* Maps events */
- ctx->resolver = dns_resolver_init (worker->srv->logger,
- ctx->ev_base,
- worker->srv->cfg);
+ ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
+ ctx->ev_base,
+ worker->srv->cfg);
rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver, worker, 0);
/* Get peer pipe */
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 9f5cabf6e..98b8e1006 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -1575,11 +1575,11 @@ rspamd_get_dkim_key (rspamd_dkim_context_t *ctx,
cbdata->handler = handler;
cbdata->ud = ud;
- return make_dns_request_task_forced (task,
- rspamd_dkim_dns_cb,
- cbdata,
- RDNS_REQUEST_TXT,
- ctx->dns_key);
+ return rspamd_dns_resolver_request_task_forced (task,
+ rspamd_dkim_dns_cb,
+ cbdata,
+ RDNS_REQUEST_TXT,
+ ctx->dns_key);
}
static gboolean
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index 016f63b25..54b97d06a 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -117,13 +117,13 @@ rspamd_dns_callback (struct rdns_reply *reply, gpointer ud)
}
struct rspamd_dns_request_ud *
-make_dns_request (struct rspamd_dns_resolver *resolver,
- struct rspamd_async_session *session,
- rspamd_mempool_t *pool,
- dns_callback_type cb,
- gpointer ud,
- enum rdns_request_type type,
- const char *name)
+rspamd_dns_resolver_request (struct rspamd_dns_resolver *resolver,
+ struct rspamd_async_session *session,
+ rspamd_mempool_t *pool,
+ dns_callback_type cb,
+ gpointer ud,
+ enum rdns_request_type type,
+ const char *name)
{
struct rdns_request *req;
struct rspamd_dns_request_ud *reqdata = NULL;
@@ -190,7 +190,7 @@ make_dns_request_task_common (struct rspamd_task *task,
return FALSE;
}
- reqdata = make_dns_request (task->resolver, task->s, task->task_pool, cb, ud,
+ reqdata = rspamd_dns_resolver_request (task->resolver, task->s, task->task_pool, cb, ud,
type, name);
if (reqdata) {
@@ -216,21 +216,21 @@ make_dns_request_task_common (struct rspamd_task *task,
}
gboolean
-make_dns_request_task (struct rspamd_task *task,
- dns_callback_type cb,
- gpointer ud,
- enum rdns_request_type type,
- const char *name)
+rspamd_dns_resolver_request_task (struct rspamd_task *task,
+ dns_callback_type cb,
+ gpointer ud,
+ enum rdns_request_type type,
+ const char *name)
{
return make_dns_request_task_common (task, cb, ud, type, name, FALSE);
}
gboolean
-make_dns_request_task_forced (struct rspamd_task *task,
- dns_callback_type cb,
- gpointer ud,
- enum rdns_request_type type,
- const char *name)
+rspamd_dns_resolver_request_task_forced (struct rspamd_task *task,
+ dns_callback_type cb,
+ gpointer ud,
+ enum rdns_request_type type,
+ const char *name)
{
return make_dns_request_task_common (task, cb, ud, type, name, TRUE);
}
@@ -531,9 +531,9 @@ rspamd_dns_resolver_config_ucl (struct rspamd_config *cfg,
}
struct rspamd_dns_resolver *
-dns_resolver_init (rspamd_logger_t *logger,
- struct event_base *ev_base,
- struct rspamd_config *cfg)
+rspamd_dns_resolver_init (rspamd_logger_t *logger,
+ struct event_base *ev_base,
+ struct rspamd_config *cfg)
{
struct rspamd_dns_resolver *dns_resolver;
diff --git a/src/libserver/dns.h b/src/libserver/dns.h
index c48e4b09c..e1def703d 100644
--- a/src/libserver/dns.h
+++ b/src/libserver/dns.h
@@ -40,8 +40,8 @@ struct rspamd_dns_resolver {
/**
* Init DNS resolver, params are obtained from a config file or system file /etc/resolv.conf
*/
-struct rspamd_dns_resolver * dns_resolver_init (rspamd_logger_t *logger,
- struct event_base *ev_base, struct rspamd_config *cfg);
+struct rspamd_dns_resolver * rspamd_dns_resolver_init (rspamd_logger_t *logger,
+ struct event_base *ev_base, struct rspamd_config *cfg);
struct rspamd_dns_request_ud;
/**
@@ -55,24 +55,24 @@ struct rspamd_dns_request_ud;
* @param ... string or ip address based on a request type
* @return TRUE if request was sent.
*/
-struct rspamd_dns_request_ud * make_dns_request (struct rspamd_dns_resolver *resolver,
- struct rspamd_async_session *session,
- rspamd_mempool_t *pool,
- dns_callback_type cb,
- gpointer ud,
- enum rdns_request_type type,
- const char *name);
+struct rspamd_dns_request_ud * rspamd_dns_resolver_request (struct rspamd_dns_resolver *resolver,
+ struct rspamd_async_session *session,
+ rspamd_mempool_t *pool,
+ dns_callback_type cb,
+ gpointer ud,
+ enum rdns_request_type type,
+ const char *name);
-gboolean make_dns_request_task (struct rspamd_task *task,
- dns_callback_type cb,
- gpointer ud,
- enum rdns_request_type type,
- const char *name);
+gboolean rspamd_dns_resolver_request_task (struct rspamd_task *task,
+ dns_callback_type cb,
+ gpointer ud,
+ enum rdns_request_type type,
+ const char *name);
-gboolean make_dns_request_task_forced (struct rspamd_task *task,
- dns_callback_type cb,
- gpointer ud,
- enum rdns_request_type type,
- const char *name);
+gboolean rspamd_dns_resolver_request_task_forced (struct rspamd_task *task,
+ dns_callback_type cb,
+ gpointer ud,
+ enum rdns_request_type type,
+ const char *name);
#endif
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index b8c7e4c32..f7078f3e9 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -671,14 +671,14 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
/* Now resolve A record for this MX */
msg_debug_spf ("resolve %s after resolving of MX",
elt_data->content.mx.name);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb,
RDNS_REQUEST_A,
elt_data->content.mx.name)) {
cb->rec->requests_inflight++;
}
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb,
RDNS_REQUEST_AAAA,
elt_data->content.mx.name)) {
@@ -704,13 +704,13 @@ spf_record_dns_callback (struct rdns_reply *reply, gpointer arg)
elt_data->content.ptr.name)) {
msg_debug_spf ("resolve %s after resolving of PTR",
elt_data->content.ptr.name);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb,
RDNS_REQUEST_A,
elt_data->content.ptr.name)) {
cb->rec->requests_inflight++;
}
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb,
RDNS_REQUEST_AAAA,
elt_data->content.ptr.name)) {
@@ -1056,7 +1056,7 @@ parse_spf_a (struct spf_record *rec,
cb->resolved = resolved;
msg_debug_spf ("resolve a %s", host);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb, RDNS_REQUEST_A, host)) {
rec->requests_inflight++;
@@ -1068,7 +1068,7 @@ parse_spf_a (struct spf_record *rec,
cb->resolved = resolved;
msg_debug_spf ("resolve aaa %s", host);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb, RDNS_REQUEST_AAAA, host)) {
rec->requests_inflight++;
}
@@ -1114,7 +1114,7 @@ parse_spf_ptr (struct spf_record *rec,
rec->ttl = 0;
msg_debug_spf ("disable SPF caching as there is PTR expansion");
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb, RDNS_REQUEST_PTR, ptr)) {
rec->requests_inflight++;
@@ -1149,7 +1149,7 @@ parse_spf_mx (struct spf_record *rec,
cb->resolved = resolved;
msg_debug_spf ("resolve mx for %s", host);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb, RDNS_REQUEST_MX, host)) {
rec->requests_inflight++;
@@ -1324,7 +1324,7 @@ parse_spf_include (struct spf_record *rec, struct spf_addr *addr)
addr->flags |= RSPAMD_SPF_FLAG_REFERENCE;
msg_debug_spf ("resolve include %s", domain);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb, RDNS_REQUEST_TXT, domain)) {
rec->requests_inflight++;
@@ -1375,7 +1375,7 @@ parse_spf_redirect (struct spf_record *rec,
cb->ptr_host = domain;
msg_debug_spf ("resolve redirect %s", domain);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb, RDNS_REQUEST_TXT, domain)) {
rec->requests_inflight++;
@@ -1413,7 +1413,7 @@ parse_spf_exists (struct spf_record *rec, struct spf_addr *addr)
cb->ptr_host = host;
msg_debug_spf ("resolve exists %s", host);
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_record_dns_callback, (void *) cb, RDNS_REQUEST_A, host)) {
rec->requests_inflight++;
@@ -2257,7 +2257,7 @@ rspamd_spf_resolve (struct rspamd_task *task, spf_cb_t callback,
rec->local_part = cred->local_part;
rec->sender_domain = cred->domain;
- if (make_dns_request_task_forced (task,
+ if (rspamd_dns_resolver_request_task_forced (task,
spf_dns_callback,
(void *) rec, RDNS_REQUEST_TXT, rec->sender_domain)) {
rec->requests_inflight++;
diff --git a/src/log_helper.c b/src/log_helper.c
index 01494a447..14a85c5b1 100644
--- a/src/log_helper.c
+++ b/src/log_helper.c
@@ -194,9 +194,9 @@ start_log_helper (struct rspamd_worker *worker)
ctx->cfg = worker->srv->cfg;
ctx->scripts = worker->cf->scripts;
ctx->L = ctx->cfg->lua_state;
- ctx->resolver = dns_resolver_init (worker->srv->logger,
- ctx->ev_base,
- worker->srv->cfg);
+ ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
+ ctx->ev_base,
+ worker->srv->cfg);
rspamd_upstreams_library_config (worker->srv->cfg, ctx->cfg->ups_ctx,
ctx->ev_base, ctx->resolver->r);
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index f60fe6995..f78a8f452 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -3948,7 +3948,7 @@ lua_config_init_subsystem (lua_State *L)
struct event_base *ev_base = lua_check_ev_base (L, 3);
if (ev_base) {
- cfg->dns_resolver = dns_resolver_init (rspamd_logger_get_singleton(),
+ cfg->dns_resolver = rspamd_dns_resolver_init (rspamd_logger_get_singleton (),
ev_base,
cfg);
}
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index 7b07f4003..033b07fb4 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -110,24 +110,24 @@ lua_dns_request (lua_State *L)
if (task == NULL) {
- ret = (make_dns_request (cfg->dns_resolver,
- session,
- pool,
- lua_dns_callback,
- cbdata,
- type,
- to_resolve) != NULL);
+ ret = (rspamd_dns_resolver_request (cfg->dns_resolver,
+ session,
+ pool,
+ lua_dns_callback,
+ cbdata,
+ type,
+ to_resolve) != NULL);
}
else {
if (forced) {
- ret = make_dns_request_task_forced (task,
+ ret = rspamd_dns_resolver_request_task_forced (task,
lua_dns_callback,
cbdata,
type,
to_resolve);
}
else {
- ret = make_dns_request_task (task,
+ ret = rspamd_dns_resolver_request_task (task,
lua_dns_callback,
cbdata,
type,
diff --git a/src/lua/lua_dns_resolver.c b/src/lua/lua_dns_resolver.c
index b68e15397..e06db3a44 100644
--- a/src/lua/lua_dns_resolver.c
+++ b/src/lua/lua_dns_resolver.c
@@ -331,7 +331,7 @@ lua_dns_resolver_init (lua_State *L)
cfg = pcfg ? *(pcfg) : NULL;
if (base != NULL && cfg != NULL) {
- resolver = dns_resolver_init (NULL, base, cfg);
+ resolver = rspamd_dns_resolver_init (NULL, base, cfg);
if (resolver) {
presolver = lua_newuserdata (L, sizeof (gpointer));
rspamd_lua_setclass (L, "rspamd{resolver}", -1);
@@ -440,7 +440,7 @@ lua_dns_resolver_resolve_common (lua_State *L,
cbdata->pool = pool;
if (task == NULL) {
- if (make_dns_request (resolver,
+ if (rspamd_dns_resolver_request (resolver,
session,
pool,
lua_dns_resolver_callback,
@@ -467,13 +467,13 @@ lua_dns_resolver_resolve_common (lua_State *L,
}
if (forced) {
- ret = make_dns_request_task_forced (task,
+ ret = rspamd_dns_resolver_request_task_forced (task,
lua_dns_resolver_callback,
cbdata,
type,
to_resolve);
} else {
- ret = make_dns_request_task (task,
+ ret = rspamd_dns_resolver_request_task (task,
lua_dns_resolver_callback,
cbdata,
type,
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index f88394f06..46d5ed412 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -94,7 +94,7 @@ lua_http_global_resolver (struct event_base *ev_base)
static struct rspamd_dns_resolver *global_resolver;
if (global_resolver == NULL) {
- global_resolver = dns_resolver_init (NULL, ev_base, NULL);
+ global_resolver = rspamd_dns_resolver_init (NULL, ev_base, NULL);
}
return global_resolver;
@@ -1014,7 +1014,7 @@ lua_http_request (lua_State *L)
if (task == NULL) {
REF_RETAIN (cbd);
- if (!make_dns_request (resolver, session, NULL, lua_http_dns_handler, cbd,
+ if (!rspamd_dns_resolver_request (resolver, session, NULL, lua_http_dns_handler, cbd,
RDNS_REQUEST_A,
cbd->host)) {
if (cbd->ref.refcount > 1) {
@@ -1033,7 +1033,7 @@ lua_http_request (lua_State *L)
else {
REF_RETAIN (cbd);
- if (!make_dns_request_task_forced (task, lua_http_dns_handler, cbd,
+ if (!rspamd_dns_resolver_request_task_forced (task, lua_http_dns_handler, cbd,
RDNS_REQUEST_A, cbd->host)) {
if (cbd->ref.refcount > 1) {
/* Not released by make_connection */
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index d647c4a1d..8e739f725 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2677,7 +2677,7 @@ lua_task_inc_dns_req (lua_State *L)
}
if (task != NULL) {
- /* Deprecation: already done in make_dns_request */
+ /* Deprecation: already done in rspamd_dns_resolver_request */
}
else {
return luaL_error (L, "invalid arguments");
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c
index 047bfe444..ccc4d59a1 100644
--- a/src/lua/lua_tcp.c
+++ b/src/lua/lua_tcp.c
@@ -378,7 +378,7 @@ lua_tcp_global_resolver (struct event_base *ev_base,
}
if (global_resolver == NULL) {
- global_resolver = dns_resolver_init (NULL, ev_base, cfg);
+ global_resolver = rspamd_dns_resolver_init (NULL, ev_base, cfg);
}
return global_resolver;
@@ -1659,7 +1659,7 @@ lua_tcp_request (lua_State *L)
}
else {
if (task == NULL) {
- if (!make_dns_request (resolver, session, NULL, lua_tcp_dns_handler, cbd,
+ if (!rspamd_dns_resolver_request (resolver, session, NULL, lua_tcp_dns_handler, cbd,
RDNS_REQUEST_A, host)) {
lua_tcp_push_error (cbd, TRUE, "cannot resolve host: %s", host);
lua_pushboolean (L, FALSE);
@@ -1673,7 +1673,7 @@ lua_tcp_request (lua_State *L)
}
}
else {
- if (!make_dns_request_task (task, lua_tcp_dns_handler, cbd,
+ if (!rspamd_dns_resolver_request_task (task, lua_tcp_dns_handler, cbd,
RDNS_REQUEST_A, host)) {
lua_tcp_push_error (cbd, TRUE, "cannot resolve host: %s", host);
lua_pushboolean (L, FALSE);
@@ -1827,8 +1827,8 @@ lua_tcp_connect_sync (lua_State *L)
}
else {
if (task == NULL) {
- if (!make_dns_request (resolver, session, NULL, lua_tcp_dns_handler, cbd,
- RDNS_REQUEST_A, host)) {
+ if (!rspamd_dns_resolver_request (resolver, session, NULL, lua_tcp_dns_handler, cbd,
+ RDNS_REQUEST_A, host)) {
lua_pushboolean (L, FALSE);
lua_pushliteral (L, "Failed to initiate dns request");
@@ -1843,8 +1843,8 @@ lua_tcp_connect_sync (lua_State *L)
else {
cbd->item = rspamd_symcache_get_cur_item (task);
- if (!make_dns_request_task (task, lua_tcp_dns_handler, cbd,
- RDNS_REQUEST_A, host)) {
+ if (!rspamd_dns_resolver_request_task (task, lua_tcp_dns_handler, cbd,
+ RDNS_REQUEST_A, host)) {
lua_pushboolean (L, FALSE);
lua_pushliteral (L, "Failed to initiate dns request");
TCP_RELEASE (cbd);
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index ec5f98c22..e6241b48d 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -856,7 +856,7 @@ lua_util_process_message (lua_State *L)
task->msg.len = mlen;
task->fin_callback = lua_util_task_fin;
task->fin_arg = &res;
- task->resolver = dns_resolver_init (NULL, base, cfg);
+ task->resolver = rspamd_dns_resolver_init (NULL, base, cfg);
task->s = rspamd_session_create (task->task_pool, rspamd_task_fin,
rspamd_task_restore, (event_finalizer_t)rspamd_task_free, task);
diff --git a/src/lua_worker.c b/src/lua_worker.c
index 8aea54da8..df76945ea 100644
--- a/src/lua_worker.c
+++ b/src/lua_worker.c
@@ -358,7 +358,7 @@ start_lua_worker (struct rspamd_worker *worker)
ctx->L = L;
ctx->cfg = worker->srv->cfg;
- ctx->resolver = dns_resolver_init (worker->srv->logger,
+ ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
ctx->ev_base,
worker->srv->cfg);
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index cab816c50..3b33e3e7f 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -1483,7 +1483,7 @@ make_surbl_requests (struct rspamd_url *url, struct rspamd_task *task,
msg_debug_surbl ("send surbl dns ip request %s to %s", surbl_req,
suffix->suffix);
- if (make_dns_request_task (task,
+ if (rspamd_dns_resolver_request_task (task,
surbl_dns_ip_callback,
(void *) param, RDNS_REQUEST_A, surbl_req)) {
param->item = item;
@@ -1510,7 +1510,7 @@ make_surbl_requests (struct rspamd_url *url, struct rspamd_task *task,
rspamd_mempool_strdup (task->task_pool, url->surbl);
msg_debug_surbl ("send surbl dns request %s", surbl_req);
- if (make_dns_request_task (task,
+ if (rspamd_dns_resolver_request_task (task,
surbl_dns_callback,
(void *) param, RDNS_REQUEST_A, surbl_req)) {
param->item = item;
@@ -1675,7 +1675,7 @@ surbl_dns_ip_callback (struct rdns_reply *reply, gpointer arg)
param->host_resolve,
to_resolve);
- if (make_dns_request_task (task,
+ if (rspamd_dns_resolver_request_task (task,
surbl_dns_callback,
param, RDNS_REQUEST_A, to_resolve->str)) {
rspamd_symcache_item_async_inc (param->task, param->item, M);
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 446552b81..db654c0b0 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -2168,7 +2168,7 @@ start_rspamd_proxy (struct rspamd_worker *worker)
ctx->ev_base = rspamd_prepare_worker (worker, "rspamd_proxy",
proxy_accept_socket);
- ctx->resolver = dns_resolver_init (worker->srv->logger,
+ ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
ctx->ev_base,
worker->srv->cfg);
double_to_tv (ctx->timeout, &ctx->io_tv);
diff --git a/src/worker.c b/src/worker.c
index 40e3d07f9..ee8b261d6 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -685,7 +685,7 @@ start_worker (struct rspamd_worker *worker)
}
}
- ctx->resolver = dns_resolver_init (worker->srv->logger,
+ ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
ctx->ev_base,
worker->srv->cfg);
rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver, worker, 0);
diff --git a/test/rspamd_dns_test.c b/test/rspamd_dns_test.c
index c2383b61a..678f34e4d 100644
--- a/test/rspamd_dns_test.c
+++ b/test/rspamd_dns_test.c
@@ -82,24 +82,25 @@ rspamd_dns_test_func ()
s = rspamd_session_create (pool, session_fin, NULL, NULL, NULL);
- resolver = dns_resolver_init (NULL, base, cfg);
+ resolver = rspamd_dns_resolver_init (NULL, base, cfg);
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_A, "google.com"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_A, "google.com"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_PTR, "81.19.70.3"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_PTR, "81.19.70.3"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_MX, "rambler.ru"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_MX, "rambler.ru"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_TXT, "rambler.ru"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_TXT, "rambler.ru"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_TXT, "google.com"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_TXT, "google.com"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_SPF, "rambler.ru"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_SPF, "rambler.ru"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_SRV, "_xmpp-server._tcp.jabber.org"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_SRV,
+ "_xmpp-server._tcp.jabber.org"));
requests ++;
- g_assert (make_dns_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_TXT, "non-existent.arpa"));
+ g_assert (rspamd_dns_resolver_request (resolver, s, pool, test_dns_cb, NULL, RDNS_REQUEST_TXT, "non-existent.arpa"));
g_assert (resolver != NULL);
diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c
index f9eb2bcfd..05e0ec730 100644
--- a/test/rspamd_upstream_test.c
+++ b/test/rspamd_upstream_test.c
@@ -71,7 +71,7 @@ rspamd_upstream_test_func (void)
cfg->upstream_revive_time = 0.5;
cfg->upstream_error_time = 2;
- resolver = dns_resolver_init (NULL, ev_base, cfg);
+ resolver = rspamd_dns_resolver_init (NULL, ev_base, cfg);
rspamd_upstreams_library_config (cfg, cfg->ups_ctx, ev_base, resolver->r);
/*
More information about the Commits
mailing list