fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]6.0.0 release is imminent

2002-06-18 08:42:45
On Tue, Jun 18, 2002 at 12:32:45PM +0200, Matthias Andree wrote:
"Michael H. Warfield" <mhw(_at_)wittsend(_dot_)com> writes:

    I just started rolling IPv6 into production and discovered
that, even when compiled with --enable-inet6, fetchmail complains
that it can not obtain the canonical name of a host if it's IPv6 only
(I have my DNS separated into IPv4, IPv6 global, and IPv6 site local
for testing).  Seems to be a problem with "gethostbyname()".  I'm
still exploring that to find out why.

Not using IPv6 myself, but:

- does your resolver try IPv6 at all? (nsswitch.conf)?
- does your DNS software use and answer to AAAA queries?

        Looking through the OpenSSH portable code, it looks as though
we need to use the "getaddrinfo" call instead of the "gethostbyname"
call in order to properly support IPv6.  At least that's what they've
done.  I don't know if there are any platforms on which this would
be a problem, but OpenSSH doesn't have any conditional compiles wrap
around that call AFAICT.  The change is non-trivial, however.  The
returned structures are quite different.  I'm looking at it now.

        Interesting enough, SockOpen() USES getaddrinfo if INET6_ENABLE
is defined.  That explains why IPv6 works for connecting to an IPv6
host which has an IPv4 A record.  The gethostbyname calls will succeed
elsewhere but, when it comes to actually creating the socket, we get
the IPv6 connection thanks to the getaddrinfo call.  I was scratching
my head TRYING to figure out WHY nobody had seen this before.  Now I
know.  It only breaks for IPv6-Only host names and works on IPv6/IPv4
dual address names for the wrong reason.  :-<

        OpenSock() only uses getaddrinfo in the INET6 case but OpenSSH
seems to use it unconditionally.  We've got calls to gethostbyname
in checkaliases.c, driver.c, and env.c (the one in socket.c is covered
by the ifdef on INET6_ENABLE).  The one in driver.c is the one causing
the immediate problem and seems the easiest one to fix.  That one
is just being used to derive the canonical name and should be easy
to replace with getaddrinfo.

        It looks like the ones in checkaliases.c could be a real mess,
though.  The one in env.c looks to be a problem only if we are running
from an IPv6-Only host and is less likely to occur, right now.  :-)

        There are also some checks in fetchmail.c for "HAVE_GETHOSTBYNAME"
which don't look like they do any harm but raise the question if that
check is valid when using getaddrinfo.

        Who is maintaining the IPv6 code at this point?

-- 
Matthias Andree

        Mike
-- 
 Michael H. Warfield    |  (770) 985-6132   |  mhw(_at_)WittsEnd(_dot_)com
  /\/\|=mhw=|\/\/       |  (678) 463-0932   |  http://www.wittsend.com/mhw/
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!