diff --git a/contrib/src/pjproject/0001-rfc6544.patch b/contrib/src/pjproject/0001-rfc6544.patch index 44e10b20e2b0156104c98f39035cadf2bcfb395f..1201d1aad1f119766f4ded7dea504a68307c7fba 100644 --- a/contrib/src/pjproject/0001-rfc6544.patch +++ b/contrib/src/pjproject/0001-rfc6544.patch @@ -29,10 +29,10 @@ on behalf of Savoir-faire Linux. pjnath/src/pjnath-test/concur_test.c | 5 +- pjnath/src/pjnath-test/sess_auth.c | 14 +- pjnath/src/pjnath-test/stun_sock_test.c | 7 +- - pjnath/src/pjnath/ice_session.c | 573 ++++++++++-- + pjnath/src/pjnath/ice_session.c | 597 +++++++++++-- pjnath/src/pjnath/ice_strans.c | 743 +++++++++++++--- pjnath/src/pjnath/nat_detect.c | 7 +- - pjnath/src/pjnath/stun_session.c | 15 +- + pjnath/src/pjnath/stun_session.c | 19 +- pjnath/src/pjnath/stun_sock.c | 1081 +++++++++++++++++++---- pjnath/src/pjnath/stun_transaction.c | 3 + pjnath/src/pjnath/turn_session.c | 3 +- @@ -42,7 +42,7 @@ on behalf of Savoir-faire Linux. pjnath/src/pjturn-srv/server.c | 2 +- pjsip-apps/src/samples/icedemo.c | 116 ++- pjsip/src/pjsua-lib/pjsua_core.c | 2 +- - 22 files changed, 2523 insertions(+), 418 deletions(-) + 22 files changed, 2547 insertions(+), 422 deletions(-) diff --git a/pjnath/include/pjnath/config.h b/pjnath/include/pjnath/config.h index fc1e27550..9b44c2645 100644 @@ -683,7 +683,7 @@ index fff4fad26..e7f8b84eb 100644 if (status != PJ_SUCCESS && status != PJ_EPENDING) { app_perror(" error: server sending data", status); diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c -index 2a4125bc5..ba10d42ed 100644 +index 2a4125bc5..b10a8fb51 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -18,6 +18,7 @@ @@ -1146,9 +1146,10 @@ index 2a4125bc5..ba10d42ed 100644 + status); + } else { check->tdata = NULL; - pjnath_perror(ice->obj_name, "Error sending STUN request", status); +- pjnath_perror(ice->obj_name, "Error sending STUN request", status); - pj_log_pop_indent(); - return status; ++ pjnath_perror(ice->obj_name, "Error sending STUN request (perform check)", status); } - - check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_IN_PROGRESS, @@ -1288,7 +1289,7 @@ index 2a4125bc5..ba10d42ed 100644 } pj_grp_lock_release(ice->grp_lock); -@@ -2181,6 +2449,187 @@ static pj_status_t on_stun_send_msg(pj_stun_session *sess, +@@ -2181,6 +2449,205 @@ static pj_status_t on_stun_send_msg(pj_stun_session *sess, return status; } @@ -1345,8 +1346,8 @@ index 2a4125bc5..ba10d42ed 100644 + + const pj_ice_sess_cand *rcand = check->rcand; + if (rcand->type == PJ_ICE_CAND_TYPE_RELAYED && ( -+ status == PJ_ERRNO_START_STATUS + 104 || status == 130054 /* CONNECTION RESET BY PEER */ || -+ status == PJ_ERRNO_START_STATUS + 111 /* Connection refused */ ++ status == PJ_ERRNO_START_SYS + 104 || status == 130054 /* CONNECTION RESET BY PEER */ || ++ status == PJ_ERRNO_START_SYS + 111 /* Connection refused */ + )) { + /** + * This part of the code is triggered when using ICE over TCP via TURN @@ -1362,6 +1363,12 @@ index 2a4125bc5..ba10d42ed 100644 + status); + return; + } else if (status != PJ_SUCCESS) { ++ if (rcand->type == PJ_ICE_CAND_TYPE_RELAYED) { ++ char raddr[PJ_INET6_ADDRSTRLEN + 10]; ++ PJ_LOG(4, (ice->obj_name, ++ "Connection to TURN (%s) failed with status %u", ++ pj_sockaddr_print(&rcand->addr, raddr, sizeof(raddr), 3), status)); ++ } + check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED, status); + on_check_complete(ice, check); + return; @@ -1394,9 +1401,9 @@ index 2a4125bc5..ba10d42ed 100644 + check->tdata); + + if (rcand->type == PJ_ICE_CAND_TYPE_RELAYED && ( -+ status == PJ_ERRNO_START_STATUS + 104 || status == 130054 || /* CONNECTION RESET BY PEER */ -+ status == PJ_ERRNO_START_STATUS + 32 /* EPIPE */ || -+ status == PJ_ERRNO_START_STATUS + 111 /* Connection refused */ ++ status == PJ_ERRNO_START_SYS + 104 || status == 130054 || /* CONNECTION RESET BY PEER */ ++ status == PJ_ERRNO_START_SYS + 32 /* EPIPE */ || ++ status == PJ_ERRNO_START_SYS + 111 /* Connection refused */ + )) { + /** + * This part of the code is triggered when using ICE over TCP via TURN @@ -1413,8 +1420,15 @@ index 2a4125bc5..ba10d42ed 100644 + check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_NEEDS_FIRST_PACKET, + status_send_msg); + } else if (status_send_msg != PJ_SUCCESS) { ++ ++ if (rcand->type == PJ_ICE_CAND_TYPE_RELAYED) { ++ char raddr[PJ_INET6_ADDRSTRLEN + 10]; ++ PJ_LOG(5, (ice->obj_name, ++ "STUN send message to TURN (%s) failed with status %u", ++ pj_sockaddr_print(&rcand->addr, raddr, sizeof(raddr), 3), status)); ++ } + check->tdata = NULL; -+ pjnath_perror(ice->obj_name, "Error sending STUN request", status_send_msg); ++ pjnath_perror(ice->obj_name, "Error sending STUN request (on peer connection)", status_send_msg); + pj_log_pop_indent(); + check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED, status); + on_check_complete(ice, check); @@ -1427,7 +1441,7 @@ index 2a4125bc5..ba10d42ed 100644 + pj_uint8_t transport_id, + pj_sockaddr_t* remote_addr) +{ -+ // The TCP link is reseted ++ // The TCP link is reset + if (!remote_addr) + return; + @@ -1445,6 +1459,11 @@ index 2a4125bc5..ba10d42ed 100644 + + const pj_ice_sess_cand *rcand = check->rcand; + if (rcand->type == PJ_ICE_CAND_TYPE_RELAYED) { ++ char raddr[PJ_INET6_ADDRSTRLEN + 10]; ++ PJ_LOG(5, (ice->obj_name, ++ "Connection to TURN (%s) is reset", ++ pj_sockaddr_print(&rcand->addr, raddr, sizeof(raddr), 3))); ++ + check->state = PJ_ICE_SESS_CHECK_STATE_NEEDS_RETRY; + check_set_state(ice, check, + PJ_ICE_SESS_CHECK_STATE_NEEDS_RETRY, 120104); @@ -1476,7 +1495,7 @@ index 2a4125bc5..ba10d42ed 100644 /* This callback is called when outgoing STUN request completed */ static void on_stun_request_complete(pj_stun_session *stun_sess, -@@ -2411,7 +2860,9 @@ static void on_stun_request_complete(pj_stun_session *stun_sess, +@@ -2411,7 +2878,9 @@ static void on_stun_request_complete(pj_stun_session *stun_sess, &check->lcand->base_addr, &check->lcand->base_addr, pj_sockaddr_get_len(&xaddr->sockaddr), @@ -1487,7 +1506,7 @@ index 2a4125bc5..ba10d42ed 100644 if (status != PJ_SUCCESS) { check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED, status); -@@ -2474,11 +2925,7 @@ static void on_stun_request_complete(pj_stun_session *stun_sess, +@@ -2474,11 +2943,7 @@ static void on_stun_request_complete(pj_stun_session *stun_sess, /* Perform 7.1.2.2.2. Updating Pair States. * This may terminate ICE processing. */ @@ -1500,7 +1519,7 @@ index 2a4125bc5..ba10d42ed 100644 pj_grp_lock_release(ice->grp_lock); } -@@ -2673,7 +3120,9 @@ static pj_status_t on_stun_rx_request(pj_stun_session *sess, +@@ -2673,9 +3138,13 @@ static pj_status_t on_stun_rx_request(pj_stun_session *sess, msg_data->has_req_data = PJ_FALSE; /* Send the response */ @@ -1509,9 +1528,14 @@ index 2a4125bc5..ba10d42ed 100644 + pj_stun_session_tp_type(sess) == + PJ_STUN_TP_UDP, src_addr, src_addr_len, tdata); +- ++ if (status == PJ_EBUSY) { ++ PJ_LOG(5, (ice->obj_name, "on_stun_rx_request, PJ_EBUSY")); ++ } - -@@ -2794,12 +3243,12 @@ static void handle_incoming_check(pj_ice_sess *ice, + /* + * Handling early check. +@@ -2794,12 +3263,12 @@ static void handle_incoming_check(pj_ice_sess *ice, /* Just get candidate with the highest priority and same transport ID * for the specified component ID in the checklist. */ @@ -2636,7 +2660,7 @@ index db0de10bc..808342bec 100644 sess->result[test_id].tdata); if (status != PJ_SUCCESS) diff --git a/pjnath/src/pjnath/stun_session.c b/pjnath/src/pjnath/stun_session.c -index f2b4f7058..ed17b904f 100644 +index f2b4f7058..20a9b1320 100644 --- a/pjnath/src/pjnath/stun_session.c +++ b/pjnath/src/pjnath/stun_session.c @@ -49,6 +49,8 @@ struct pj_stun_session @@ -2666,6 +2690,24 @@ index f2b4f7058..ed17b904f 100644 if (grp_lock) { sess->grp_lock = grp_lock; +@@ -1010,7 +1014,7 @@ PJ_DEF(pj_status_t) pj_stun_session_send_msg( pj_stun_session *sess, + (unsigned)tdata->pkt_size); + if (status != PJ_SUCCESS && status != PJ_EPENDING) { + pj_stun_msg_destroy_tdata(sess, tdata); +- LOG_ERR_(sess, "Error sending STUN request", status); ++ LOG_ERR_(sess, "Error sending STUN request (pj_stun_client_tsx_send_msg)", status); + goto on_return; + } + +@@ -1067,7 +1071,7 @@ PJ_DEF(pj_status_t) pj_stun_session_send_msg( pj_stun_session *sess, + + if (status != PJ_SUCCESS && status != PJ_EPENDING) { + pj_stun_msg_destroy_tdata(sess, tdata); +- LOG_ERR_(sess, "Error sending STUN request", status); ++ LOG_ERR_(sess, "Error sending STUN request (pj_stun_session_send_msg)", status); + goto on_return; + } + @@ -1538,3 +1542,12 @@ on_return: return status; } @@ -4284,5 +4326,4 @@ index 474a8d07c..9257f07a4 100644 if (status != PJ_SUCCESS) { char errmsg[PJ_ERR_MSG_SIZE]; -- -2.29.2 - +2.29.2 \ No newline at end of file