Completely untested patch, used at your own risk etc...
Please report back; any problem description should include enough
information to reproduce it.
To use:
copy the esmtp mailer definition to esmtp4,
add the flag '4' to F=,
and select the esmtp4 mailer for any domain that should
use only IPv4 addresses, maybe something like:
gmail.com esmtp4:
gmail.com
As I wrote: it's untested!
diff --git a/sendmail/daemon.c b/sendmail/daemon.c
index c782a50..eafd6f6 100644
--- a/sendmail/daemon.c
+++ b/sendmail/daemon.c
@@ -2160,7 +2160,7 @@ makeconnection(host, port, mci, e, enough
#if NETINET6
volatile bool v6found = false;
#endif
- volatile int family = InetMode;
+ volatile int family;
SOCKADDR_LEN_T len;
volatile SOCKADDR_LEN_T socksize = 0;
volatile bool clt_bind;
@@ -2181,6 +2181,10 @@ makeconnection(host, port, mci, e, enough
tlsa_flags = *ptlsa_flags;
*ptlsa_flags &= ~(TLSAFLALWAYS|TLSAFLSECURE);
#endif
+ if (bitnset(M_IPV4, mci->mci_mailer->m_flags))
+ family = AF_INET;
+ else
+ family = InetMode;
/* retranslate {daemon_flags} into bitmap */
clrbitmap(d_flags);
diff --git a/sendmail/sendmail.h b/sendmail/sendmail.h
index e4e790b..4c90286 100644
--- a/sendmail/sendmail.h
+++ b/sendmail/sendmail.h
@@ -630,8 +630,8 @@ struct mailer
#define M_NOMX '0' /* turn off MX lookups */
#define M_NONULLS '1' /* don't send null bytes */
#define M_FSMTP '2' /* force SMTP (no ESMTP even if offered) */
- /* '4' free? */
#define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */
+#define M_IPV4 '4' /* Use only IPv4 */
#define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */
#define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */
#define M_7BITS '7' /* use 7-bit path */