Timeout.connect waits twice as long

If you specify a Timeout.connect value in sendmail, you may be surprised to see sendmail wait twice as long for the connect system call to succeed than the value specified.

# time /usr/lib/sendmail -v -qIk1SH3Z7T004122 -OTimeout.connect=30s
...
real     1:00.1
user        0.0
sys         0.0

If sendmail is configured with support for IPv6, the connect system call will first be tried with IPv6 and then IPv4.

Example strace output:

11:33:05 connect(11, {sa_family=AF_INET6, sin6_port=htons(25), inet_pton(AF_INET6, "::ffff:194.206.235.225", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = ? ERESTARTSYS (To be restarted)

11:33:10 connect(11, {sa_family=AF_INET, sin_port=htons(25), sin_addr=inet_addr("194.206.235.225")}, 16) = ? ERESTARTSYS (To be restarted)

To check if sendmail is compiled with IPv6 (NETINET6) support:

$ /usr/lib/sendmail -d0.1 < /dev/null
Version 8.13.5
 Compiled with: DNSMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 MIME8TO7
                NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS NISPLUS
                PIPELINING SCANF STARTTLS USERDB XDEBUG

Back to brandonhutchinson.com.
Last modified: 02/28/2006