Commit 42c880a8 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Make use of bctbx_getaddrinfo() when sending ICE message so that Apple systems...

Make use of bctbx_getaddrinfo() when sending ICE message so that Apple systems can replace the IPv4 destination by a NAT64 IPv6 address when using an IPv6 only network.
parent 892693f5
......@@ -1250,16 +1250,19 @@ static void ice_stun_server_request_free(IceStunServerRequest *request) {
static int ice_send_message_to_socket(RtpTransport * rtptp, char* buf, size_t len, const struct sockaddr *from, socklen_t fromlen, const struct sockaddr *to, socklen_t tolen) {
struct sockaddr_storage v4mappedto;
socklen_t v4mappedtolen = sizeof(v4mappedto);
mblk_t *m = rtp_session_create_packet_raw((const uint8_t *)buf, len);
int err;
memcpy(&m->net_addr, from, fromlen);
m->net_addrlen = fromlen;
if ((rtptp->session-> == AF_INET6) && (to->sa_family == AF_INET)) {
bctbx_sockaddr_ipv4_to_ipv6(to, (struct sockaddr *)&v4mappedto, &v4mappedtolen);
to = (const struct sockaddr *)&v4mappedto;
tolen = v4mappedtolen;
struct addrinfo *v6ai;
char to_addr_str[64];
int to_port = 0;
memset(to_addr_str, 0, sizeof(to_addr_str));
bctbx_sockaddr_to_ip_address(to, tolen, to_addr_str, sizeof(to_addr_str), &to_port);
v6ai = bctbx_ip_address_to_addrinfo(AF_INET6, SOCK_DGRAM, to_addr_str, to_port);
to = v6ai->ai_addr;
tolen = v6ai->ai_addrlen;
err = meta_rtp_transport_modifier_inject_packet_to_send_to(rtptp, NULL, m, 0, to, tolen);
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