<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7538">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip: Don't seen trailing \0 on keep alive packets<br><br>This is a partial fix for ASTERISK~25817 but does not address the<br>comments regarding RFC 5626.<br><br>Change-Id: I227e2d10c0035bbfa1c6e46ae2318fd1122d8420<br>---<br>M channels/chan_sip.c<br>1 file changed, 5 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/38/7538/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/channels/chan_sip.c b/channels/chan_sip.c<br>index a6e5493..c041827 100644<br>--- a/channels/chan_sip.c<br>+++ b/channels/chan_sip.c<br>@@ -30125,6 +30125,7 @@<br> struct sip_peer *peer = (struct sip_peer*) data;<br> int res = 0;<br> const char keepalive[] = "\r\n";<br>+ size_t count = sizeof(keepalive) - 1;<br> <br> peer->keepalivesend = -1;<br> <br>@@ -30135,12 +30136,12 @@<br> <br> /* Send the packet out using the proper method for this peer */<br> if ((peer->socket.fd != -1) && (peer->socket.type == AST_TRANSPORT_UDP)) {<br>- res = ast_sendto(peer->socket.fd, keepalive, sizeof(keepalive), 0, &peer->addr);<br>+ res = ast_sendto(peer->socket.fd, keepalive, count, 0, &peer->addr);<br> } else if ((peer->socket.type & (AST_TRANSPORT_TCP | AST_TRANSPORT_TLS)) &&<br> peer->socket.tcptls_session) {<br>- res = sip_tcptls_write(peer->socket.tcptls_session, keepalive, sizeof(keepalive));<br>+ res = sip_tcptls_write(peer->socket.tcptls_session, keepalive, count);<br> } else if (peer->socket.type == AST_TRANSPORT_UDP) {<br>- res = ast_sendto(sipsock, keepalive, sizeof(keepalive), 0, &peer->addr);<br>+ res = ast_sendto(sipsock, keepalive, count, 0, &peer->addr);<br> }<br> <br> if (res == -1) {<br>@@ -30154,7 +30155,7 @@<br> }<br> }<br> <br>- if (res != sizeof(keepalive)) {<br>+ if (res != count) {<br> ast_log(LOG_WARNING, "sip_send_keepalive to %s returned %d: %s\n", ast_sockaddr_stringify(&peer->addr), res, strerror(errno));<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7538">change 7538</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7538"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I227e2d10c0035bbfa1c6e46ae2318fd1122d8420 </div>
<div style="display:none"> Gerrit-Change-Number: 7538 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>