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

Pick IPv6 scope ID from group address, instead of source address

Fix possible segfault as a side-effect
parent 30b35035
......@@ -351,22 +351,13 @@ net_SourceSubscribe (vlc_object_t *obj, int fd,
#ifdef AF_INET6
case AF_INET6:
level = SOL_IPV6;
if ((src != NULL)
&& memcmp (&((const struct sockaddr_in6 *)src)->sin6_addr,
&in6addr_any, sizeof (in6addr_any)) == 0)
src = NULL;
if (((const struct sockaddr_in6 *)src)->sin6_scope_id)
iid = ((const struct sockaddr_in6 *)src)->sin6_scope_id;
if (((const struct sockaddr_in6 *)grp)->sin6_scope_id)
iid = ((const struct sockaddr_in6 *)grp)->sin6_scope_id;
break;
#endif
case AF_INET:
level = SOL_IP;
if ((src != NULL)
&& ((const struct sockaddr_in *)src)->sin_addr.s_addr
== INADDR_ANY)
src = NULL;
break;
default:
......@@ -374,6 +365,25 @@ net_SourceSubscribe (vlc_object_t *obj, int fd,
return -1;
}
if (src != NULL)
switch (src->sa_family)
{
#ifdef AF_INET6
case AF_INET6:
if (memcmp (&((const struct sockaddr_in6 *)src)->sin6_addr,
&in6addr_any, sizeof (in6addr_any)) == 0)
src = NULL;
break;
#endif
case AF_INET:
if (((const struct sockaddr_in *)src)->sin_addr.s_addr
== INADDR_ANY)
src = NULL;
break;
}
/* Agnostic ASM/SSM multicast join */
#ifdef MCAST_JOIN_SOURCE_GROUP
union
......
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