- msg.msg_control = cmsg_data;
- msg.msg_controllen = sizeof(cmsg_data);
-
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
- cmsg->cmsg_level = IPPROTO_IP;
- cmsg->cmsg_type = IP_SENDSRCADDR;
-
- addr = (struct in_addr *)CMSG_DATA(cmsg);
- addr->s_addr = src_address->address;
-
- msg.msg_controllen = cmsg->cmsg_len;
-}
-#elif defined(IP_MULTICAST_IF)
- {
- struct in_addr any = { INADDR_ANY };
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, src_address ? (const void*) &src_address->address : (const void*) &any, sizeof(struct in_addr)) < 0) {
- avahi_log_warn("IP_MULTICAST_IF failed: %s", strerror(errno));
- return -1;
- }
+ msg.msg_control = cmsg_data;
+ msg.msg_controllen = CMSG_LEN(sizeof(struct in_addr));
+
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_len = msg.msg_controllen;
+ cmsg->cmsg_level = IPPROTO_IP;
+ cmsg->cmsg_type = IP_SENDSRCADDR;
+
+ addr = (struct in_addr *)CMSG_DATA(cmsg);
+ addr->s_addr = src_address->address;