Commit 541441bf authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

- Fix segfault when doing RTSP DESCRIBE (trunk-only bug from [11811])

- cleanup net_AddressIsMulticast
parent ea314b58
......@@ -469,41 +469,32 @@ static inline vlc_bool_t net_AddressIsMulticast( vlc_object_t *p_object, char *p
vlc_bool_t b_multicast = VLC_FALSE;
int i;
if( psz_addr == NULL )
{
msg_Err( p_object, "*FIXME* Unexpected NULL URI for net_AddressIsMulticast" );
msg_Err( p_object, "This should not happen. VLC needs fixing." );
return VLC_FALSE;
}
memset( &hints, 0, sizeof( hints ) );
hints.ai_socktype = SOCK_DGRAM; /* UDP */
hints.ai_flags = AI_NUMERICHOST;
i = vlc_getaddrinfo( p_object, psz_addr, 0,
&hints, &res );
/*if( i == 0 )
i = vlc_getnameinfo( res->ai_addr, res->ai_addrlen, psz_buf,
sizeof( psz_buf ), NULL, NI_NUMERICHOST );*/
if( i )
{
msg_Err( p_object, "Invalid node for net_AddressIsMulticast: %s : %s",
psz_addr, vlc_gai_strerror( i ) );
return b_multicast;
return VLC_FALSE;
}
if( res->ai_family == AF_INET )
{
#if !defined( SYS_BEOS )
struct sockaddr_in *v4 = (struct sockaddr_in *) res->ai_addr;
b_multicast = ( ntohl( v4->sin_addr.s_addr ) >= 0xe0000000 && ntohl( v4->sin_addr.s_addr ) <= 0xefffffff );
b_multicast = ( ntohl( v4->sin_addr.s_addr ) >= 0xe0000000 )
&& ( ntohl( v4->sin_addr.s_addr ) <= 0xefffffff );
#endif
}
else if( res->ai_family == AF_INET6 )
{
#if defined( WIN32 ) || defined( HAVE_IF_NAMETOINDEX )
struct sockaddr_in6 *v6 = (struct sockaddr_in6 *) res->ai_addr;
b_multicast = IN6_IS_ADDR_MULTICAST( &v6->sin6_addr);
#if defined( WIN32 ) || defined( HAVE_GETADDRINFO )
struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)res->ai_addr;
b_multicast = IN6_IS_ADDR_MULTICAST( &v6->sin6_addr );
#endif
}
......
......@@ -1018,10 +1018,11 @@ static char *SDPGenerate( vod_media_t *p_media, char *psz_destination )
p += sprintf( p, "c=IN IP4 %s", psz_destination ? psz_destination : "0.0.0.0" );
if( net_AddressIsMulticast( p_media, psz_destination ? psz_destination : "0.0.0.0" ) )
if( ( psz_destination != NULL )
&& net_AddressIsMulticast( p_media->p_vod, psz_destination ) )
{
/* Add the ttl if it is a multicast address */
p += sprintf( p, "/%d\r\n", p_media->i_ttl );
p += sprintf( p, "/%d\r\n", p_media->i_ttl );
}
else
{
......
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