[zeromq-dev] libpgm mishandles getifaddrs() quirk (with patch)

Stuart Levy salevy at illinois.edu
Wed Aug 8 22:28:40 CEST 2012

I'm not sure whether this is the place to report a libpgm bug, but here 

In trying to use zeromq epgm PUB/SUB sockets with 
I'm having trouble finding a portable way to specify the interface,
hoping to use the same address string on multiple machines -- something 


but on zeromq-2.2.0 + libpgm-5.2.119~dfsg under CentOS 5.x x86_64, these 
forms aren't working,
on a bunch of hosts each of which has an interface on the net-10 network 
(and also has an Infiniband interface).

Specifically, on one node this behaves as expected, but on others, I get 
(with debug enabled)
   Fatal: file if.c: line 658 (parse_interface): assertion failed: (0 != 

Plowing through the code, getifaddrs() returned a list of 
ordinary-looking network interfaces,
plus one oddball AF_INET6 entry with ifa->ifa_name of "????".

This seems to be due to a kernel/glibc bug in getifaddrs(), which 
returns a strange ifa_name for Infiniband interfaces with IPV6 
addresses.  But libpgm's response shouldn't be to crash the program.  I 
patched it as follows to simply skip interfaces where 
pgm_if_nametoindex() fails.

--- pgm/if.c~    2012-08-08 14:10:50.558770957 -0500
+++ pgm/if.c    2012-08-08 14:12:23.081299409 -0500
@@ -655,7 +655,8 @@

          const unsigned ifindex = pgm_if_nametoindex 
(ifa->ifa_addr->sa_family, ifa->ifa_name);
-        pgm_assert (0 != ifindex);
+        if (0 == ifindex)    /* skip interface if something's wrong 
with ifa_name */
+            continue;        /* as can happen with Infiniband IPV6 
interfaces on linux */

  /* check numeric host */
          if (check_addr)

More information about the zeromq-dev mailing list