<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmo-abis/+/21282">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ipaccess: Fix wrong assertion in ipaccess_drop() when used by BTS code<br><br>The code wrongly assumed that ipaccess_drop was only called by BSC code,<br>which is wrong. ipaccess_drop is called by BTS run code path in __handle_ts1_write(),<br>if send() syscall fails (for instance because BSC becomes unreachable).<br>In that case, we need to account for the BTS role case which doesn't<br>store the line pointer into the ofd->data. In BTS case, it's a pointer<br>to the struct ipa_client_conn, which we leave up to sign_link_down() cb<br>to do whatever they please with.<br><br>Fixes: OS#4864<br>Change-Id: If763e5f7736921a4360ad9027ba075ef8e118934<br>---<br>M src/input/ipaccess.c<br>1 file changed, 17 insertions(+), 7 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/82/21282/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c</span><br><span>index 48a427c..1036e51 100644</span><br><span>--- a/src/input/ipaccess.c</span><br><span>+++ b/src/input/ipaccess.c</span><br><span>@@ -92,13 +92,23 @@</span><br><span>           osmo_fd_unregister(bfd);</span><br><span>             close(bfd->fd);</span><br><span>           bfd->fd = -1;</span><br><span style="color: hsl(0, 100%, 40%);">-                /* This is BSC code, ipaccess_drop() is only called for</span><br><span style="color: hsl(0, 100%, 40%);">-            accepted() sockets, hence the bfd holds a reference to</span><br><span style="color: hsl(0, 100%, 40%);">-                  e1inp_line in ->data that needs to be released */</span><br><span style="color: hsl(0, 100%, 40%);">-         OSMO_ASSERT(bfd->data == line);</span><br><span style="color: hsl(0, 100%, 40%);">-              bfd->data = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-            e1inp_line_put2(line, "ipa_bfd");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+           switch(line->ops->cfg.ipa.role) {</span><br><span style="color: hsl(120, 100%, 40%);">+               case E1INP_LINE_R_BSC:</span><br><span style="color: hsl(120, 100%, 40%);">+                        /* This is BSC code, ipaccess_drop() is only called for</span><br><span style="color: hsl(120, 100%, 40%);">+                          accepted() sockets, hence the bfd holds a reference to</span><br><span style="color: hsl(120, 100%, 40%);">+                        e1inp_line in ->data that needs to be released */</span><br><span style="color: hsl(120, 100%, 40%);">+                       OSMO_ASSERT(bfd->data == line);</span><br><span style="color: hsl(120, 100%, 40%);">+                    bfd->data = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+                  e1inp_line_put2(line, "ipa_bfd");</span><br><span style="color: hsl(120, 100%, 40%);">+                   break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case E1INP_LINE_R_BTS:</span><br><span style="color: hsl(120, 100%, 40%);">+                        /* BTS code: bfd->data contains pointer to struct</span><br><span style="color: hsl(120, 100%, 40%);">+                   * ipa_client_conn. Leave it alive so it reconnects.</span><br><span style="color: hsl(120, 100%, 40%);">+                   */</span><br><span style="color: hsl(120, 100%, 40%);">+                   break;</span><br><span style="color: hsl(120, 100%, 40%);">+                default:</span><br><span style="color: hsl(120, 100%, 40%);">+                      break;</span><br><span style="color: hsl(120, 100%, 40%);">+                }</span><br><span>            ret = -ENOENT;</span><br><span>       } else {</span><br><span>             LOGPITS(e1i_ts, DLINP, LOGL_ERROR,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmo-abis/+/21282">change 21282</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/libosmo-abis/+/21282"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmo-abis </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If763e5f7736921a4360ad9027ba075ef8e118934 </div>
<div style="display:none"> Gerrit-Change-Number: 21282 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>