Sorry for late response

Does your patch tries all the mx assigned ips even in -m4 mode (ipv4 only) ?

Do you have binaries available (here for win32) for testing ?
(i don't have vc compiler here)


> Message d'origine - 10/02/2013 22:45:09


On my servers, I noticed increasing number of failed deliveries with 
"417 Temporary delivery error" and "Error connecting to remote 
address". I did a little investigation and long story short, XMail 
doesn't handle address family fallback, when connection using 
preferred one does not succeed. It simply tries only one address per 
MX and if it doesn't work, it considers that MX dead and moves to another one.

Now imagine what happens when you use -M7 parameter (use IPV6 records 
if present, or IPV4 records otherwise, for host name lookups), target 
system has both IPv4 and IPv6 records set for all MXes (soon to be 
standard for most servers, well perhaps not so soon, but it's getting 
more and more common) and IPv6 is broken on either side or anywhere 
between. XMail tries connecting using only IPv6 for a while, until it 
finally gives up and returns the message as undeliverable. Which is 
wrong, because if it tried IPv4, it would deliver it just fine.

Relatively safe workaround for now, assuming IPv6 as a new thing is 
going to break more often than IPv4, is to use -M5 instead (Use IPV4 
records if present, or IPV6 records otherwise, for host name 
lookups). But it means that IPv6 won't get used at all, except for 
few rare IPv6-only MXes. Also the problem does not really go away, if 
it happens that IPv6 works while IPv4 does not, it will be back.

Attached is patch with "works for me" solution, i.e. not tested by 
anyone else nor even necessarily correct. It makes XMail try to 
connect to all addresses of MX before moving to next one. Apart from 
possible unintentional errors, it deliberately ignores -M5 and -M7 
parameters and uses AF_UNSPEC for getaddrinfo() and all results when 
one of them is set. It respects -M4 and -M6 if someone really wants 
to use only one address family.

IMHO -M5 and -M7 are wrong, at least on Windows, where getaddrinfo() 
with AF_UNSPEC returns addresses in best order automatically and 
manual override should not be needed. I think Linux either does that 
too or at least has means to influence it using /etc/gai.conf. So 
even if -M5 and -M7 should stay as useful for someone, adding new -M8 
for AF_UNSPEC order would be good idea.

PSYNC has the same problem. And I guess CtrlClnt connecting to server 
probably too, but it's far from critical.

xmail mailing list

Reply via email to