<h3>Description</h3>
<p>I bind a wss port on kamailio for connecting to WebRTC clients,<br>
when I received a TLS packet on wss port,<br>
it will reply a HTML window to browser who sent the packet ,<br>
as defined in kamailio.cfg:</p>
<blockquote>
<p># xhttp event route<br>
event_route[xhttp:request] {<br>
...</p>
<pre><code> If(wss port receives a packet)
{
xhttp_reply("200", "OK", "text/html","<html><head><meta http-equiv=\"refresh\" content=\"0;url=$shv(URLToBeOpened)\"></head></html>");
}
</code></pre>
<p>...<br>
}</p>
</blockquote>
<p>However , sometimes the HTML window appears stuck in a connecting state,<br>
it may be connected or timeout finally.</p>
<p>Above problem happens on ARMv4 , but works smoothly on AArch64.<br>
I put some related information in Troubleshooting block,<br>
hope these may help to figure out why this happens.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>Access to https://(IP address of kamailio):(wss port),<br>
and stuck in loading page.</p>
<p>[ARMv4]</p>
<p>config.mak:</p>
<p>CC=/opt/toolchains/sdk51/gcc/bin/arm-marvell-linux-gnueabi-gcc make cfg include_modules="db_sqlite tls websocket" mode=debug ARCH=armv41 CPUTYPE=cortex-a8 LOCALBASE=/mnt/test/kamailio/</p>
<p>[AArch64]</p>
<p>config.mak:</p>
<p>CC=/opt/toolchains/aarch64-thunderx/bin/aarch64-thunderx-linux-gnu-gcc make cfg include_modules="db_sqlite tls websocket" mode=debug ARCH=aarch64 CPUTYPE=ARMv8 LOCALBASE=/mnt/test/kamailio/</p>
<h4>Debugging Data</h4>
<p><strong>Note: Not the same time as Log Messsages and SIP Traffic</strong></p>
<p>[ARMv4]<br>
# netstat -apn | grep 10443<br>
tcp 0 0 10.100.92.52:10443 0.0.0.0:* LISTEN 32418/kamailio<br>
tcp 518 0 10.100.92.52:10443 10.100.92.29:54693 CLOSE_WAIT 32417/kamailio</p>
<p>Recv-Q on wss port seems stuck here...</p>
<p>[AArch64]<br>
# netstat -apn | grep 10443<br>
tcp 0 0 10.100.92.222:10443 0.0.0.0:* LISTEN 9799/kamailio<br>
tcp 0 0 10.100.92.222:10443 10.100.92.29:54817 TIME_WAIT -<br>
tcp 0 0 10.100.92.222:10443 10.100.92.29:54818 TIME_WAIT -<br>
tcp 0 0 10.100.92.222:10443 10.100.92.29:54820 ESTABLISHED 9798/kamailio</p>
<h4>Log Messages</h4>
<p>WSS port used here is 10443,<br>
10.100.92.29 is my PC which uses a WebRTC client to connect to kamailio,<br>
10.100.92.222 is kamailio on AAch64,<br>
10.100.92.52 is kamailio on ARMv4.</p>
<p>[ARMv4] (which stuck in connecting to <a href="https://10.100.92.222:10443" rel="nofollow">https://10.100.92.222:10443</a> )<br>
(no related log was output...)</p>
<p>whole log here:<br>
<a href="https://github.com/kamailio/kamailio/files/3106496/WSS_TLS_FAIL_10.100.92.52.txt">WSS_TLS_FAIL_10.100.92.52.txt</a></p>
<p>[AArch64]<br>
...<br>
DEBUG: tls [tls_locking.c:110]: locking_f(): lock get (9): 2 (ex_data.c:318)<br>
DEBUG: tls [tls_locking.c:116]: locking_f(): lock release (10): 2 (ex_data.c:338)<br>
DEBUG: tls [tls_locking.c:110]: locking_f(): lock get (5): 2 (ex_data.c:507)<br>
DEBUG: tls [tls_locking.c:116]: locking_f(): lock release (6): 2 (ex_data.c:517)<br>
DEBUG: tls [tls_domain.c:736]: sr_ssl_ctx_info_callback(): SSL handshake done<br>
DEBUG: tls [tls_domain.c:740]: sr_ssl_ctx_info_callback(): SSL disable renegotiation<br>
DEBUG: tls [tls_server.c:415]: tls_accept(): TLS accept successful<br>
EBUG: tls [tls_server.c:422]: tls_accept(): tls_accept: new connection from 10.100.92.29:53189 using TLSv1/SSLv3 AES256-SHA 256<br>
DEBUG: tls [tls_server.c:425]: tls_accept(): tls_accept: local socket: 10.100.92.222:10443<br>
DEBUG: tls [tls_server.c:436]: tls_accept(): tls_accept: client did not present a certificate<br>
DEBUG: [core/tcp_read.c:1492]: tcp_read_req(): read= 0 bytes, parsed=0, state=0, error=1<br>
DEBUG: [core/tcp_read.c:1495]: tcp_read_req(): last char=0x00, parsed msg=<br>
...</p>
<p>whole log here:<br>
<a href="https://github.com/kamailio/kamailio/files/3106497/WSS_TLS_OK_10.100.92.222.txt">WSS_TLS_OK_10.100.92.222.txt</a></p>
<h4>SIP Traffic</h4>
<p>TLS packets captured image</p>
<p>[ARMv4]<br>
<a href="https://imgur.com/jgnTaLy" rel="nofollow">https://imgur.com/jgnTaLy</a></p>
<p>[AArch64]<br>
<a href="https://imgur.com/pfpWSXB" rel="nofollow">https://imgur.com/pfpWSXB</a></p>
<h3>Possible Solutions</h3>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<p>[ARMv4]</p>
<p>/mnt/test/kamailio/sbin# ./kamailio -v<br>
version: MyLogo , 5.2.2 (armv41/linux) a82930-dirty<br>
flags: STATS: Off, EXTRA_DEBUG, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, USE_PTHREAD_MUTEX, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES<br>
MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
id: a82930 -dirty<br>
compiled on 15:20:56 Apr 22 2019 with /opt/toolchains/sdk51/gcc/bin/arm-marvell-linux-gnueabi-gcc 4.6.2</p>
<p>[AArch64]</p>
<p>/mnt/test/kamailio/sbin# ./kamailio -v<br>
version: MyLogo , 5.2.0-dev3 (aarch64/linux)<br>
flags: STATS: Off, EXTRA_DEBUG, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT-NOSMP, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES<br>
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
id: unknown<br>
compiled on 15:47:47 Feb 6 2018 with /opt/toolchains/aarch64-thunderx/bin/aarch64-thunderx-linux-gnu-gcc 5.3.0</p>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<p>[ARMv4]<br>
Linux Test 3.2.36-1.00 <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="303753635" data-permission-text="Issue title is private" data-url="https://github.com/kamailio/kamailio/issues/1479" data-hovercard-type="issue" data-hovercard-url="/kamailio/kamailio/issues/1479/hovercard" href="https://github.com/kamailio/kamailio/issues/1479">#1479</a> SMP Mon Apr 15 10:21:28 CST 2019 armv7l GNU/Linux</p>
<p>[AArch64]<br>
Linux Test 4.4.13 <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="31891578" data-permission-text="Issue title is private" data-url="https://github.com/kamailio/kamailio/issues/1" data-hovercard-type="issue" data-hovercard-url="/kamailio/kamailio/issues/1/hovercard" href="https://github.com/kamailio/kamailio/issues/1">#1</a> SMP PREEMPT Fri Mar 24 10:50:44 CST 2017 aarch64 GNU/Linux</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1933">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZK2Y6XC2BG6QOVAJETPR3ACHANCNFSM4HHVSUPQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZKIGCUA4ZT7BA7U7VTPR3ACHANCNFSM4HHVSUPQ.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"[5.2.2] sometimes wss doesn't work with received TLS packet in specific condition (#1933)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1933"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1933",
"url": "https://github.com/kamailio/kamailio/issues/1933",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>