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

getaddrinfo() may list IPv6 even if not supported

This fixes the RTP input failing completely.
parent c175d930
...@@ -180,25 +180,13 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port, ...@@ -180,25 +180,13 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
int on = (family == AF_INET6); int on = (family == AF_INET6);
setsockopt (fd, SOL_IPV6, IPV6_V6ONLY, &on, sizeof (on)); setsockopt (fd, SOL_IPV6, IPV6_V6ONLY, &on, sizeof (on));
} }
else if (ptr->ai_family == AF_INET && family == AF_UNSPEC) if (ptr->ai_family == AF_INET)
{ #endif
for (const struct addrinfo *p = ptr; p != NULL; p = p->ai_next)
if (p->ai_family == AF_INET6)
{
net_Close (fd);
fd = -1;
break;
}
if (fd == -1)
continue;
}
#else
if (family == AF_UNSPEC && ptr->ai_next != NULL) if (family == AF_UNSPEC && ptr->ai_next != NULL)
{ {
msg_Warn (obj, "ambiguous network protocol specification"); msg_Warn (obj, "ambiguous network protocol specification");
msg_Warn (obj, "please select IP version explicitly"); msg_Warn (obj, "please select IP version explicitly");
} }
#endif
fd = net_SetupDgramSocket( obj, fd, ptr ); fd = net_SetupDgramSocket( obj, fd, ptr );
if( fd == -1 ) if( fd == -1 )
......
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