- 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-test/sess_auth.c
r4537 r5513 230 230 /* Instantiate standard server */ 231 231 static int create_std_server(pj_stun_auth_type auth_type, 232 pj_bool_t responding) 232 pj_bool_t responding, 233 pj_bool_t use_ipv6) 233 234 { 234 235 pj_pool_t *pool; … … 267 268 268 269 /* Create socket */ 269 status = pj_sock_socket( pj_AF_INET(), pj_SOCK_DGRAM(), 0, &server->sock);270 status = pj_sock_socket(GET_AF(use_ipv6), pj_SOCK_DGRAM(), 0, &server->sock); 270 271 if (status != PJ_SUCCESS) { 271 272 destroy_server(); … … 274 275 275 276 /* Bind */ 276 pj_sockaddr_in _init(&server->addr.ipv4, NULL, 0);277 pj_sockaddr_init(GET_AF(use_ipv6), &server->addr, NULL, 0); 277 278 status = pj_sock_bind(server->sock, &server->addr, pj_sockaddr_get_len(&server->addr)); 278 279 if (status != PJ_SUCCESS) { … … 290 291 } 291 292 292 status = pj_gethostip(pj_AF_INET(), &addr); 293 if (status != PJ_SUCCESS) { 294 destroy_server(); 295 return -45; 296 } 293 if (use_ipv6) { 294 /* pj_gethostip() may return IPv6 link-local and currently it will cause 295 * 'no route to host' error, so let's just hardcode to [::1] 296 */ 297 pj_sockaddr_init(pj_AF_INET6(), &addr, NULL, 0); 298 addr.ipv6.sin6_addr.s6_addr[15] = 1; 299 } else { 300 status = pj_gethostip(GET_AF(use_ipv6), &addr); 301 if (status != PJ_SUCCESS) { 302 destroy_server(); 303 return -45; 304 } 305 } 297 306 298 307 pj_sockaddr_copy_addr(&server->addr, &addr); … … 453 462 const char *password, 454 463 pj_bool_t dummy_mi, 455 464 pj_bool_t use_ipv6, 456 465 pj_bool_t expected_error, 457 466 pj_status_t expected_code, … … 466 475 pj_stun_tx_data *tdata; 467 476 pj_status_t status; 477 pj_sockaddr addr; 468 478 int rc = 0; 469 479 470 PJ_LOG(3,(THIS_FILE, " %s test ", title));480 PJ_LOG(3,(THIS_FILE, " %s test (%s)", title, use_ipv6?"IPv6":"IPv4")); 471 481 472 482 /* Create client */ … … 494 504 495 505 /* Create client socket */ 496 status = pj_sock_socket( pj_AF_INET(), pj_SOCK_DGRAM(), 0, &client->sock);506 status = pj_sock_socket(GET_AF(use_ipv6), pj_SOCK_DGRAM(), 0, &client->sock); 497 507 if (status != PJ_SUCCESS) { 498 508 destroy_client_server(); … … 501 511 502 512 /* Bind client socket */ 503 status = pj_sock_bind_in(client->sock, 0, 0); 513 pj_sockaddr_init(GET_AF(use_ipv6), &addr, NULL, 0); 514 status = pj_sock_bind(client->sock, &addr, pj_sockaddr_get_len(&addr)); 504 515 if (status != PJ_SUCCESS) { 505 516 destroy_client_server(); … … 529 540 530 541 /* Create the server */ 531 status = create_std_server(server_auth_type, server_responding );542 status = create_std_server(server_auth_type, server_responding, use_ipv6); 532 543 if (status != 0) { 533 544 destroy_client_server(); … … 681 692 done: 682 693 destroy_client_server(); 694 695 /* If IPv6 is enabled, test again for IPv4. */ 696 if ((rc == 0) && use_ipv6) { 697 rc = run_client_test(title, 698 server_responding, 699 server_auth_type, 700 client_auth_type, 701 realm, 702 username, 703 nonce, 704 password, 705 dummy_mi, 706 0, 707 expected_error, 708 expected_code, 709 expected_realm, 710 expected_nonce, 711 more_check); 712 } 713 683 714 return rc; 684 715 } … … 779 810 NULL, // password 780 811 PJ_FALSE, // dummy MI 812 USE_IPV6, // use IPv6 781 813 PJ_TRUE, // expected error 782 814 PJNATH_ESTUNTIMEDOUT,// expected code … … 809 841 NULL, // password 810 842 PJ_FALSE, // dummy MI 843 USE_IPV6, // use IPv6 811 844 PJ_TRUE, // expected error 812 845 PJ_STATUS_FROM_STUN_CODE(400),// expected code … … 833 866 "anotherpass", // password 834 867 PJ_FALSE, // dummy MI 868 USE_IPV6, // use IPv6 835 869 PJ_TRUE, // expected error 836 870 PJ_STATUS_FROM_STUN_CODE(401),// expected code … … 861 895 "anotherpass", // password 862 896 PJ_FALSE, // dummy MI 897 USE_IPV6, // use IPv6 863 898 PJ_TRUE, // expected error 864 899 PJ_STATUS_FROM_STUN_CODE(401),// expected code … … 883 918 NULL, // password 884 919 PJ_TRUE, // dummy MI 920 USE_IPV6, // use IPv6 885 921 PJ_TRUE, // expected error 886 922 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 903 939 PASSWORD, // password 904 940 PJ_FALSE, // dummy MI 941 USE_IPV6, // use IPv6 905 942 PJ_FALSE, // expected error 906 943 PJ_SUCCESS, // expected code … … 929 966 PASSWORD, // password 930 967 PJ_TRUE, // dummy MI 968 USE_IPV6, // use IPv6 931 969 PJ_TRUE, // expected error 932 970 PJ_STATUS_FROM_STUN_CODE(401), // expected code … … 962 1000 NULL, // client password 963 1001 PJ_FALSE, // client dummy MI 1002 USE_IPV6, // use IPv6 964 1003 PJ_TRUE, // expected error 965 1004 PJ_STATUS_FROM_STUN_CODE(401), // expected code … … 988 1027 PASSWORD, // client password 989 1028 PJ_TRUE, // client dummy MI 1029 USE_IPV6, // use IPv6 990 1030 PJ_TRUE, // expected error 991 1031 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 1008 1048 PASSWORD, // client password 1009 1049 PJ_TRUE, // client dummy MI 1050 USE_IPV6, // use IPv6 1010 1051 PJ_TRUE, // expected error 1011 1052 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 1028 1069 PASSWORD, // client password 1029 1070 PJ_TRUE, // client dummy MI 1071 USE_IPV6, // use IPv6 1030 1072 PJ_TRUE, // expected error 1031 1073 PJ_STATUS_FROM_STUN_CODE(400), // expected code … … 1064 1106 "somepassword", // client password 1065 1107 PJ_FALSE, // client dummy MI 1108 USE_IPV6, // use IPv6 1066 1109 PJ_TRUE, // expected error 1067 1110 PJ_STATUS_FROM_STUN_CODE(401), // expected code … … 1084 1127 PASSWORD, // client password 1085 1128 PJ_FALSE, // client dummy MI 1129 USE_IPV6, // use IPv6 1086 1130 PJ_FALSE, // expected error 1087 1131 0, // expected code … … 1114 1158 PASSWORD, // client password 1115 1159 PJ_FALSE, // client dummy MI 1160 USE_IPV6, // use IPv6 1116 1161 PJ_TRUE, // expected error 1117 1162 PJ_STATUS_FROM_STUN_CODE(401), // expected code
Note: See TracChangeset
for help on using the changeset viewer.