Commit 8902dce1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fallback to IGMPv2 when IGMPv3 fails - fixes #734

parent bfcdde95
...@@ -269,26 +269,22 @@ static int OpenUDP( vlc_object_t * p_this ) ...@@ -269,26 +269,22 @@ static int OpenUDP( vlc_object_t * p_this )
if( psz_if_addr != NULL && *psz_if_addr if( psz_if_addr != NULL && *psz_if_addr
&& inet_addr(psz_if_addr) != INADDR_NONE ) && inet_addr(psz_if_addr) != INADDR_NONE )
{
imr.imr_interface.s_addr = inet_addr(psz_if_addr); imr.imr_interface.s_addr = inet_addr(psz_if_addr);
}
else else
{
imr.imr_interface.s_addr = INADDR_ANY; imr.imr_interface.s_addr = INADDR_ANY;
}
if( psz_if_addr != NULL ) free( psz_if_addr );
msg_Dbg( p_this, "IP_ADD_SOURCE_MEMBERSHIP multicast request" ); if( psz_if_addr != NULL )
free( psz_if_addr );
/* Join Multicast group with source filter */ /* Join Multicast group with source filter */
if( setsockopt( i_handle, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP, if( setsockopt( i_handle, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP,
(char*)&imr, (char*)&imr,
sizeof(struct ip_mreq_source) ) == -1 ) sizeof(struct ip_mreq_source) ) == -1 )
{ {
msg_Err( p_this, "failed to join IP multicast group (%s)", msg_Warn( p_this, "Source specific multicast failed (%s) -"
"falling back to non-specific mode",
strerror(errno) ); strerror(errno) );
msg_Err( p_this, "are you sure your OS supports IGMPv3?" ); goto igmpv2;
close( i_handle );
return 0;
} }
} }
/* If there is no source address, we use IP_ADD_MEMBERSHIP */ /* If there is no source address, we use IP_ADD_MEMBERSHIP */
...@@ -297,6 +293,7 @@ static int OpenUDP( vlc_object_t * p_this ) ...@@ -297,6 +293,7 @@ static int OpenUDP( vlc_object_t * p_this )
{ {
struct ip_mreq imr; struct ip_mreq imr;
igmpv2:
imr.imr_interface.s_addr = INADDR_ANY; imr.imr_interface.s_addr = INADDR_ANY;
imr.imr_multiaddr.s_addr = sock.sin_addr.s_addr; imr.imr_multiaddr.s_addr = sock.sin_addr.s_addr;
if( psz_if_addr != NULL && *psz_if_addr if( psz_if_addr != NULL && *psz_if_addr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment