summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-14 18:27:51 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-14 18:27:51 +0100
commitee1e8c27b804061f0e981ddc0b575291e4148c31 (patch)
tree7ff81a02242c2f5c02026f2ef91bf7b6b274b259
parent590fea4d3ffc85e1a8c57a5d550d7bf46c79eb7d (diff)
downloadrspamd-ee1e8c27b804061f0e981ddc0b575291e4148c31.tar.gz
rspamd-ee1e8c27b804061f0e981ddc0b575291e4148c31.zip
[Feature] Add common directory for hyperscan cache to config
-rw-r--r--conf/options.inc1
-rw-r--r--src/hs_helper.c10
-rw-r--r--src/libserver/cfg_file.h2
-rw-r--r--src/libserver/cfg_rcl.c6
4 files changed, 18 insertions, 1 deletions
diff --git a/conf/options.inc b/conf/options.inc
index d9b48a51e..318de7554 100644
--- a/conf/options.inc
+++ b/conf/options.inc
@@ -35,3 +35,4 @@ words_decay = 200;
# Local networks
local_addrs = "192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, fd00::/8, 169.254.0.0/16, fe80::/10";
+hs_cache_dir = "${DBDIR}/";
diff --git a/src/hs_helper.c b/src/hs_helper.c
index 1434f551a..1292d6460 100644
--- a/src/hs_helper.c
+++ b/src/hs_helper.c
@@ -66,7 +66,7 @@ init_hs_helper (struct rspamd_config *cfg)
ctx->magic = rspamd_hs_helper_magic;
ctx->cfg = cfg;
- ctx->hs_dir = RSPAMD_DBDIR "/";
+ ctx->hs_dir = NULL;
ctx->max_time = default_max_time;
ctx->recompile_time = default_recompile_time;
@@ -249,6 +249,14 @@ start_hs_helper (struct rspamd_worker *worker)
struct timeval tv;
double tim;
+
+ if (ctx->hs_dir == NULL) {
+ ctx->hs_dir = ctx->cfg->hs_cache_dir;
+ }
+ if (ctx->hs_dir == NULL) {
+ ctx->hs_dir = RSPAMD_DBDIR "/";
+ }
+
ctx->ev_base = rspamd_prepare_worker (worker,
"hs_helper",
NULL);
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 0986ed035..67749c276 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -368,6 +368,8 @@ struct rspamd_config {
gchar * tld_file; /**< file to load effective tld list from */
+ gchar * hs_cache_dir; /**< directory to save hyperscan databases */
+
gdouble dns_timeout; /**< timeout in milliseconds for waiting for dns reply */
guint32 dns_retransmits; /**< maximum retransmits count */
guint32 dns_throttling_errors; /**< maximum errors for starting resolver throttling */
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 288b8a505..7441e5bf0 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1780,6 +1780,12 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
RSPAMD_CL_FLAG_STRING_PATH,
"Path to the TLD file for urls detector");
rspamd_rcl_add_default_handler (sub,
+ "hs_cache_dir",
+ rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct rspamd_config, hs_cache_dir),
+ RSPAMD_CL_FLAG_STRING_PATH,
+ "Path directory where rspamd would save hyperscan cache");
+ rspamd_rcl_add_default_handler (sub,
"history_rows",
rspamd_rcl_parse_struct_integer,
G_STRUCT_OFFSET (struct rspamd_config, history_rows),