.oval = FIO_TYPE_TCP,
.help = "Transmission Control Protocol",
},
+#ifdef CONFIG_IPV6
{ .ival = "tcpv6",
.oval = FIO_TYPE_TCP_V6,
.help = "Transmission Control Protocol V6",
},
+#endif
{ .ival = "udp",
.oval = FIO_TYPE_UDP,
.help = "User Datagram Protocol",
},
+#ifdef CONFIG_IPV6
{ .ival = "udpv6",
.oval = FIO_TYPE_UDP_V6,
.help = "User Datagram Protocol V6",
},
+#endif
{ .ival = "unix",
.oval = FIO_TYPE_UNIX,
.help = "UNIX domain socket",
do {
if (is_udp(o)) {
- struct sockaddr *to;
+ const struct sockaddr *to;
socklen_t len;
if (is_ipv6(o)) {
if (is_ipv6(o)) {
af = AF_INET6;
- dst = &nd->addr6;
+ dst = &nd->addr6.sin6_addr;
} else {
af = AF_INET;
- dst = &nd->addr;
+ dst = &nd->addr.sin_addr;
}
if (fio_fill_addr(td, host, af, dst, &res))
struct sockaddr_un *soun = &nd->addr_un;
soun->sun_family = AF_UNIX;
- strcpy(soun->sun_path, path);
+ memset(soun->sun_path, 0, sizeof(soun->sun_path));
+ strncpy(soun->sun_path, path, sizeof(soun->sun_path) - 1);
return 0;
}
memset(addr, 0, sizeof(*addr));
addr->sun_family = AF_UNIX;
- strcpy(addr->sun_path, path);
+ strncpy(addr->sun_path, path, sizeof(addr->sun_path) - 1);
unlink(path);
len = sizeof(addr->sun_family) + strlen(path) + 1;
struct netio_options *o = td->eo;
struct ip_mreq mr;
struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
struct sockaddr *saddr;
int fd, opt, type, domain;
socklen_t len;
memset(&sin, 0, sizeof(sin));
- memset(&sin6, 0, sizeof(sin6));
if (o->proto == FIO_TYPE_TCP) {
type = SOCK_STREAM;
}
#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);
} 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);
len = sizeof(nd->addr6);
nd->addr6.sin6_family = AF_INET6;
- nd->addr6.sin6_addr = sin6.sin6_addr.s6_addr ? sin6.sin6_addr : in6addr_any;
+ nd->addr6.sin6_addr = in6addr_any;
nd->addr6.sin6_port = htons(port);
}
if (bind(fd, saddr, len) < 0) {
+ close(fd);
td_verror(td, errno, "bind");
return 1;
}
struct netio_data *nd;
if (!td->files_index) {
- add_file(td, td->o.filename ?: "net");
+ add_file(td, td->o.filename ?: "net", 0, 0);
td->o.nr_files = td->o.nr_files ?: 1;
+ td->o.open_files++;
}
if (!td->io_ops->data) {