rspamd_regexp_t *re, struct rspamd_task *task,
const guchar **in, guint *lens,
guint count,
- gboolean is_raw)
+ gboolean is_raw,
+ gboolean *processed_hyperscan)
{
guint64 re_id;
}
else {
ret = rt->results[re_id];
+ *processed_hyperscan = TRUE;
}
}
}
}
else {
ret = rt->results[re_id];
+ *processed_hyperscan = TRUE;
}
}
}
guint64 re_id;
guint found = 0;
- /* Set all bits unchecked */
+ /* Set all bits that are not checked and included in hyperscan to 1 */
for (i = 0; i < re_class->nhs; i++) {
re_id = re_class->hs_ids[i];
}
}
- msg_debug_re_task ("finished hyperscan for class %s, %d (of %d) matches found",
- class_name, found, re_class->nhs);
+ msg_debug_re_task ("finished hyperscan for class %s; %d "
+ "matches found; %d hyperscan supported regexps; %d total regexps",
+ class_name, found, re_class->nhs, (gint)g_hash_table_size (re_class->re));
#endif
}
rspamd_regexp_t *re,
struct rspamd_re_class *re_class,
struct rspamd_mime_header *rh,
- gboolean is_strong)
+ gboolean is_strong,
+ gboolean *processed_hyperscan)
{
const guchar **scvec, *in;
gboolean raw = FALSE;
if (i > 0) {
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, scvec, lenvec, i, raw);
+ task, scvec, lenvec, i, raw, processed_hyperscan);
msg_debug_re_task ("checking header %s regexp: %s=%*s -> %d",
re_class->type_data,
rspamd_regexp_get_pattern (re),
const gchar *in;
const guchar **scvec;
guint *lenvec;
- gboolean raw = FALSE;
+ gboolean raw = FALSE, processed_hyperscan = FALSE;
struct rspamd_mime_text_part *text_part;
struct rspamd_mime_part *mime_part;
struct rspamd_url *url;
if (rh) {
ret = rspamd_re_cache_process_headers_list (task, rt, re,
- re_class, rh, is_strong);
+ re_class, rh, is_strong, &processed_hyperscan);
msg_debug_re_task ("checked header(%s) regexp: %s -> %d",
(const char *)re_class->type_data,
rspamd_regexp_get_pattern (re),
in = MESSAGE_FIELD (task, raw_headers_content).begin;
len = MESSAGE_FIELD (task, raw_headers_content).len;
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, (const guchar **)&in, &len, 1, raw);
+ task, (const guchar **)&in, &len, 1, raw, &processed_hyperscan);
msg_debug_re_task ("checked allheader regexp: %s -> %d",
rspamd_regexp_get_pattern (re), ret);
break;
if (rh) {
ret += rspamd_re_cache_process_headers_list (task, rt, re,
- re_class, rh, is_strong);
+ re_class, rh, is_strong, &processed_hyperscan);
}
msg_debug_re_task ("checked mime header(%s) regexp: %s -> %d",
(const char *)re_class->type_data,
}
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, scvec, lenvec, cnt, raw);
+ task, scvec, lenvec, cnt, raw, &processed_hyperscan);
msg_debug_re_task ("checked mime regexp: %s -> %d",
rspamd_regexp_get_pattern (re), ret);
g_free (scvec);
}
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, scvec, lenvec, i, raw);
+ task, scvec, lenvec, i, raw, &processed_hyperscan);
msg_debug_re_task ("checked url regexp: %s -> %d",
rspamd_regexp_get_pattern (re), ret);
g_free (scvec);
len = task->msg.len;
ret = rspamd_re_cache_process_regexp_data (rt, re, task,
- (const guchar **)&in, &len, 1, raw);
+ (const guchar **)&in, &len, 1, raw, &processed_hyperscan);
msg_debug_re_task ("checked rawbody regexp: %s -> %d",
rspamd_regexp_get_pattern (re), ret);
break;
}
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, scvec, lenvec, cnt, raw);
+ task, scvec, lenvec, cnt, raw, &processed_hyperscan);
msg_debug_re_task ("checked sa body regexp: %s -> %d",
rspamd_regexp_get_pattern (re), ret);
g_free (scvec);
}
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, scvec, lenvec, cnt, raw);
+ task, scvec, lenvec, cnt, raw, &processed_hyperscan);
msg_debug_re_task ("checked sa rawbody regexp: %s -> %d",
rspamd_regexp_get_pattern (re), ret);
g_free (scvec);
}
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, scvec, lenvec, cnt, raw);
+ task, scvec, lenvec, cnt, raw, &processed_hyperscan);
msg_debug_re_task ("checked sa words regexp: %s -> %d",
rspamd_regexp_get_pattern (re), ret);
&lenvec, &cnt)) {
ret = rspamd_re_cache_process_regexp_data (rt, re,
- task, scvec, lenvec, cnt, raw);
+ task, scvec, lenvec, cnt, raw, &processed_hyperscan);
msg_debug_re_task ("checked selector(%s) regexp: %s -> %d",
re_class->type_data,
rspamd_regexp_get_pattern (re), ret);
}
#if WITH_HYPERSCAN
- if (!rt->cache->disable_hyperscan && rt->has_hs) {
+ if (processed_hyperscan) {
rspamd_re_cache_finish_class (task, rt, re_class, class_name);
}
#endif