[zeromq-dev] [PATCH] Additional preparation for IPv6 in 3.0

Steven McCoy steven.mccoy at miru.hk
Fri Jul 22 12:54:19 CEST 2011

On 22 July 2011 18:02, Martin Sustrik <sustrik at 250bpm.com> wrote:

> On 07/17/2011 07:47 PM, Steven McCoy wrote:
>> Two routes available, either "tcp" and "tcp6" like SMTP or "tcp" with
>> ZMQ_PREFER_IPV4 and ZMQ_PREFER_IPV6 options like Java.  I'm going with
>> the latter.
> I am reviewing the patch. The new options is called ZMQ_IPV6ONLY.
> With respect to RFC3493, section 5.3, I would guess the option is meant to
> disable IPv4 communication over IPv6 socket. Which implies there are both
> IPv4 and IPv6 sockets. Which in turn contradicts the text above.
> Can you explain what the actual semantics of the options are?
ZMQ_IPV6ONLY is to force native IPv6 interfaces only, i.e. no IPv4-in-IPv6

ZMQ_PREFER_IPV4_STACK is to force IPv4 interfaces only, i.e. no IPv6 at all.

ZMQ_PREFER_IPV6_ADDRESSES is to force enable/disable IPv4-in-IPv6 mapping,
as some OSs appear to have it enabled for DNS but disabled by default for
interface enumeration.

It would read that ZMQ_IPV6ONLY and ZMQ_PREFER_IPV6_ADDRESSES are similar,
the minor detail is that IPV6ONLY only applies to IPv6 sockets.

Windows makes things a bit complicated, dual-stack behaviour is only
available in Vista+ when you enable IPv4-in-IPv6 mapping with IPv6 sockets.

The idea is you should be able to bind a ZMQ socket to "tcp://*:5555" and
listen on both IPv4 and IPv6 stacks by default.  This is inherently
impossible with Windows XP unless you open two TCP sockets.

When using ZMQ's connect on "tcp://remotehost:5555" you want the OS to
decide the address family to use, but say in a broken environment you may
wish to force IPv4 usage with ZMQ_PREFER_IPV4_STACK.

In a dual-stack environment when binding you use ZMQ_PREFER_IPV6_ADDRESSES
to decide the preferred format of the return value of getpeername(), either
IPv4 or IPv4-in-IPv6 for IPv4 peers.

It is still confusing :-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110722/d25a8ebd/attachment.htm>

More information about the zeromq-dev mailing list