]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Feature] Add multi-flag fuzzy hash support with Lua-based Redis update path
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 18 Feb 2026 11:23:31 +0000 (11:23 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 18 Feb 2026 11:23:31 +0000 (11:23 +0000)
commit9e2aa51efe00f930ded412fed40c0e363197dfa8
tree0683df3a6563ecf402a77c55b686a7c23981dc14
parente823db466ba0a389361fd13b024e4840af257149
[Feature] Add multi-flag fuzzy hash support with Lua-based Redis update path

Support up to 8 flag slots per fuzzy hash (primary + 7 extra), enabling
multiple rules to match against the same digest with independent flag/value
pairs. The highest-value flag is always promoted to the primary slot for
backward compatibility.

The Redis update path (ADD/DEL/REFRESH) is moved from a C MULTI/EXEC
pipeline with an embedded EVAL string to a proper Lua architecture
following the Bayes pattern: a Redis script in lualib/redis_scripts/
loaded via lua_redis.load_redis_script_from_file(), with a Lua module
(lua_fuzzy_redis.lua) providing an async update functor called from C
via lua_pcall. This gives automatic EVALSHA + NOSCRIPT recovery and
keeps the multi-flag merge logic in a maintainable .lua file.

Wire protocol extended with epoch 12 (RSPAMD_FUZZY_EPOCH12) carrying
rspamd_fuzzy_reply_v2 with n_extra_flags and up to 7 extra flag entries.
lualib/lua_fuzzy_redis.lua [new file with mode: 0644]
lualib/redis_scripts/fuzzy_update.lua [new file with mode: 0644]
src/fuzzy_storage.c
src/libserver/fuzzy_backend/fuzzy_backend.c
src/libserver/fuzzy_backend/fuzzy_backend.h
src/libserver/fuzzy_backend/fuzzy_backend_noop.c
src/libserver/fuzzy_backend/fuzzy_backend_redis.c
src/libserver/fuzzy_storage_internal.h
src/libserver/fuzzy_wire.h
src/plugins/fuzzy_check.c