diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-18 12:58:57 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-18 12:58:57 +0000 |
commit | 0f32df6f44c75cb9be69618e699fb2972cc7d421 (patch) | |
tree | c7be839a23808ac274a0fc5c14c75a55607600ad /src/plugins/fuzzy_check.c | |
parent | c9d04a923e2a64321df8128aa4efaacdfccbed2f (diff) | |
download | rspamd-0f32df6f44c75cb9be69618e699fb2972cc7d421.tar.gz rspamd-0f32df6f44c75cb9be69618e699fb2972cc7d421.zip |
[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.
Diffstat (limited to 'src/plugins/fuzzy_check.c')
-rw-r--r-- | src/plugins/fuzzy_check.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 760429ba2..58cdd3376 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2209,7 +2209,7 @@ fuzzy_check_io_callback (gint fd, short what, void *arg) msg_err_task ("got error on IO with server %s(%s), on %s, %d, %s", rspamd_upstream_name (session->server), rspamd_inet_address_to_string_pretty ( - rspamd_upstream_addr (session->server)), + rspamd_upstream_addr_cur (session->server)), session->state == 1 ? "read" : "write", errno, strerror (errno)); @@ -2255,7 +2255,7 @@ fuzzy_check_timer_callback (gint fd, short what, void *arg) msg_err_task ("got IO timeout with server %s(%s), after %d retransmits", rspamd_upstream_name (session->server), rspamd_inet_address_to_string_pretty ( - rspamd_upstream_addr (session->server)), + rspamd_upstream_addr_cur (session->server)), session->retransmits); rspamd_upstream_fail (session->server, FALSE); if (session->item) { @@ -2464,7 +2464,7 @@ fuzzy_controller_io_callback (gint fd, short what, void *arg) msg_err_task ("got error in IO with server %s(%s), %d, %s", rspamd_upstream_name (session->server), rspamd_inet_address_to_string_pretty ( - rspamd_upstream_addr (session->server)), + rspamd_upstream_addr_cur (session->server)), errno, strerror (errno)); rspamd_upstream_fail (session->server, FALSE); } @@ -2568,7 +2568,7 @@ fuzzy_controller_timer_callback (gint fd, short what, void *arg) "after %d retransmits", rspamd_upstream_name (session->server), rspamd_inet_address_to_string_pretty ( - rspamd_upstream_addr (session->server)), + rspamd_upstream_addr_cur (session->server)), session->retransmits); if (session->session) { @@ -2725,7 +2725,7 @@ register_fuzzy_client_call (struct rspamd_task *task, selected = rspamd_upstream_get (rule->servers, RSPAMD_UPSTREAM_ROUND_ROBIN, NULL, 0); if (selected) { - addr = rspamd_upstream_addr (selected); + addr = rspamd_upstream_addr_next (selected); if ((sock = rspamd_inet_address_connect (addr, SOCK_DGRAM, TRUE)) == -1) { msg_warn_task ("cannot connect to %s(%s), %d, %s", rspamd_upstream_name (selected), @@ -2853,7 +2853,7 @@ register_fuzzy_controller_call (struct rspamd_http_connection_entry *entry, while ((selected = rspamd_upstream_get (rule->servers, RSPAMD_UPSTREAM_SEQUENTIAL, NULL, 0))) { /* Create UDP socket */ - addr = rspamd_upstream_addr (selected); + addr = rspamd_upstream_addr_next (selected); if ((sock = rspamd_inet_address_connect (addr, SOCK_DGRAM, TRUE)) == -1) { @@ -3216,7 +3216,7 @@ fuzzy_check_send_lua_learn (struct fuzzy_rule *rule, while ((selected = rspamd_upstream_get (rule->servers, RSPAMD_UPSTREAM_SEQUENTIAL, NULL, 0))) { /* Create UDP socket */ - addr = rspamd_upstream_addr (selected); + addr = rspamd_upstream_addr_next (selected); if ((sock = rspamd_inet_address_connect (addr, SOCK_DGRAM, TRUE)) == -1) { |