aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-02-20 18:21:21 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-02-20 18:21:21 +0000
commit1b251c6d60b428719487f3fc2ff710c075a0937f (patch)
tree23f5d13ddfc5cdca3608167fe5c20e448ba836e4 /src
parentaa075e8ad006484fe7fe9d99b777f814cf3939e7 (diff)
downloadrspamd-1b251c6d60b428719487f3fc2ff710c075a0937f.tar.gz
rspamd-1b251c6d60b428719487f3fc2ff710c075a0937f.zip
Adopt DNS logging.
Diffstat (limited to 'src')
-rw-r--r--src/controller.c2
-rw-r--r--src/dns.c3
-rw-r--r--src/dns.h4
-rw-r--r--src/lua/lua_dns.c2
-rw-r--r--src/lua_worker.c2
m---------src/rdns0
-rw-r--r--src/smtp_proxy.c2
-rw-r--r--src/webui.c2
-rw-r--r--src/worker.c2
9 files changed, 11 insertions, 8 deletions
diff --git a/src/controller.c b/src/controller.c
index 269ca6db2..92dd87d91 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -1986,7 +1986,7 @@ start_controller (struct rspamd_worker *worker)
rspamd_snprintf (greetingbuf, sizeof (greetingbuf), "Rspamd version %s is running on %s" CRLF, RVERSION, hostbuf);
start_map_watch (worker->srv->cfg, ctx->ev_base);
- ctx->resolver = dns_resolver_init (ctx->ev_base, worker->srv->cfg);
+ ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg);
event_base_loop (ctx->ev_base, 0);
diff --git a/src/dns.c b/src/dns.c
index 5b2f928b2..3a62cfede 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -94,7 +94,7 @@ make_dns_request (struct rspamd_dns_resolver *resolver,
struct rspamd_dns_resolver *
-dns_resolver_init (struct event_base *ev_base, struct config_file *cfg)
+dns_resolver_init (rspamd_logger_t *logger, struct event_base *ev_base, struct config_file *cfg)
{
GList *cur;
struct rspamd_dns_resolver *new;
@@ -109,6 +109,7 @@ dns_resolver_init (struct event_base *ev_base, struct config_file *cfg)
new->r = rdns_resolver_new ();
rdns_bind_libevent (new->r, new->ev_base);
rdns_resolver_set_log_level (new->r, cfg->log_level);
+ rdns_resolver_set_logger (new->r, (rdns_log_function)rspamd_common_logv, logger);
if (cfg->nameservers == NULL) {
/* Parse resolv.conf */
diff --git a/src/dns.h b/src/dns.h
index e39fb9876..822483de1 100644
--- a/src/dns.h
+++ b/src/dns.h
@@ -29,6 +29,7 @@
#include "config.h"
#include "mem_pool.h"
#include "events.h"
+#include "logger.h"
#include "rdns.h"
struct rspamd_dns_resolver;
@@ -38,7 +39,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 (struct event_base *ev_base, struct config_file *cfg);
+struct rspamd_dns_resolver *dns_resolver_init (rspamd_logger_t *logger,
+ struct event_base *ev_base, struct config_file *cfg);
/**
* Make a DNS request
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index c53688ef5..3f2b26389 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -154,7 +154,7 @@ lua_dns_resolver_init (lua_State *L)
cfg = pcfg ? *(pcfg) : NULL;
if (base != NULL && cfg != NULL) {
- resolver = dns_resolver_init (base, cfg);
+ resolver = dns_resolver_init (rspamd_main->logger, base, cfg);
if (resolver) {
presolver = lua_newuserdata (L, sizeof (gpointer));
lua_setclass (L, "rspamd{resolver}", -1);
diff --git a/src/lua_worker.c b/src/lua_worker.c
index 8b04b8838..e9b06f508 100644
--- a/src/lua_worker.c
+++ b/src/lua_worker.c
@@ -454,7 +454,7 @@ start_lua_worker (struct rspamd_worker *worker)
event_base_set (ctx->ev_base, &worker->sig_ev_usr1);
signal_add (&worker->sig_ev_usr1, NULL);
- ctx->resolver = dns_resolver_init (ctx->ev_base, worker->srv->cfg);
+ ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg);
/* Open worker's lib */
luaopen_lua_worker (L);
diff --git a/src/rdns b/src/rdns
-Subproject cddc17d60ccf3516516e73f4e5cab151277fafb
+Subproject 5ca36d831ef871fbc7b76846b554a875c1ef5a8
diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c
index 24d78ef4f..89f7e1836 100644
--- a/src/smtp_proxy.c
+++ b/src/smtp_proxy.c
@@ -1063,7 +1063,7 @@ start_smtp_proxy (struct rspamd_worker *worker)
signal_add (&worker->sig_ev_usr1, NULL);
/* DNS resolver */
- ctx->resolver = dns_resolver_init (ctx->ev_base, worker->srv->cfg);
+ ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg);
/* Set umask */
umask (S_IWGRP | S_IWOTH | S_IROTH | S_IRGRP);
diff --git a/src/webui.c b/src/webui.c
index d02c499dc..b2495ef7c 100644
--- a/src/webui.c
+++ b/src/webui.c
@@ -1730,7 +1730,7 @@ start_webui_worker (struct rspamd_worker *worker)
rspamd_http_router_add_path (ctx->http, PATH_SCAN, rspamd_webui_handle_scan, ctx);
#endif
- ctx->resolver = dns_resolver_init (ctx->ev_base, worker->srv->cfg);
+ ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg);
/* Maps events */
start_map_watch (worker->srv->cfg, ctx->ev_base);
diff --git a/src/worker.c b/src/worker.c
index f322fcf7b..cb5d6a140 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -443,7 +443,7 @@ start_worker (struct rspamd_worker *worker)
start_map_watch (worker->srv->cfg, ctx->ev_base);
- ctx->resolver = dns_resolver_init (ctx->ev_base, worker->srv->cfg);
+ ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg);
/* Create classify pool */
ctx->classify_pool = NULL;