Joe Orton wrote:
> On Wed, Jun 06, 2007 at 06:06:44PM +0300, Lucian Adrian Grijincu wrote:
>> $>./test ::1 ssh
>> ./test: getaddrinfo: Address family for hostname not supported
>>
>> $> telnet ::1 ssh
>> Trying ::1...
>> Connected to ::1.
> 
> That makes little sense.  I presume you do in fact have the "ipv6" 
> module loaded (lsmod | grep ipv6)?  What version of glibc is this?  Does 
> it make any difference if you set ai_flags to 0 in your test program?
> 

In case anyone wanna try.. test attached.

--
Davi Arnaut
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>

int main(int argc, char *argv[])
{
    int rc;
    struct addrinfo hints;
    struct addrinfo *res;

    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    rc = getaddrinfo("::1", NULL, &hints, &res);
    if (rc != 0) {
        puts("getaddrinfo AF_UNSPEC/SOCK_STREAM failed");
        return -1;
    }
    freeaddrinfo(res);

    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_flags = AI_ADDRCONFIG;
    rc = getaddrinfo("::1", NULL, &hints, &res);
    if (rc != 0) {
        puts("getaddrinfo AF_UNSPEC/SOCK_STREAM/AI_ADDRCONFIG failed");
        return -1;
    }
    freeaddrinfo(res);

    return 0;
}

Reply via email to