Commit a719a0db authored by Marian Durkovic's avatar Marian Durkovic

Sync IPv4 and IPv6 multicast handlers and disable connect() on FreeBSD

- it doesn't work neither on FreeBSD 5.4 nor on FreeBSD 4.11:
      cannot connect socket (Can't assign requested address)
parent 5de481a9
...@@ -260,13 +260,15 @@ static int OpenUDP( vlc_object_t * p_this ) ...@@ -260,13 +260,15 @@ static int OpenUDP( vlc_object_t * p_this )
/* Determine interface to be used for multicast */ /* Determine interface to be used for multicast */
char * psz_if_addr = config_GetPsz( p_this, "miface-addr" ); char * psz_if_addr = config_GetPsz( p_this, "miface-addr" );
#ifdef IP_ADD_SOURCE_MEMBERSHIP
/* If we have a source address, we use IP_ADD_SOURCE_MEMBERSHIP /* If we have a source address, we use IP_ADD_SOURCE_MEMBERSHIP
so that IGMPv3 aware OSes running on IGMPv3 aware networks so that IGMPv3 aware OSes running on IGMPv3 aware networks
will do an IGMPv3 query on the network */ will do an IGMPv3 query on the network */
if (( *psz_server_addr ) if (( *psz_server_addr )
/*&& ((ntohl (sock.sin_addr.s_addr) >> 24) == 232)*/) /*&& ((ntohl (sock.sin_addr.s_addr) >> 24) == 232)*/)
{ {
#ifndef IP_ADD_SOURCE_MEMBERSHIP
errno = ENOSYS;
#else
struct ip_mreq_source imr; struct ip_mreq_source imr;
imr.imr_multiaddr.s_addr = sock.sin_addr.s_addr; imr.imr_multiaddr.s_addr = sock.sin_addr.s_addr;
...@@ -287,20 +289,20 @@ static int OpenUDP( vlc_object_t * p_this ) ...@@ -287,20 +289,20 @@ static int OpenUDP( vlc_object_t * p_this )
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 )
#endif
{ {
msg_Warn( p_this, "Source specific multicast failed (%s) -" msg_Warn( p_this, "Source specific multicast failed (%s) -"
"check if your OS really supports IGMPv3", " check if your OS really supports IGMPv3",
strerror(errno) ); strerror(errno) );
goto igmpv2; goto igmpv2;
} }
} }
/* If there is no source address, we use IP_ADD_MEMBERSHIP */ /* If there is no source address, we use IP_ADD_MEMBERSHIP */
else else
#endif igmpv2:
{ {
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
...@@ -381,6 +383,10 @@ static int OpenUDP( vlc_object_t * p_this ) ...@@ -381,6 +383,10 @@ static int OpenUDP( vlc_object_t * p_this )
} }
#endif #endif
#ifdef __FreeBSD__
else
#endif
if( *psz_server_addr ) if( *psz_server_addr )
{ {
/* Build socket for remote connection */ /* Build socket for remote connection */
......
...@@ -279,10 +279,11 @@ static int OpenUDP( vlc_object_t * p_this ) ...@@ -279,10 +279,11 @@ static int OpenUDP( vlc_object_t * p_this )
} }
} }
else else
mldv1:
{ {
struct ipv6_mreq imr; struct ipv6_mreq imr;
int res; int res;
mldv1:
imr.ipv6mr_interface = sock.sin6_scope_id; imr.ipv6mr_interface = sock.sin6_scope_id;
imr.ipv6mr_multiaddr = sock.sin6_addr; imr.ipv6mr_multiaddr = sock.sin6_addr;
msg_Dbg( p_this, "IPV6_JOIN_GROUP multicast request" ); msg_Dbg( p_this, "IPV6_JOIN_GROUP multicast request" );
...@@ -302,6 +303,10 @@ mldv1: ...@@ -302,6 +303,10 @@ mldv1:
} }
} }
#ifdef __FreeBSD__
else
#endif
if( *psz_server_addr ) if( *psz_server_addr )
{ {
int ttl; int ttl;
......
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