+#ifdef CONFIG_TCP_NODELAY
+ if (o->nodelay && is_tcp(o)) {
+ int optval = 1;
+
+ if (setsockopt(f->fd, IPPROTO_TCP, TCP_NODELAY, (void *) &optval, sizeof(int)) < 0) {
+ log_err("fio: cannot set TCP_NODELAY option on socket (%s), disable with 'nodelay=0'\n", strerror(errno));
+ return 1;
+ }
+ }
+#endif
+
+ if (is_udp(o)) {
+ if (!fio_netio_is_multicast(td->o.filename))
+ return 0;
+ if (is_ipv6(o)) {
+ log_err("fio: multicast not supported on IPv6\n");
+ close(f->fd);
+ return 1;
+ }
+
+ if (o->intfc) {
+ struct in_addr interface_addr;
+
+ if (inet_aton(o->intfc, &interface_addr) == 0) {
+ log_err("fio: interface not valid interface IP\n");
+ close(f->fd);
+ return 1;
+ }
+ if (setsockopt(f->fd, IPPROTO_IP, IP_MULTICAST_IF, (const char*)&interface_addr, sizeof(interface_addr)) < 0) {
+ td_verror(td, errno, "setsockopt IP_MULTICAST_IF");
+ close(f->fd);
+ return 1;
+ }
+ }
+ if (setsockopt(f->fd, IPPROTO_IP, IP_MULTICAST_TTL, (const char*)&o->ttl, sizeof(o->ttl)) < 0) {
+ td_verror(td, errno, "setsockopt IP_MULTICAST_TTL");
+ close(f->fd);
+ return 1;
+ }