]> source.dussan.org Git - rspamd.git/commit
[Fix] Core: Fix address rotation bug
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 18 Feb 2019 12:58:57 +0000 (12:58 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 18 Feb 2019 12:58:57 +0000 (12:58 +0000)
commit0f32df6f44c75cb9be69618e699fb2972cc7d421
treec7be839a23808ac274a0fc5c14c75a55607600ad
parentc9d04a923e2a64321df8128aa4efaacdfccbed2f
[Fix] Core: Fix address rotation bug

Previously, upstream.get_addr function returned the new address of the
upstream. Unfortunately, it was used for printing addresses. It caused
the following situation: let's imagine we have A1 and A2 where A1 was
initially selected. So the connection was performed to A1:

                           Current addr   Selected addr

   Connect+---------+      A2+------>A1   A1
                    |
+-+Print failure<---+      A1+------>A2   A2
|                        +----+
+->Mark failure+-------->+ A2 |
                         +----+

But the failure OP as well as log message told about `A2` where the real
problem happened with `A1`.

This commit adds distinguishing between getting the next and the current
address of the upstream resolving this issue.
12 files changed:
src/fuzzy_storage.c
src/libserver/dns.c
src/libserver/fuzzy_backend_redis.c
src/libstat/backends/redis_backend.c
src/libstat/learn_cache/redis_cache.c
src/libutil/upstream.c
src/libutil/upstream.h
src/lua/lua_upstream.c
src/plugins/fuzzy_check.c
src/plugins/surbl.c
src/rspamd_proxy.c
test/rspamd_upstream_test.c