make use of stun xor mapped address

This commit is contained in:
Simon Morlat 2010-11-19 11:30:44 +01:00
parent d8322ca6c0
commit f5a6f8e4b6
2 changed files with 8 additions and 3 deletions

View file

@ -462,8 +462,13 @@ static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id
struct in_addr ia;
stunParseMessage(buf,len, &resp );
*id=resp.msgHdr.tr_id.octet[0];
*port = resp.mappedAddress.ipv4.port;
ia.s_addr=htonl(resp.mappedAddress.ipv4.addr);
if (resp.hasXorMappedAddress){
*port = resp.xorMappedAddress.ipv4.port;
ia.s_addr=htonl(resp.xorMappedAddress.ipv4.addr);
}else if (resp.hasMappedAddress){
*port = resp.mappedAddress.ipv4.port;
ia.s_addr=htonl(resp.mappedAddress.ipv4.addr);
}else return -1;
strncpy(ipaddr,inet_ntoa(ia),LINPHONE_IPADDR_SIZE);
}
return len;

2
oRTP

@ -1 +1 @@
Subproject commit 930fac6f59b13cdd6cbb5f370911a65f98bad7de
Subproject commit d37b7097e796c6dbdc57ca1f15de30bb628fa395