ralphjzhang / openpgm

Automatically exported from code.google.com/p/openpgm
0 stars 0 forks source link

parse_interface() fails on "eth0" with Ubuntu 14.04 #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
if.c, line 520:

const int eai = getaddrinfo (ifname, NULL, &hints, &result);

On Ubuntu 14.04 under mysterious circumstances it returns -3 (EAI_AGAIN) with 
ifname = "eth0". DHCP was switched off, if it matters.
I suggest to add "case EAI_AGAIN:" under "case EAI_NONAME:":

#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME
        case EAI_NODATA:
#endif
        case EAI_AGAIN:
        case EAI_NONAME:
            check_ifname = TRUE;
            break;

After this fix, ZeroMQ successfully connects to epgm://eth0;239.192.1.1.

Original issue reported on code.google.com by gmark...@gmail.com on 4 Apr 2014 at 1:16

GoogleCodeExporter commented 8 years ago
Versions: libc 2.19-0ubuntu3, kernel 3.13.0-20-generic.

Original comment by gmark...@gmail.com on 4 Apr 2014 at 1:28

GoogleCodeExporter commented 8 years ago
Thanks, I was surprised to never see this error code in the wild even with bad 
DNS servers or mDNS.  Will update trunk.

Original comment by fnjo...@gmail.com on 4 Apr 2014 at 5:20

GoogleCodeExporter commented 8 years ago
Actually, I'm not sure it is sensible to hide such an subsystem failure within 
the API.  It would be more apparent if the application calling 
pgm_getaddrinfo() captures the error domain PGM_ERROR_DOMAIN_IF and code 
PGM_ERROR_AGAIN and determines how it should proceed.

One possible enhancement would be an option equivalent to AI_NUMERICHOST so 
that network services are not used however one has no control over system name 
services whether they be local or remote based.  So the flag would have to 
disable pgm_getnetbyname() and getaddrinfo(~AI_NUMERICHOST).

Alternatively of course, just use a /etc/networks name or IP address of the 
interface.

Original comment by fnjo...@gmail.com on 4 Apr 2014 at 5:44