|
@@ -268,6 +268,9 @@ int udp_init(struct socket_info* sock_info)
|
|
|
{
|
|
|
union sockaddr_union* addr;
|
|
|
int optval;
|
|
|
+#ifdef USE_MCAST
|
|
|
+ unsigned char m_ttl, m_loop;
|
|
|
+#endif
|
|
|
addr=&sock_info->su;
|
|
|
/*
|
|
|
addr=(union sockaddr_union*)pkg_malloc(sizeof(union sockaddr_union));
|
|
@@ -318,16 +321,18 @@ int udp_init(struct socket_info* sock_info)
|
|
|
}
|
|
|
/* set the multicast options */
|
|
|
if (addr->s.sa_family==AF_INET){
|
|
|
+ m_loop=mcast_loopback;
|
|
|
if (setsockopt(sock_info->socket, IPPROTO_IP, IP_MULTICAST_LOOP,
|
|
|
- &mcast_loopback, sizeof(mcast_loopback))==-1){
|
|
|
+ &m_loop, sizeof(m_loop))==-1){
|
|
|
LOG(L_WARN, "WARNING: udp_init: setsockopt(IP_MULTICAST_LOOP):"
|
|
|
" %s\n", strerror(errno));
|
|
|
/* it's only a warning because we might get this error if the
|
|
|
network interface doesn't support multicasting -- andrei */
|
|
|
}
|
|
|
if (mcast_ttl>=0){
|
|
|
+ m_ttl=mcast_ttl;
|
|
|
if (setsockopt(sock_info->socket, IPPROTO_IP, IP_MULTICAST_TTL,
|
|
|
- &mcast_ttl, sizeof(mcast_ttl))==-1){
|
|
|
+ &m_ttl, sizeof(m_ttl))==-1){
|
|
|
LOG(L_WARN, "WARNING: udp_init: setsockopt (IP_MULTICAST_TTL):"
|
|
|
" %s\n", strerror(errno));
|
|
|
}
|