<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/15339">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix: vty crash by logging during VTY_CLOSED event handling<br><br>When a VTY closes, dispatch the VTY_CLOSED signal before tearing down the VTY<br>buffer and fd.<br><br>In particular this fixes:<br><br>- a crash during telnet_close_client(), invoked by the VTY_CLOSED event, which<br>  logs to DLGLOBAL and uses vty->obuf that, so far, vty_close() had already<br>  unallocated earlier (OS#4164).<br><br>- the logging about closing a telnet session so far logged:<br>    DLGLOBAL INFO Closing telnet connection r=NULL<->l=NULL<br>  By dispatching the VTY_CLOSED event while the fd is still valid, we instead<br>  get the actual connection IP address and port being closed:<br>    DLGLOBAL INFO Closing telnet connection r=127.0.0.1:36708<->l=127.0.0.1:4258<br><br>Related: OS#4164<br>Change-Id: I1d235cbfbfb9aaf411316642c7bcfac12106df44<br>---<br>M src/vty/vty.c<br>1 file changed, 3 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/39/15339/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/vty/vty.c b/src/vty/vty.c</span><br><span>index a96d86c..aa23fa0 100644</span><br><span>--- a/src/vty/vty.c</span><br><span>+++ b/src/vty/vty.c</span><br><span>@@ -205,6 +205,9 @@</span><br><span> {</span><br><span>     int i;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+    /* VTY_CLOSED is handled by the telnet_interface */</span><br><span style="color: hsl(120, 100%, 40%);">+   vty_event(VTY_CLOSED, vty->fd, vty);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>    if (vty->obuf)  {</span><br><span>                 /* Flush buffer. */</span><br><span>          buffer_flush_all(vty->obuf, vty->fd);</span><br><span>@@ -236,9 +239,6 @@</span><br><span>    /* Check configure. */</span><br><span>       vty_config_unlock(vty);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     /* VTY_CLOSED is handled by the telnet_interface */</span><br><span style="color: hsl(0, 100%, 40%);">-     vty_event(VTY_CLOSED, vty->fd, vty);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>      /* OK free vty. */</span><br><span>   talloc_free(vty);</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/15339">change 15339</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/c/libosmocore/+/15339"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I1d235cbfbfb9aaf411316642c7bcfac12106df44 </div>
<div style="display:none"> Gerrit-Change-Number: 15339 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>