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

Fix link-scoped IPv6 addresses

parent 6bf818a2
......@@ -38,36 +38,37 @@ char *AddressToSDP (const struct sockaddr *addr, socklen_t addrlen, char *buf)
+ sizeof (addr->sa_family))
return NULL;
const char *ttl = NULL;
strcpy (buf, "IN IP* ");
if (vlc_getnameinfo (addr, addrlen, buf + 7, MAXSDPADDRESS - 7, NULL,
NI_NUMERICHOST))
return NULL;
switch (addr->sa_family)
{
case AF_INET:
{
if (net_SockAddrIsMulticast (addr, addrlen))
ttl = "/255"; // obsolete in RFC4566, dummy value
strcat (buf, "/255"); // obsolete in RFC4566, dummy value
buf[5] = '4';
break;
}
#ifdef AF_INET6
case AF_INET6:
{
char *ptr = strchr (buf, '%');
if (ptr != NULL)
*ptr = '\0'; // remove scope ID
buf[5] = '6';
break;
}
#endif
default:
return NULL;
}
if (vlc_getnameinfo (addr, addrlen, buf + 7, MAXSDPADDRESS - 7, NULL,
NI_NUMERICHOST))
return NULL;
if (ttl != NULL)
strcat (buf, ttl);
return buf;
}
......
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