[zeromq-dev] [PATCH] IPv6 changes to 4.0
Steven McCoy
steven.mccoy at miru.hk
Mon Aug 22 14:18:00 CEST 2011
On 22 August 2011 19:51, Martin Sustrik <sustrik at 250bpm.com> wrote:
> On 08/22/2011 01:35 PM, Steven McCoy wrote:
>
> 3. When trying to bind to lo:5555 strace reports following (Linux):
>>
>> bind(10, {sa_family=AF_INET6, sin6_port=htons(5555),
>> inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0,
>> sin6_scope_id=0}, 28) = 0
>>
>> Which AFAIU is the same as *.
>>
>
> What happens is the eth0 resolves to 2 addresses (IPv4 and IPv6) which
> triggers this code:
>
> // Multiple matching interfaces, therefore return entire adapter.
> if (found > 1) {
> sockaddr_in6 sin6;
> memset (&sin6, 0, sizeof (sin6));
> sin6.sin6_family = AF_INET6;
> memcpy (&sin6.sin6_addr, &in6addr_any, sizeof (in6addr_any));
> sin6.sin6_scope_id = sin6_scope_id;
> memcpy (&address, &sin6, sizeof (sin6));
> }
>
> Which in turn binds to all interfaces.
>
> What was the intention here?
>
>
Then it gets in6addr_any:sin6_scope_id so theoretically if the OS supported
it bind would bind to the NIC. However on Linux you need to use
SO_BINDTODEVICE which requires CAP_NET_RAW to run. Hence the examples in
the initial post.
--
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110822/ff202a8c/attachment.htm>
More information about the zeromq-dev
mailing list