Mailing List Archive

[Bug 2694] Wrong distribution to spamd-servers
https://bugs.exim.org/show_bug.cgi?id=2694

--- Comment #1 from Heiko Schlichting <heiko@fu-berlin.de> ---
Created attachment 1363
--> https://bugs.exim.org/attachment.cgi?id=1363&action=edit
0002-Fix-weight-calculation-for-socks_proxy.patch

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

--- Comment #2 from Heiko Schlichting <heiko@fu-berlin.de> ---
Created attachment 1364
--> https://bugs.exim.org/attachment.cgi?id=1364&action=edit
0003-Use-random_number-instead-random.patch

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

--- Comment #3 from Heiko Schlichting <heiko@fu-berlin.de> ---
Created attachment 1365
--> https://bugs.exim.org/attachment.cgi?id=1365&action=edit
0004-Introduce-SPAMD_PRIORITY-analogously-to-SOCKS_PRIORI.patch

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

Heiko Schlichting <heiko@fu-berlin.de> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #1362|application/mbox |text/plain
mime type| |
Attachment #1362|0 |1
is patch| |

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

Jeremy Harris <jgh146exb@wizmail.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|tom@duncanthrax.net |jgh146exb@wizmail.org
Status|NEW |ASSIGNED

--- Comment #4 from Jeremy Harris <jgh146exb@wizmail.org> ---
I'm going to take this patchset entire (subject to basic regression-test)
despite having no facilities in the testsuite that explore it.

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

Git Commit <git@exim.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |git@exim.org

--- Comment #5 from Git Commit <git@exim.org> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/6296a393aeab9fecc38916dfcbf1c94d54691650

commit 6296a393aeab9fecc38916dfcbf1c94d54691650
Author: Heiko Schlichting <heiko@fu-berlin.de>
AuthorDate: Fri Feb 19 11:11:51 2021 +0000
Commit: Jeremy Harris <jgh146exb@wizmail.org>
CommitDate: Fri Feb 19 11:51:17 2021 +0000

Fix weight calculation for spamd_address. Bug 2694
---
doc/doc-txt/ChangeLog | 4 +++-
src/src/spam.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 5b900a5..59fb46a 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -203,7 +203,9 @@ JH/42 Bug 2693: Harden against a peer which reneges on a
452 "too many
previous coding assumed this would not happen, and under PIPELINING
would result in both lost and duplicate recipients for a message.

-
+JH/43 Bug 2694: Fix weighted distribution of work to multiple spamd servers.
+ Previously the weighting was incorrectly applied. Found and fixed by
+ Heiko Schlichting.


Exim version 4.94
diff --git a/src/src/spam.c b/src/src/spam.c
index 3318bff..b0e24b3 100644
--- a/src/src/spam.c
+++ b/src/src/spam.c
@@ -174,7 +174,7 @@ for (long rnd = random() % weights, i = 0; i < num_servers;
i++)
{
sd = spamds[i];
if (!sd->is_failed && sd->priority == pri)
- if ((rnd -= sd->weight) <= 0)
+ if ((rnd -= sd->weight) < 0)
return i;
}

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

--- Comment #6 from Git Commit <git@exim.org> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/83811e3c1b8189c0a725ec53df699730e7767263

commit 83811e3c1b8189c0a725ec53df699730e7767263
Author: Heiko Schlichting <heiko@fu-berlin.de>
AuthorDate: Fri Feb 19 11:14:36 2021 +0000
Commit: Jeremy Harris <jgh146exb@wizmail.org>
CommitDate: Fri Feb 19 11:53:16 2021 +0000

Fix weight calculation for socks_proxy. Bug 2694
---
doc/doc-txt/ChangeLog | 4 ++--
src/src/transports/smtp_socks.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 59fb46a..2c17877 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -204,8 +204,8 @@ JH/42 Bug 2693: Harden against a peer which reneges on a
452 "too many
would result in both lost and duplicate recipients for a message.

JH/43 Bug 2694: Fix weighted distribution of work to multiple spamd servers.
- Previously the weighting was incorrectly applied. Found and fixed by
- Heiko Schlichting.
+ Previously the weighting was incorrectly applied. Similar fix for socks
+ proxies. Found and fixed by Heiko Schlichting.


Exim version 4.94
diff --git a/src/src/transports/smtp_socks.c b/src/src/transports/smtp_socks.c
index 41dc781..cd8ed3e 100644
--- a/src/src/transports/smtp_socks.c
+++ b/src/src/transports/smtp_socks.c
@@ -190,7 +190,7 @@ for (rnd = random() % weights, i = 0; i < nproxies; i++)
{
sd = &proxies[i];
if (!sd->is_failed && sd->priority == pri)
- if ((rnd -= sd->weight) <= 0)
+ if ((rnd -= sd->weight) < 0)
return i;
}

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

--- Comment #7 from Git Commit <git@exim.org> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/213da388e7834c078ed5fd2e0063c951db0d8080

commit 213da388e7834c078ed5fd2e0063c951db0d8080
Author: Heiko Schlichting <heiko@fu-berlin.de>
AuthorDate: Fri Feb 19 11:16:10 2021 +0000
Commit: Jeremy Harris <jgh146exb@wizmail.org>
CommitDate: Fri Feb 19 11:55:56 2021 +0000

use random_number rather than random, for external server distribution.
bug 2694
----
src/src/spam.c | 12 +-----------
src/src/transports/smtp_socks.c | 12 +-----------
2 files changed, 2 insertions(+), 22 deletions(-)

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

--- Comment #8 from Git Commit <git@exim.org> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/03976d0d27f005d68d6a37b418f168f687d49447

commit 03976d0d27f005d68d6a37b418f168f687d49447
Author: Heiko Schlichting <heiko@fu-berlin.de>
AuthorDate: Fri Feb 19 11:18:04 2021 +0000
Commit: Jeremy Harris <jgh146exb@wizmail.org>
CommitDate: Fri Feb 19 11:56:15 2021 +0000

spamd: Use macro for default priority. Bug 2694
---
src/src/spam.c | 2 +-
src/src/spam.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/src/spam.c b/src/src/spam.c
index 2860386..544fed1 100644
--- a/src/src/spam.c
+++ b/src/src/spam.c
@@ -35,7 +35,7 @@ spamd->is_failed = FALSE;
spamd->weight = SPAMD_WEIGHT;
spamd->timeout = SPAMD_TIMEOUT;
spamd->retry = 0;
-spamd->priority = 1;
+spamd->priority = SPAMD_PRIORITY;
return 0;
}

diff --git a/src/src/spam.h b/src/src/spam.h
index 2fe7380..312dce8 100644
--- a/src/src/spam.h
+++ b/src/src/spam.h
@@ -21,8 +21,9 @@
# define SHUT_WR 1
#endif

-/* default weight */
+/* Defaults */
#define SPAMD_WEIGHT 1
+#define SPAMD_PRIORITY 1

typedef struct spamd_address_container
{

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

Jeremy Harris <jgh146exb@wizmail.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |WAIT_FIX_CONFIRMATION

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

--- Comment #9 from Heiko Schlichting <heiko@fu-berlin.de> ---
Confirmed.

Works for me (cherry-picked into exim-4.94+fixes) on production servers and
fixes the problem for spamd_address.

I can't test socks proxy as it is not in use here and SUPPORT_SOCKS is not set
at compile time.

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 2694] Wrong distribution to spamd-servers [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=2694

Jeremy Harris <jgh146exb@wizmail.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|WAIT_FIX_CONFIRMATION |RESOLVED

--- Comment #10 from Jeremy Harris <jgh146exb@wizmail.org> ---
Thanks; closing

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##