[zeromq-dev] [PATCH] IPv6 support v2.0

Steven McCoy steven.mccoy at miru.hk
Wed Aug 10 08:47:43 CEST 2011


On 10 August 2011 14:29, Steven McCoy <steven.mccoy at miru.hk> wrote:

> On 8 August 2011 18:47, Martin Sustrik <sustrik at 250bpm.com> wrote:
>
>> Hi Steven,
>>
>> I guess there may be a problem here:
>>
>>    for (ifaddrs *ifp = ifa; ifp != NULL ;ifp = ifp->ifa_next)
>>    {
>>        if (ifp->ifa_addr == NULL)
>>            continue;
>>
>>        int family = ifp->ifa_addr->sa_family;
>>
>>        if ((family == AF_INET
>>             || (!ipv4only_ && family == AF_INET6))
>>            && !strcmp (interface_, ifp->ifa_name))
>>        {
>>            memcpy (addr_, ifp->ifa_addr,
>>                    (family == AF_INET) ? sizeof (struct sockaddr_in)
>>                                        : sizeof (struct sockaddr_in6));
>>            found = true;
>>            break;
>>        }
>>    }
>>
>> Specifically, if you have both IPv4 and IPv6 interface with the same name
>> and ipv4only is false, it depends on ordering of the results in getifaddrs()
>> resultset which of those two is returned.
>>
>> I would suppose in such case IPv6 address should be returned.
>>
>>
>  I think I would prefer if the entire adapter was used in bind ("eth0"),
> therefore a return value of in6addr_any with the sin6_scope_id set
> appropriately would be more sound.
>


Modified patch #2 attached to implement this.

-- 
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110810/e6787718/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Update-resolve_nic_name-with-ip6addr_any.patch
Type: text/x-patch
Size: 7058 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110810/e6787718/attachment.bin>


More information about the zeromq-dev mailing list