[Xapian-tickets] [Xapian] #374: IPv6 support
Xapian
nobody at xapian.org
Wed Dec 17 10:23:24 GMT 2014
#374: IPv6 support
----------------------------+------------------------------
Reporter: olly | Owner: olly
Type: defect | Status: assigned
Priority: low | Milestone: 1.3.3
Component: Backend-Remote | Version: SVN trunk
Severity: normal | Resolution:
Keywords: | Blocked By:
Blocking: | Operating System: All
----------------------------+------------------------------
Changes (by olly):
* status: new => assigned
* milestone: 1.3.x => 1.3.3
Comment:
I've been looking into this some more.
The Linux gethostbyname(3) man page says:
> gethostbyname(), gethostbyaddr(), and h_errno are marked obsolescent in
[the POSIX.1-2001] standard.
> POSIX.1-2008 removes the specifications of gethostbyname(),
gethostbyaddr(), and h_errno, recommending the use of getaddrinfo(3) and
getnameinfo(3) instead.
And the getaddrinfo(3) man page notes that this is specified by
POSIX.1-2001.
Given this was standardised 13 years ago and is the standard way to
support IPv6, it seems hard to conceive that there are relevant systems
without getaddrinfo() at this point.
The Gnulib docs note about getaddrinfo():
> This function is missing on some platforms: HP-UX 11.11, IRIX 6.5, OSF/1
5.1, Solaris 7, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5, BeOS.
https://www.gnu.org/software/gnulib/manual/html_node/getaddrinfo.html
Looking up the versions on that list, they're all out of support - often
by many years.
It's unclear to me if MSVC 9 is in support or not, but it's irrelevant as
we decided to require C++11 support for 1.3.x and up. As for OS versions,
MSDN seems to indicate that getaddrinfo() was added in XP.
Checking the headers of the MXE install on the buildbot vm, that has
getaddrinfo().
So I'd say we don't try to fall back to gethostbyname() - it's just going
to complicate the code and probably for no reason. If there are really
relevant systems with a C++11 compiler and without getaddrinfo(), we can
look at supporting them (and in that case, Gnulib's approach of a
compatibility implementation of getaddrinfo() which calls gethostbyname()
under the covers seems a reasonable approach).
Another benefit of this change is that getaddrinfo() is thread-safe, while
gethostbyname() isn't.
> Incidentally, getaddrinfo() has the added benefit of resolving service
names as well as numeric ports. This suggests that the API of !TcpServer
needs to change to accommodate this.
I don't think we need to worry about named ports - it doesn't make much
sense to run a xapian-tcpsrv on a port reserved for another protocol,
which is what that would allow, so I suggest we just set the
{{{AI_NUMERICSERV}}} flag.
--
Ticket URL: <http://trac.xapian.org/ticket/374#comment:7>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list