<p>fixeria <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-msc/+/22747">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix _gsm48_cc_trans_free(): send MNCC REL.ind on Clear Request<br><br>Calling gsm48_cc_tx_release() before mncc_release_ind() has a side<br>effect: the former may change CC state to GSM_CSTATE_RELEASE_REQ.<br>This makes the later send MNCC_REL_CNF instead of MNCC_REL_IND, so<br>if one of the call leg disconnects due to RF failure, the other one<br>will not be terminated correctly.<br><br>Makes both TC_{mo,mt}_call_clear_request TTCN-3 test cases pass.<br><br>Change-Id: I3ad4a99757878de3796027325627c87d9a4e93f1<br>Related: Id16969fe0de04445d1320a96d35cf1d48cc8cf09<br>Related: SYS#5340<br>---<br>M src/libmsc/gsm_04_08_cc.c<br>M tests/msc_vlr/msc_vlr_test_call.c<br>M tests/msc_vlr/msc_vlr_test_call.err<br>3 files changed, 10 insertions(+), 12 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c</span><br><span>index ed29e84..704e596 100644</span><br><span>--- a/src/libmsc/gsm_04_08_cc.c</span><br><span>+++ b/src/libmsc/gsm_04_08_cc.c</span><br><span>@@ -272,6 +272,13 @@</span><br><span> </span><br><span>        /* send release to L4, if callref still exists */</span><br><span>    if (trans->callref) {</span><br><span style="color: hsl(120, 100%, 40%);">+              /* Send MNCC REL.ind (cause='Resource unavailable') */</span><br><span style="color: hsl(120, 100%, 40%);">+                if (trans->cc.mncc_initiated) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    mncc_release_ind(trans->net, trans, trans->callref,</span><br><span style="color: hsl(120, 100%, 40%);">+                                      GSM48_CAUSE_LOC_PRN_S_LU,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     GSM48_CC_CAUSE_RESOURCE_UNAVAIL);</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          /* FIXME: currently, a CC trans that would not yet be in state GSM_CSTATE_RELEASE_REQ fails to send a</span><br><span>                 * CC Release to the MS if it gets freed here. Hack it to do so. */</span><br><span>          if (trans->cc.state != GSM_CSTATE_RELEASE_REQ) {</span><br><span>@@ -280,11 +287,6 @@</span><br><span>                   mncc_set_cause(&rel, GSM48_CAUSE_LOC_PRN_S_LU, GSM48_CC_CAUSE_RESOURCE_UNAVAIL);</span><br><span>                         gsm48_cc_tx_release(trans, &rel);</span><br><span>                }</span><br><span style="color: hsl(0, 100%, 40%);">-               /* Resource unavailable */</span><br><span style="color: hsl(0, 100%, 40%);">-              if (trans->cc.mncc_initiated)</span><br><span style="color: hsl(0, 100%, 40%);">-                        mncc_release_ind(trans->net, trans, trans->callref,</span><br><span style="color: hsl(0, 100%, 40%);">-                                        GSM48_CAUSE_LOC_PRN_S_LU,</span><br><span style="color: hsl(0, 100%, 40%);">-                                       GSM48_CC_CAUSE_RESOURCE_UNAVAIL);</span><br><span>           /* This is a final freeing of the transaction. The MNCC release may have triggered the</span><br><span>                * T308 release timer, but we don't have the luxury of graceful CC Release here. */</span><br><span>              gsm48_stop_cc_timer(trans);</span><br><span>diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c</span><br><span>index b4e20be..9ab1066 100644</span><br><span>--- a/tests/msc_vlr/msc_vlr_test_call.c</span><br><span>+++ b/tests/msc_vlr/msc_vlr_test_call.c</span><br><span>@@ -457,11 +457,7 @@</span><br><span>  fake_time_passes(15, 23);</span><br><span> </span><br><span>        btw("The call failed, the BSC sends a BSSMAP Clear Request");</span><br><span style="color: hsl(0, 100%, 40%);">- /* FIXME: in this scenario, we send an MNCC_REL_CNF even though MNCC never asked us to MNCC_REL_REQ.  Legacy</span><br><span style="color: hsl(0, 100%, 40%);">-     * behavior did get to both MNCC_REL_IND, then an MNCC_REL_REQ from MNCC as well as a final MNCC_REL_CNF, but</span><br><span style="color: hsl(0, 100%, 40%);">-    * this only worked synchronously, i.e. only with internal MNCC. Instead of mimicking that, we need a proper</span><br><span style="color: hsl(0, 100%, 40%);">-     * async solution that also works with a PBX. */</span><br><span style="color: hsl(0, 100%, 40%);">-        cc_to_mncc_expect_tx("", MNCC_REL_CNF);</span><br><span style="color: hsl(120, 100%, 40%);">+     cc_to_mncc_expect_tx("", MNCC_REL_IND);</span><br><span>    dtap_expect_tx("032d0802e1af"); /* CC: Release */</span><br><span>  expect_iu_release();</span><br><span>         msc_a_release_cn(msub_msc_a(g_msub));</span><br><span>diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err</span><br><span>index 1bcc489..e8e3880 100644</span><br><span>--- a/tests/msc_vlr/msc_vlr_test_call.err</span><br><span>+++ b/tests/msc_vlr/msc_vlr_test_call.err</span><br><span>@@ -1302,6 +1302,8 @@</span><br><span> DREF VLR subscr IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100 - vlr_subscr_cancel_attach_fsm: now used by 4 (attached,CC,active-conn,msc_a_fsm_releasing_onenter)</span><br><span> DCC trans(CC:CALL_RECEIVED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) Freeing transaction</span><br><span> DCC trans(CC:CALL_RECEIVED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) stopping pending timer T301</span><br><span style="color: hsl(120, 100%, 40%);">+DMNCC trans(CC:CALL_RECEIVED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) tx MNCC_REL_IND</span><br><span style="color: hsl(120, 100%, 40%);">+  MSC --> MNCC: callref 0x423: MNCC_REL_IND</span><br><span> DCC trans(CC:CALL_RECEIVED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) starting timer T308 with 10 seconds</span><br><span> DCC trans(CC:CALL_RECEIVED IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) new state CALL_RECEIVED -> RELEASE_REQ</span><br><span> DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_RELEASING}: Sending DTAP: CC GSM48_MT_CC_RELEASE</span><br><span>@@ -1309,8 +1311,6 @@</span><br><span> - DTAP --UTRAN-Iu--> MS: GSM48_MT_CC_RELEASE: 032d0802e1af</span><br><span> - DTAP matches expected message</span><br><span> DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST</span><br><span style="color: hsl(0, 100%, 40%);">-DMNCC trans(CC:RELEASE_REQ IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) tx MNCC_REL_CNF</span><br><span style="color: hsl(0, 100%, 40%);">-  MSC --> MNCC: callref 0x423: MNCC_REL_CNF</span><br><span> DCC trans(CC:RELEASE_REQ IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) stopping pending timer T308</span><br><span> DCC trans(CC:RELEASE_REQ IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) new state RELEASE_REQ -> NULL</span><br><span> DREF VLR subscr IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100 - CC: now used by 3 (attached,active-conn,msc_a_fsm_releasing_onenter)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-msc/+/22747">change 22747</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-msc/+/22747"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-msc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3ad4a99757878de3796027325627c87d9a4e93f1 </div>
<div style="display:none"> Gerrit-Change-Number: 22747 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Assignee: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>