[zeromq-dev] [PATCH] IPv6 changes to 4.0

Steven McCoy steven.mccoy at miru.hk
Tue Aug 23 03:17:28 CEST 2011

On 23 August 2011 01:12, Martin Sustrik <sustrik at 250bpm.com> wrote:

> On 08/22/2011 03:31 PM, Steven McCoy wrote:
>  Because you can easily have 2-4 IPv6 addresses per adapter.  You always
>> have the link-local scope one, but when you add real routable addressing
>> you can end up with a lot more.  I think my Sparc has four or five and
>> that's in the minimum configuration.  When the Sparc is up and running
>> with its IPv6 router it then proceeds to hand out another IPv6 address
>> to everyone else on the network.  Linux can have static IPv6 addresses
>> so it gains another.
> Ok. So AFAIU, even if you specify the interface, it can still have
> different addresses for different scopes (global, local etc.) right?
> What I miss is how can binding to inaddr6_any with specific scope_id
> resolve to a particular interface. There may be several interfaces with the
> specified scope, no? Or is scope_id actually a zone_id?
> Sorry for being stupid, I have no experience with IPv6 whatsoever.
No worries.  The scope_id is basically the interface index number
(if_nametoindex), so for example when dealing with link-local scope IPv6
addresses you MUST use the scope_id because each adapter has it's own
address space.

I extended that logic to think say if the scope_id is the adapter, if I bind
to in6addr_any with the scope_id why should that not bind to every interface
on that adapter instead?

Turns out it doesn't work like that.  Go figure.

Topology is like this:

adapter:  eth0
+-+- interface: IPv4 -
  +- interface: IPv6 - fe80::1  (link local scope)
  +- interface: IPv6 - 2002::2 (global link scope)

Interesting on some OS localhost / loopback adapters also have a link-local
scope address.

I'm not sure how to proceed as the options are all pretty crappy.

1)  Fail on NIC names resolving to multiple adapters.  I take this approach
in OpenPGM.
2)  Bind to everything.  This is what the patch does with IPv6 enabled and
without CAP_NET_RAW.
3)  Bind to the adapter.  This requires CAP_NET_RAW.
4)  Bind to the first IPv6 interface on the adapter.  The ordering tends to
be completely bogus.
5)  Re-implement the IPv6 RFC sorting rules and picked the preferred

I cannot think of a way to defer the sorting to getaddrinfo(), and it's
beyond the design to create multiple sockets for each interface.

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

More information about the zeromq-dev mailing list