- Timestamp:
- Dec 28, 2016 3:40:07 AM (8 years ago)
- Location:
- pjproject/branches/projects/uwp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/uwp
- Property svn:mergeinfo changed
/pjproject/trunk (added) merged: 5209,5212-5234,5237-5253,5255,5257-5292,5294-5297,5299-5332,5334-5394,5396-5438,5440-5469,5471-5496,5498-5510
- Property svn:mergeinfo changed
-
pjproject/branches/projects/uwp/pjnath/src/pjnath/turn_session.c
r5170 r5513 609 609 } 610 610 611 /* Init DNS resolution option for IPv6 */ 612 if (sess->af == pj_AF_INET6()) 613 opt |= PJ_DNS_SRV_RESOLVE_AAAA_ONLY; 614 611 615 /* Fallback to DNS A only if default port is specified */ 612 616 if (default_port>0 && default_port<65536) { 613 opt = PJ_DNS_SRV_FALLBACK_A; 617 if (sess->af == pj_AF_INET6()) 618 opt |= PJ_DNS_SRV_FALLBACK_AAAA; 619 else 620 opt |= PJ_DNS_SRV_FALLBACK_A; 614 621 sess->default_port = (pj_uint16_t)default_port; 615 622 } … … 718 725 PJ_EINVALIDOP); 719 726 727 /* Verify address family in allocation param */ 728 if (param && param->af) { 729 PJ_ASSERT_RETURN(param->af==pj_AF_INET() || param->af==pj_AF_INET6(), 730 PJ_EINVAL); 731 } 732 720 733 pj_grp_lock_acquire(sess->grp_lock); 721 734 … … 762 775 PJ_STUN_ATTR_LIFETIME, 763 776 sess->alloc_param.lifetime); 777 } 778 779 /* Include ADDRESS-FAMILY if requested */ 780 if (sess->alloc_param.af || sess->af == pj_AF_INET6()) { 781 enum { IPV4_AF_TYPE = 0x01 << 24, 782 IPV6_AF_TYPE = 0x02 << 24 }; 783 784 if (sess->alloc_param.af == pj_AF_INET6() || 785 (sess->alloc_param.af == 0 && sess->af == pj_AF_INET6())) 786 { 787 pj_stun_msg_add_uint_attr(tdata->pool, tdata->msg, 788 PJ_STUN_ATTR_REQ_ADDR_TYPE, IPV6_AF_TYPE); 789 } else if (sess->alloc_param.af == pj_AF_INET()) { 790 /* For IPv4, only add the attribute when explicitly requested */ 791 pj_stun_msg_add_uint_attr(tdata->pool, tdata->msg, 792 PJ_STUN_ATTR_REQ_ADDR_TYPE, IPV4_AF_TYPE); 793 } 764 794 } 765 795 … … 778 808 * let the application do it if it wants to. 779 809 */ 780 set_state(sess, PJ_TURN_STATE_RESOLVED); 810 /* Set state back to RESOLVED may cause infinite loop (see #1942). */ 811 //set_state(sess, PJ_TURN_STATE_RESOLVED); 781 812 } 782 813 … … 1344 1375 return; 1345 1376 } 1346 if (raddr_attr && raddr_attr->sockaddr.addr.sa_family != sess->af) { 1377 if (raddr_attr && 1378 ((sess->alloc_param.af != 0 && 1379 raddr_attr->sockaddr.addr.sa_family != sess->alloc_param.af) || 1380 (sess->alloc_param.af == 0 && 1381 raddr_attr->sockaddr.addr.sa_family != sess->af))) 1382 { 1347 1383 on_session_fail(sess, method, PJNATH_EINSTUNMSG, 1348 pj_cstr(&s, "Error: RELAY-ADDRESS with non IPv4" 1349 " address family is not supported " 1350 "for now")); 1384 pj_cstr(&s, "Error: Mismatched RELAY-ADDRESS " 1385 "address family")); 1351 1386 return; 1352 1387 } … … 1719 1754 cnt<PJ_TURN_MAX_DNS_SRV_CNT; ++j) 1720 1755 { 1721 pj_sockaddr_in *addr = &sess->srv_addr_list[cnt].ipv4; 1722 1723 addr->sin_family = sess->af; 1724 addr->sin_port = pj_htons(rec->entry[i].port); 1725 addr->sin_addr.s_addr = rec->entry[i].server.addr[j].s_addr; 1726 1727 ++cnt; 1756 if (rec->entry[i].server.addr[j].af == sess->af) { 1757 pj_sockaddr *addr = &sess->srv_addr_list[cnt]; 1758 1759 addr->addr.sa_family = sess->af; 1760 pj_sockaddr_set_port(addr, rec->entry[i].port); 1761 if (sess->af == pj_AF_INET6()) 1762 addr->ipv6.sin6_addr = rec->entry[i].server.addr[j].ip.v6; 1763 else 1764 addr->ipv4.sin_addr = rec->entry[i].server.addr[j].ip.v4; 1765 1766 ++cnt; 1767 } 1728 1768 } 1729 1769 } … … 1738 1778 /* Run pending allocation */ 1739 1779 if (sess->pending_alloc) { 1740 pj_turn_session_alloc(sess, NULL); 1780 pj_status_t status; 1781 status = pj_turn_session_alloc(sess, NULL); 1782 if (status != PJ_SUCCESS) 1783 on_session_fail(sess, PJ_STUN_ALLOCATE_METHOD, status, NULL); 1741 1784 } 1742 1785 }
Note: See TracChangeset
for help on using the changeset viewer.