Portable IPv6 support for purple_network_listen

Ethan Blanton elb at pidgin.im
Fri Apr 16 08:52:38 EDT 2010


Paul Aurich spake unto us the following wisdom:
> On 2010-04-12 19:50, Paul Aurich wrote:
> > 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).
> 
> After talking with Mark and Ethan in devel at cpi, here's an updated patch.
>  With this version, callers can only use one socket if they generate an
> IPv6 listener and purple_socket_speaks_ipv4(socket) returns TRUE, though
> callers still must handle the case where it's FALSE (or, in most cases,
> just use IPv4 since the protocol doesn't support (or hasn't been REd)
> IPv6 ;) ).

Looks good to me.  The only thing I see that might be an issue is
AF_UNSPEC -- I don't know how universal it is.  (It might be perfectly
universal.)  We might as well stick it in and deal with that if it
becomes a problem, though.  0 can safely be used in its place if
necessary.

Ethan

-- 
The laws that forbid the carrying of arms are laws [that have no remedy
for evils].  They disarm only those who are neither inclined nor
determined to commit crimes.
		-- Cesare Beccaria, "On Crimes and Punishments", 1764
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
URL: <http://pidgin.im/pipermail/devel/attachments/20100416/f566405c/attachment.sig>


More information about the Devel mailing list