<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/26612">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix gscon clear 1/n: store clear cause in gscon<br><br>Allow returning a context sensitive cause instead of a hardcoded one in<br>gscon pre_term().<br><br>Also, the conn->cause is needed to move message dispatch to an "onenter"<br>function in patch I234b2a754d0c98031056981823cdbc187e977741. I Split<br>this part off as a separate patch for better readability.<br><br>Related: OS#5337<br>Change-Id: Ib6432746040899129d1d73ae8dc59add2d88a915<br>---<br>M include/osmocom/bsc/gsm_data.h<br>M src/osmo-bsc/bsc_subscr_conn_fsm.c<br>2 files changed, 7 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/12/26612/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h</span><br><span>index 238b2f7..4e26ec1 100644</span><br><span>--- a/include/osmocom/bsc/gsm_data.h</span><br><span>+++ b/include/osmocom/bsc/gsm_data.h</span><br><span>@@ -404,6 +404,8 @@</span><br><span>                 bool last_eutran_plmn_valid; /* Is information stored in field below available? */</span><br><span>           struct osmo_plmn_id last_eutran_plmn;</span><br><span>        } fast_return;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      enum gsm0808_cause clear_cause;</span><br><span> };</span><br><span> </span><br><span> </span><br><span>diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c</span><br><span>index 2140c9b..ff742a2 100644</span><br><span>--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c</span><br><span>+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c</span><br><span>@@ -144,6 +144,7 @@</span><br><span> </span><br><span>         struct msgb *resp;</span><br><span>   int rc;</span><br><span style="color: hsl(120, 100%, 40%);">+       conn->clear_cause = cause;</span><br><span> </span><br><span>    if (conn->rx_clear_command) {</span><br><span>             LOGPFSML(conn->fi, LOGL_DEBUG, "Not sending BSSMAP CLEAR REQUEST, already got CLEAR COMMAND from MSC\n");</span><br><span>@@ -976,9 +977,7 @@</span><br><span>         }</span><br><span> </span><br><span>        LOGPFSML(fi, LOGL_DEBUG, "Releasing all lchans (if any) because this conn is terminating\n");</span><br><span style="color: hsl(0, 100%, 40%);">- /* when things go smoothly, the lchan should have been released before FSM instance termination. So if this is</span><br><span style="color: hsl(0, 100%, 40%);">-   * necessary it's probably "abnormal". */</span><br><span style="color: hsl(0, 100%, 40%);">- gscon_release_lchans(conn, true, GSM48_RR_CAUSE_ABNORMAL_UNSPEC);</span><br><span style="color: hsl(120, 100%, 40%);">+     gscon_release_lchans(conn, true, bsc_gsm48_rr_cause_from_gsm0808_cause(conn->clear_cause));</span><br><span> </span><br><span>   /* drop pending messages */</span><br><span>  gscon_dtap_queue_flush(conn, 0);</span><br><span>@@ -1057,6 +1056,9 @@</span><br><span>     INIT_LLIST_HEAD(&conn->hodec2.penalty_timers);</span><br><span>        conn->sccp.conn_id = -1;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+       /* Default clear cause (on RR translates to GSM48_RR_CAUSE_ABNORMAL_UNSPEC) */</span><br><span style="color: hsl(120, 100%, 40%);">+        conn->clear_cause = GSM0808_CAUSE_EQUIPMENT_FAILURE;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>    /* don't allocate from 'conn' context, as gscon_cleanup() will call talloc_free(conn) before</span><br><span>      * libosmocore will call talloc_free(conn->fi), i.e. avoid use-after-free during cleanup */</span><br><span>       conn->fi = osmo_fsm_inst_alloc(&gscon_fsm, net, conn, LOGL_DEBUG, NULL);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/26612">change 26612</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/osmo-bsc/+/26612"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib6432746040899129d1d73ae8dc59add2d88a915 </div>
<div style="display:none"> Gerrit-Change-Number: 26612 </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>