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