Changeset 5387
- Timestamp:
- Jul 15, 2016 3:02:09 PM (8 years ago)
- Location:
- pjproject/trunk/pjnath/src/pjnath-test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath-test/ice_test.c
r5350 r5387 125 125 static void destroy_sess(struct test_sess *sess, unsigned wait_msec); 126 126 127 #if USE_IPV6 128 129 static pj_bool_t enable_ipv6_test() 130 { 131 pj_sockaddr addr; 132 pj_bool_t retval = PJ_TRUE; 133 if (pj_gethostip(pj_AF_INET6(), &addr) == PJ_SUCCESS) { 134 const pj_in6_addr *a = &addr.ipv6.sin6_addr; 135 if (a->s6_addr[0] == 0xFE && (a->s6_addr[1] & 0xC0) == 0x80) { 136 retval = PJ_FALSE; 137 PJ_LOG(3,(THIS_FILE, INDENT "Skipping IPv6 test due to link-local " 138 "address")); 139 } 140 } else { 141 retval = PJ_FALSE; 142 PJ_LOG(3,(THIS_FILE, INDENT "Skipping IPv6 test due to fail getting " 143 "IPv6 address")); 144 } 145 return retval; 146 } 147 148 #endif 149 127 150 static void set_stun_turn_cfg(struct ice_ept *ept, 128 151 pj_ice_strans_cfg *ice_cfg, … … 788 811 789 812 #if USE_IPV6 790 /* Test for IPV6. */ 791 if (rc == PJ_SUCCESS) { 792 pj_bzero(&test_param, sizeof(test_param)); 793 set_client_server_flag(SERVER_IPV6, CLIENT_IPV6, CLIENT_IPV6, 794 &server_flag, &caller_cfg->client_flag, 795 &callee_cfg->client_flag); 796 797 rc = perform_test2(title, stun_cfg, server_flag, caller_cfg, 798 callee_cfg, &test_param); 799 } 800 801 /* Test for IPV4+IPV6. */ 802 if (rc == PJ_SUCCESS) { 803 pj_bzero(&test_param, sizeof(test_param)); 804 set_client_server_flag(SERVER_IPV4+SERVER_IPV6, 805 CLIENT_IPV4+CLIENT_IPV6, 806 CLIENT_IPV4+CLIENT_IPV6, 807 &server_flag, 808 &caller_cfg->client_flag, 809 &callee_cfg->client_flag); 810 811 rc = perform_test2(title, stun_cfg, server_flag, caller_cfg, 812 callee_cfg, &test_param); 813 } 814 815 /* Test controller(IPV4) vs controlled(IPV6). */ 816 if (rc == PJ_SUCCESS) { 817 pj_bzero(&test_param, sizeof(test_param)); 818 set_client_server_flag(SERVER_IPV4+SERVER_IPV6, 819 CLIENT_IPV4, 820 CLIENT_IPV6, 821 &server_flag, 822 &caller_cfg->client_flag, 823 &callee_cfg->client_flag); 824 caller_cfg->expected.start_status = PJ_ENOTFOUND; 825 callee_cfg->expected.start_status = PJ_ENOTFOUND; 826 827 rc = perform_test2(title, stun_cfg, server_flag, caller_cfg, 828 callee_cfg, &test_param); 829 } 830 813 if (enable_ipv6_test()) { 814 815 /* Test for IPV6. */ 816 if (rc == PJ_SUCCESS) { 817 pj_bzero(&test_param, sizeof(test_param)); 818 set_client_server_flag(SERVER_IPV6, CLIENT_IPV6, CLIENT_IPV6, 819 &server_flag, &caller_cfg->client_flag, 820 &callee_cfg->client_flag); 821 822 rc = perform_test2(title, stun_cfg, server_flag, caller_cfg, 823 callee_cfg, &test_param); 824 } 825 826 /* Test for IPV4+IPV6. */ 827 if (rc == PJ_SUCCESS) { 828 pj_bzero(&test_param, sizeof(test_param)); 829 set_client_server_flag(SERVER_IPV4+SERVER_IPV6, 830 CLIENT_IPV4+CLIENT_IPV6, 831 CLIENT_IPV4+CLIENT_IPV6, 832 &server_flag, 833 &caller_cfg->client_flag, 834 &callee_cfg->client_flag); 835 836 rc = perform_test2(title, stun_cfg, server_flag, caller_cfg, 837 callee_cfg, &test_param); 838 } 839 840 /* Test controller(IPV4) vs controlled(IPV6). */ 841 if (rc == PJ_SUCCESS) { 842 pj_bzero(&test_param, sizeof(test_param)); 843 set_client_server_flag(SERVER_IPV4+SERVER_IPV6, 844 CLIENT_IPV4, 845 CLIENT_IPV6, 846 &server_flag, 847 &caller_cfg->client_flag, 848 &callee_cfg->client_flag); 849 caller_cfg->expected.start_status = PJ_ENOTFOUND; 850 callee_cfg->expected.start_status = PJ_ENOTFOUND; 851 852 rc = perform_test2(title, stun_cfg, server_flag, caller_cfg, 853 callee_cfg, &test_param); 854 } 855 } 831 856 #endif 832 857 callee_cfg->expected.start_status = expected_callee_start_ice; -
pjproject/trunk/pjnath/src/pjnath-test/server.c
r5350 r5387 58 58 PJ_ASSERT_RETURN(stun_cfg && domain && p_test_srv, PJ_EINVAL); 59 59 60 status = pj_gethostip(GET_AF(use_ipv6), &hostip); 61 if (status != PJ_SUCCESS) 62 return status; 60 if (use_ipv6) { 61 /* pj_gethostip() may return IPv6 link-local and will cause EINVAL 62 * error, so let's just hardcode it. 63 */ 64 pj_sockaddr_init(pj_AF_INET6(), &hostip, NULL, 0); 65 hostip.ipv6.sin6_addr.s6_addr[15] = 1; 66 } else { 67 status = pj_gethostip(GET_AF(use_ipv6), &hostip); 68 if (status != PJ_SUCCESS) 69 return status; 70 } 63 71 64 72 pool = pj_pool_create(mem, THIS_FILE, 512, 512, NULL); … … 502 510 /* Create relay socket */ 503 511 pj_sockaddr_init(GET_AF(use_ipv6), &alloc->alloc_addr, NULL, 0); 504 pj_gethostip(GET_AF(use_ipv6), &alloc->alloc_addr); 512 if (use_ipv6) { 513 /* pj_gethostip() may return IPv6 link-local and will cause EINVAL 514 * error, so let's just hardcode it. 515 */ 516 pj_sockaddr_init(pj_AF_INET6(), &alloc->alloc_addr, NULL, 0); 517 alloc->alloc_addr.ipv6.sin6_addr.s6_addr[15] = 1; 518 } else { 519 status = pj_gethostip(GET_AF(use_ipv6), &alloc->alloc_addr); 520 if (status != PJ_SUCCESS) { 521 pj_pool_release(alloc->pool); 522 pj_stun_msg_create_response(pool, req, PJ_STUN_SC_SERVER_ERROR, 523 NULL, &resp); 524 goto send_pkt; 525 } 526 } 505 527 506 528 status = pj_activesock_create_udp(alloc->pool, &alloc->alloc_addr, NULL,
Note: See TracChangeset
for help on using the changeset viewer.