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

Martin Sustrik sustrik at 250bpm.com
Mon Aug 8 12:47:23 CEST 2011

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)

         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;

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.


More information about the zeromq-dev mailing list