[asterisk-dev] [Code Review] 2783: Fix SIP/TLS reading - random connection drop

Tzafrir Cohen reviewboard at asterisk.org
Wed Aug 21 15:22:56 CDT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2783/
-----------------------------------------------------------

Review request for Asterisk Developers.


Bugs: ASTERISK-18345
    https://issues.asterisk.org/jira/browse/ASTERISK-18345


Repository: Asterisk


Description
-------

Symptom: Asterisk drops a SIP/TLS connection: debugging reports that it has failed to read it.

I can reproduce this on my system when the TLS client is Asterisk 11.5 (installed from the Debian package) set with 'allow=all' to get a long list of codecs.

Calling ast_wait_for_input before every fgets is not sufficient.
Function fgets internally calls read (=> SSL_read) until either "\n" or
eof is found. And because the socket is polled only before the first
SSL_read call, consequent calls can fail and return <=0 even though the
data are on the way.
    
This is fixed by adding a read() loop inside the ssl_read() hook.

I came accross this patch today and it looks like it fixes my problem (see my comment at the end). The patch I used is by Filip Jenicek. See the bug report for the full log.


Diffs
-----

  /trunk/main/tcptls.c 397346 

Diff: https://reviewboard.asterisk.org/r/2783/diff/


Testing
-------

Work on trunk.


Thanks,

Tzafrir Cohen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130821/c95acb92/attachment.htm>


More information about the asterisk-dev mailing list