Portable IPv6 support for purple_network_listen

Paul Aurich paul at darkrain42.org
Mon Apr 12 22:50:00 EDT 2010

I'd like to add explicit protocol support to purple_network_listen and
purple_network_listen_range, so that callers can request either an IPv4
or IPv6 socket (there's an IPv6 feature on some stacks that allows a
socket to accept either IPv4 or IPv6 connections, but support on
non-Linux, non-OS X platforms is limited (and at least Debian plans on
having it disabled by default in Squeeze), so the portable solution,
IMHO, is to explicitly use two sockets).

Unless anyone sees problems with the attached patch, I have two
remaining issues that I'd like input on:

   1) This doesn't currently do anything if HAVE_GETADDRINFO is
undefined.  I see two paths:
      a. state that IPv6 isn't supported without GAI and code in a check
for network_family == AF_INET6 and return NULL or
      b. add support for it manually.  This may be required because
WinPidgin Bonjour supports IPv6 (I think), without GAI.  If that's
incorrect, my preference is (a)

   2) How do we handle NAT-PMP and UPnP?  Currently, mappings are based
only on the port, so two listens (on v4 and v6) on the same port would
confuse things.  Neither the UPnP nor NAT-PMP code currently support
IPv6, and I don't have an environment to test it in.  My preference is
to punt, and call neither for v6 sockets.


P.S. Daniel, I see one potential issue with IPv6 Bonjour on WinPidgin.
The socket addr -> string code in jabber.c:_server_socket_handler() will
fail, because HAVE_INET_NTOP isn't set for WinPidgin (added in Vista :(
).  http://www.mail-archive.com/users@ipv6.org/msg02107.html suggests
WSAAddressToString is deficient, but if we dynamically load getnameinfo
(available in Win2K), that wrapper function or something similar would work.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: listen-ipv6.patch
URL: <http://pidgin.im/pipermail/devel/attachments/20100412/8cc6648c/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
URL: <http://pidgin.im/pipermail/devel/attachments/20100412/8cc6648c/attachment.sig>

More information about the Devel mailing list