Fix check error and modify doc.

This commit is contained in:
Riza Sulistyo 2020-10-02 21:01:03 +07:00
parent 510716631e
commit af76445eb6
2 changed files with 13 additions and 10 deletions

View File

@ -157,10 +157,11 @@ enum pjmedia_transport_ice_options
/**
* The standard (rfc5245) specify that ice-mismatch attribute is used
* due to a mismatch of candidates with the default destination for media
* signaled in the SDP. However rfc8445 specify that ALGs, can alter
* signaling information in ways that break ICE and triggered ice mismatch.
* (e.g., by rewriting IP addresses in SDP). So disabling ice mismatch
* is required on some scenario.
* signaled in the SDP. The purpose is to identify some poorly ALGs that
* alter signaling information in ways that break ICE
* (e.g., by rewriting IP addresses in SDP). Specifying this option is
* to disable the ice mismatch check and allow ICE to continue
* if such scenario occur.
*/
PJMEDIA_ICE_DISABLE_ICE_MISMATCH = 2
};

View File

@ -1053,6 +1053,8 @@ static pj_status_t verify_ice_sdp(struct transport_ice *tp_ice,
*/
for (i=0; i<rem_m->attr_count; ++i) {
pj_ice_sess_cand cand;
unsigned disable_ice_mismatch = tp_ice->options &
PJMEDIA_ICE_DISABLE_ICE_MISMATCH;
if (pj_strcmp(&rem_m->attr[i]->name, &STR_CANDIDATE)!=0)
continue;
@ -1070,17 +1072,17 @@ static pj_status_t verify_ice_sdp(struct transport_ice *tp_ice,
if (!comp1_found && cand.comp_id==COMP_RTP)
{
if ((tp_ice->options & PJMEDIA_ICE_DISABLE_ICE_MISMATCH) ||
((tp_ice->options & PJMEDIA_ICE_DISABLE_ICE_MISMATCH == 0)
&& pj_sockaddr_cmp(&rem_conn_addr, &cand.addr) == 0))
if ((disable_ice_mismatch) ||
(!disable_ice_mismatch &&
pj_sockaddr_cmp(&rem_conn_addr, &cand.addr) == 0))
{
comp1_found = PJ_TRUE;
}
} else if (!comp2_found && cand.comp_id==COMP_RTCP)
{
if ((tp_ice->options & PJMEDIA_ICE_DISABLE_ICE_MISMATCH) ||
((tp_ice->options & PJMEDIA_ICE_DISABLE_ICE_MISMATCH == 0)
&& pj_sockaddr_cmp(&rtcp_addr, &cand.addr) == 0))
if ((disable_ice_mismatch) ||
(!disable_ice_mismatch &&
pj_sockaddr_cmp(&rtcp_addr, &cand.addr) == 0))
{
comp2_found = PJ_TRUE;
}