res_rtp_asterisk: Fix regression issues with DTLS client check

* Since ICE candidates are used for the check and pjproject is
  required to use ICE, res_rtp_asterisk was failing to compile
  when pjproject wasn't available.  The check is now wrapped
  with an #ifdef HAVE_PJPROJECT.

* The rtp->ice_active_remote_candidates container was being
  used to check the address on incoming packets but that
  container doesn't contain peer reflexive candidates discovered
  during negotiation. This was causing the check to fail
  where it shouldn't.  We now check against pjproject's
  real_ice->rcand array which will contain those candidates.

* Also fixed a bug in ast_sockaddr_from_pj_sockaddr() where
  we weren't zeroing out sin->sin_zero before returning.  This
  was causing ast_sockaddr_cmp() to always return false when
  one of the inputs was converted from a pj_sockaddr, even
  if both inputs had the same address and port.

Resolves: #500
Resolves: #503
Resolves: #505
This commit is contained in:
George Joseph
2023-12-15 09:37:54 -07:00
parent beba569755
commit a49bb17dbb
3 changed files with 45 additions and 12 deletions

View File

@@ -115,4 +115,17 @@ int ast_sockaddr_to_pj_sockaddr(const struct ast_sockaddr *addr, pj_sockaddr *pj
*/
int ast_sockaddr_from_pj_sockaddr(struct ast_sockaddr *addr, const pj_sockaddr *pjaddr);
/*!
* \brief Compare an ast_sockaddr to a pj_sockaddr
*
* \param addr pointer to ast_sockaddr structure
* \param pjaddr pointer to pj_sockaddr structure
*
* \retval -1 \a addr is lexicographically smaller than \a pjaddr
* \retval 0 \a addr is equal to \a pjaddr
* \retval 1 \a pjaddr is lexicographically smaller than \a addr
*/
int ast_sockaddr_pj_sockaddr_cmp(const struct ast_sockaddr *addr,
const pj_sockaddr *pjaddr);
#endif /* _RES_PJPROJECT_H */