engine: more checks on IPv6 and multicast
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/engines/net.c b/engines/net.c
index 5fdc88c..4be106a 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -1039,12 +1039,17 @@
}
#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);
@@ -1058,6 +1063,7 @@
} 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);