]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjproject: Fix DTLS client check failing on some platforms
authorAlbrecht Oster <albrecht@oster.online>
Thu, 10 Apr 2025 21:54:00 +0000 (23:54 +0200)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Mon, 21 Apr 2025 14:46:02 +0000 (14:46 +0000)
commita9cd7f9b8dd00a9f67f73b40a56aca953ff5fefe
tree67d13a10b5ccf53a5f7d763abaeb0950490ff310
parentf302c116b4a812a84c30c320dfa4db35de6f9f29
res_pjproject: Fix DTLS client check failing on some platforms

Certain platforms (mainly BSD derivatives) have an additional length
field in `sockaddr_in6` and `sockaddr_in`.
`ast_sockaddr_from_pj_sockaddr()` does not take this field into account
when copying over values from the `pj_sockaddr` into the `ast_sockaddr`.
The resulting `ast_sockaddr` will have an uninitialized value for
`sin6_len`/`sin_len` while the other `ast_sockaddr` (not converted from
a `pj_sockaddr`) to check against in `ast_sockaddr_pj_sockaddr_cmp()`
has the correct length value set.

This has the effect that `ast_sockaddr_cmp()` will always indicate
an address mismatch, because it does a bitwise comparison, and all DTLS
packets are dropped even if addresses and ports match.

`ast_sockaddr_from_pj_sockaddr()` now checks whether the length fields
are available on the current platform and sets the values accordingly.

Resolves: #505
configure
configure.ac
include/asterisk/autoconfig.h.in
res/res_pjproject.c