bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gawk] getaddrinfo() in socketopen() (io.c) fails for AF_INET[46] --


From: Houder
Subject: [bug-gawk] getaddrinfo() in socketopen() (io.c) fails for AF_INET[46] -- unnecessarily - CORRECTION
Date: Thu, 08 Feb 2018 19:58:53 +0100
User-agent: XS4ALL Webmail

On 2018-02-08 18:59, Houder wrote:
[snip]

static int
socketopen(int family, int type, const char *localpname,
const char *remotepname, const char *remotehostname, bool *hard_error)
{
[snip]

        memset(& lhints, '\0', sizeof (lhints));

/* if only the loopback interface is up and hints.ai_flags has AI_ADDRCONFIG, getaddrinfo() will return the addresses of the loopback interface, but only
           if hints.ai_family == AF_UNSPEC
        */
        lhints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;

        lhints.ai_socktype = type;
        lhints.ai_family = family;

// do return the loopback address in case the loopback interface is the only one that
// is up (and hints.ai_family == AF_INET[46])
if ( (lhints.ai_family == AF_INET) || (lhints.ai_family == AF_INET6) )
   lhints.ai_flags = AI_PASSIVE;

        lerror = getaddrinfo(NULL, localpname, & lhints, & lres);
...

Sorry, I should have corrected my comments in gawk-4.2.0/io.c before sending
my e-mail ...

1.
/* if only the loopback interface is up and hints.ai_flags has AI_ADDRCONFIG, getaddrinfo() will succeed and return all wildcard addresses, but only if
   hints.ai_family == AF_UNSPEC
 */

2.
// do return the wildcard address in case the loopback interface is the only
// one that is up (and hints.ai_family == either AF_INET4 or AF_INET6)

Henri



reply via email to

[Prev in Thread] Current Thread [Next in Thread]