Re: [exim] [Debian normal bug #296492] exim4: remote_smtp tr…

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Laurent Fousse
CC: exim-users, mh+exim-bugzilla
Subject: Re: [exim] [Debian normal bug #296492] exim4: remote_smtp transport should fallback to ipv4 with fallback_hosts too
On Mon, 28 Feb 2005, Laurent Fousse wrote:

> Here is the output of
>
>    $ sudo exim4 -v -d -M 1D5lqE-0003Yb-ON 2> /tmp/eximdebug

>
> where 1D5lqE-0003Yb-ON is a mail queued for laurent@??? (an
> email address that you can use for testing, it returns a temporary
> error after RCPT).


This bug turned out to be (a) quite serious and (b) trivial to fix! The
precise statement of the bug is: If a host that is listed by name in a
fallback_host list or a "hosts" option in an SMTP transport is
multihomed, only its first address is used. It did not matter whether
the addresses were IPv4 or IPv6.

The patch that fixes this is below.

Philip

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.




*** exim-4.50/src/transports/smtp.c Thu Feb 17 14:49:11 2005
--- transports/smtp.c    Tue Mar 22 15:45:35 2005
***************
*** 2133,2143 ****
      uschar *retry_message_key = NULL;
      uschar *serialize_key = NULL;


-     /* Default next host is next host. :-) But this can vary if the
-     hosts_max_try limit is hit (see below). */
- 
-     nexthost = host->next;
- 
      /* Set the flag requesting that this host be added to the waiting
      database if the delivery fails temporarily or if we are running with
      queue_smtp or a 2-stage queue run. This gets unset for certain
--- 2172,2177 ----
***************
*** 2244,2249 ****
--- 2278,2290 ----
        continue;      /* With next host */
        }


+     /* The default next host is the next host. :-) But this can vary if the
+     hosts_max_try limit is hit (see below). NOTE: we cannot put this setting
+     earlier than this, because a multihomed host whose addresses are not looked
+     up till just above will add to the host list. */
+ 
+     nexthost = host->next;
+ 
      /* If queue_smtp is set (-odqs or the first part of a 2-stage run), or the
      domain is in queue_smtp_domains, we don't actually want to attempt any
      deliveries. When doing a queue run, queue_smtp_domains is always unset. If