Explorar el Código

core: fix compilation on platforms without struct ip_mreqn

- collateral by new mcast feature (commit 8b39cb6a3aa37d26da1ccf8f55f25aaba8fc4613)
Mikko Lehto hace 8 años
padre
commit
70262d3063
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      udp_server.c

+ 8 - 0
udp_server.c

@@ -215,18 +215,26 @@ int probe_max_receive_buffer( int udp_sock )
  */
 static int setup_mcast_rcvr(int sock, union sockaddr_union* addr, char* interface)
 {
+#ifdef HAVE_IP_MREQN
 	struct ip_mreqn mreq;
+#else
+	struct ip_mreq mreq;
+#endif
 	struct ipv6_mreq mreq6;
 
 	if (addr->s.sa_family==AF_INET){
 		memcpy(&mreq.imr_multiaddr, &addr->sin.sin_addr, 
 		       sizeof(struct in_addr));
+#ifdef HAVE_IP_MREQN
 		if (interface!=0) {
 			mreq.imr_ifindex = if_nametoindex(interface);
 		} else {
 			mreq.imr_ifindex = 0;
 		}
 		mreq.imr_address.s_addr = htonl(INADDR_ANY);
+#else
+		mreq.imr_interface.s_addr = htonl(INADDR_ANY);
+#endif
 		
 		if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,&mreq,
 			       sizeof(mreq))==-1){