Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logical error in rtp engine check in dtls flow #2456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SouradeepBera
Copy link

For an inbound call leg requiring SRTP over DTLS, switch_channel_answer does not return. It gets stuck in an infinite do-while loop in switch_core_media_check_dtls()
do { if (engine->rtp_session) checking = check_engine(engine); } while (switch_channel_ready(session->channel) && checking);
The check_engine() function should return 0 on success to break the loop. However. in the second half of the function it flips the logic and returns 0 if it is not acceptable and 1 otherwise, resulting in the infinite loop

@signalwire-ci
Copy link

signalwire-ci bot commented May 6, 2024

@ChrisZhangJin
Copy link

Hi, we experienced the same issue now!! Are you sure the change you made can solve this issue?? I saw your pr was not accepted. @SouradeepBera

For an inbound call leg requiring SRTP over DTLS, switch_channel_answer does not return. It gets stuck in an infinite do-while loop in switch_core_media_check_dtls() do { if (engine->rtp_session) checking = check_engine(engine); } while (switch_channel_ready(session->channel) && checking); The check_engine() function should return 0 on success to break the loop. However. in the second half of the function it flips the logic and returns 0 if it is not acceptable and 1 otherwise, resulting in the infinite loop

@SouradeepBera
Copy link
Author

Seems to work for us @ChrisZhangJin

@SouradeepBera
Copy link
Author

@andywolk can you please review this fix?

@ChrisZhangJin
Copy link

HI team, in my case, I found the issue was there, as you can see the image i captured from the source code. our sip trunk (over dtls) remote side didn't send the session ticket to complete the handshake, so that the code was looping this dtls_state_handshake all the time.
after adding some simple logs to print the result of SSL_get_error, I found all the ret code from that was SSL_ERROR_WAIT_READ, which matched what i thought that the remote server didn't reponse the session ticket to me.
Accordingly, the result of SSL_is_init_finished always is 0
image

here is the captured pcap file
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants