X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fnet.c;h=4be106a28307e20db7ee26d315877b41d081ffec;hb=6611e9c767bad5c903c8ac59b9ae8409315dbca2;hp=4ba4a5f80b82edea9e30566d7fc48e5b309a900a;hpb=0b783341927056e62ca2178c2ca74cca2c7b0100;p=fio.git diff --git a/engines/net.c b/engines/net.c index 4ba4a5f8..4be106a2 100644 --- a/engines/net.c +++ b/engines/net.c @@ -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; @@ -1035,12 +1039,17 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port) } #endif - if (td->o.filename){ + if (td->o.filename) { if (!is_udp(o) || !fio_netio_is_multicast(td->o.filename)) { log_err("fio: hostname not valid for non-multicast inbound network IO\n"); close(fd); return 1; } + if (is_ipv6(o)) { + log_err("fio: IPv6 not supported for multicast network IO"); + close(fd); + return 1; + } inet_aton(td->o.filename, &sin.sin_addr); @@ -1054,6 +1063,7 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port) } else { mr.imr_interface.s_addr = htonl(INADDR_ANY); } + if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&mr, sizeof(mr)) < 0) { td_verror(td, errno, "setsockopt IP_ADD_MEMBERSHIP"); close(fd);