engine: pass in right protocol family on host lookup
authorJens Axboe <axboe@kernel.dk>
Fri, 24 Jan 2014 04:41:33 +0000 (20:41 -0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Jan 2014 04:41:33 +0000 (20:41 -0800)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/net.c

index 4ba4a5f80b82edea9e30566d7fc48e5b309a900a..5fdc88ced1192c59df44c7e3f54f3647ff510748 100644 (file)
@@ -857,13 +857,17 @@ static int fio_fill_addr(struct thread_data *td, const char *host, int af,
                return 0;
 
        memset(&hints, 0, sizeof(hints));
-       hints.ai_family = AF_UNSPEC;
 
        if (is_tcp(o))
                hints.ai_socktype = SOCK_STREAM;
        else
                hints.ai_socktype = SOCK_DGRAM;
 
+       if (is_ipv6(o))
+               hints.ai_family = AF_INET6;
+       else
+               hints.ai_family = AF_INET;
+
        ret = getaddrinfo(host, NULL, &hints, res);
        if (ret) {
                int e = EINVAL;