[exim-dev] [Bug 830] New: manualroute fake MXs being lost in…

Top Page
Delete this message
Reply to this message
Author: Eric Andresen
Date:  
To: exim-dev
New-Topics: [exim-dev] [Bug 830] manualroute/hosts_randomize should use a single host ordering for a single multi-recipient message, [exim-dev] [Bug 830] manualroute fake MXs being lost in hosts_find_bydns, [exim-dev] [Bug 830] manualroute/hosts_randomize should use a single host ordering for a single multi-recipient message, [exim-dev] [Bug 830] manualroute/hosts_randomize should use a single host ordering for a single multi-recipient message
Subject: [exim-dev] [Bug 830] New: manualroute fake MXs being lost in hosts_find_bydns
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=830
           Summary: manualroute fake MXs being lost in hosts_find_bydns
           Product: Exim
           Version: 4.69
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Routing
        AssignedTo: nigel@???
        ReportedBy: eandres@???
                CC: exim-dev@???, eandres@???



Created an attachment (id=308)
--> (http://bugs.exim.org/attachment.cgi?id=308)
A patch to rf_lookup_hostslists to retain the fake mx assignments.

Config snippet:

mua_wrapper = true
begin routers
smarthost:
driver = manualroute
debug_print = true
hosts_randomize = true
route_list = * "</ foohost1.domain.com:15600 / foohost2.domain.com:15600"
transport = remote_smtp
no_more
begin transports
remote_smtp:
driver = smtp

Test it with something like:

./exim -C $PWD/exim.config -d -N -bm -f foo@??? bar@???
quux@??? < msg

And you'll about 50% of the time receive an error in your logs:

2009-03-25 16:16:34 [6591] 1LmUqI-0001iJ-L6 <= foo@??? U=eandres P=local
S=322 from <foo@???> for bar@??? quux@???
2009-03-25 16:16:34 [6593] 1LmUqI-0001iJ-L6 ** mua_wrapper is set but
recipients cannot all be delivered in one transaction
2009-03-25 16:16:34 [6593] 1LmUqI-0001iJ-L6 Completed QT=0s

This only happens if:
- you use mua_wrapper
- you use hosts_randomize
- you have more than one host in a hostgroup in the route_list
- your hosts do not have MX records of their own defined

The debug info tells the tale:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing quux@???
--------> smarthost router <--------
local_part=quux domain=google.com
true
calling smarthost router
smarthost router called for quux@???
domain = google.com
route_item = * "</ foohost1.domain.com:15600 / foohost2.domain.com:15600"
google.com in "*"? yes (matched "*")
original list of hosts = "</ foohost1.domain.com:15600 /
foohost2.domain.com:15600" options =
expanded list of hosts = "</ foohost1.domain.com:15600 /
foohost2.domain.com:15600" options =
set transport remote_smtp
finding IP address for foohost2.domain.com:15600
host=foohost2.domain.com port=15600
doing DNS lookup
DNS lookup of foohost2.domain.com (A) succeeded
fully qualified name = foohost2.domain.com
foohost2.domain.com 10.241.243.39 mx=-1 sort=-462
finding IP address for foohost1.domain.com:15600
host=foohost1.domain.com port=15600
doing DNS lookup
DNS lookup of foohost1.domain.com (A) succeeded
fully qualified name = foohost1.domain.com
foohost1.domain.com 10.241.243.96 mx=-1 sort=-462
queued for remote_smtp transport: local_part = quux
domain = google.com
errors_to=NULL
domain_data=NULL localpart_data=NULL
routed by smarthost router
envelope to: quux@???
transport: remote_smtp
host foohost2.domain.com [10.241.243.39] port=15600
host foohost1.domain.com [10.241.243.96] port=15600
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing bar@???
--------> smarthost router <--------
local_part=bar domain=google.com
true
calling smarthost router
smarthost router called for bar@???
domain = google.com
route_item = * "</ foohost1.domain.com:15600 / foohost2.domain.com:15600"
google.com in "*"? yes (matched "*")
original list of hosts = "</ foohost1.domain.com:15600 /
foohost2.domain.com:15600" options =
expanded list of hosts = "</ foohost1.domain.com:15600 /
foohost2.domain.com:15600" options =
finding IP address for foohost1.domain.com:15600
host=foohost1.domain.com port=15600
doing DNS lookup
DNS lookup of foohost1.domain.com (A) succeeded
fully qualified name = foohost1.domain.com
foohost1.domain.com 10.241.243.96 mx=-1 sort=-28
finding IP address for foohost2.domain.com:15600
host=foohost2.domain.com port=15600
doing DNS lookup
DNS lookup of foohost2.domain.com (A) succeeded
fully qualified name = foohost2.domain.com
foohost2.domain.com 10.241.243.39 mx=-1 sort=-316
queued for remote_smtp transport: local_part = bar
domain = google.com
errors_to=NULL
domain_data=NULL localpart_data=NULL
routed by smarthost router
envelope to: bar@???
transport: remote_smtp
host foohost1.domain.com [10.241.243.96] port=15600
host foohost2.domain.com [10.241.243.39] port=15600
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

After routing:
  Local deliveries:
  Remote deliveries:
    bar@???
    quux@???
  Failed addresses:
  Deferred addresses:
search_tidyup called


You'll notice that the 'routed by smarthost router' bit lists the hosts, but
there's no 'mx' displayed for each host. This is because it was stripped in the
hosts_find_bydns method, which makes the assumption that no MX was previously
set, and that it should set it via an MX lookup.

I solved this with a small patch to retain the mx and sort_key parts within
rf_lookup_hostlist.cc, much like the port is already handled, because it was
the most obvious solution. A fix to hosts_find_bydns might be a more clean
approach.

The patch is attached.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email