<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/12628">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">libmsc/gsm_04_11.c: fix SM-RP-MR assignment for MT SMS<br><br>Initially, it was assumed that if there is no active RAN connection,<br>we can just start counting from 0x00, as there are no other SMS<br>related transactions, and transaction itself is allocated using<br>talloc_zero(). Until now it was looking good, but...<br><br>As soon as we establish RAN connection with subscriber, we already<br>have a transaction with SM-RP-MR 0x00, but conn->next_rp_ref also<br>remains 0x00 - it isn't being increased!<br><br>It means that we can face a SM-RP-MR conflict (or collision) if<br>another MT SMS would arrive to the MSC (from SMSC over GSUP)<br>when this transaction is still active, i.e. the first SMS is<br>still being sent, because conn->next_rp_ref++ would<br>return 0x00 again.<br><br>Let's clarify SM-RP-MR assignment in gsm411_alloc_mt_trans(),<br>and update the conn->next_rp_ref counter in the paging call-back.<br><br>This change makes the corresponding TC_gsup_mt_sms_rp_mr pass.<br><br>Discovered by: Neels Hofmeyr<br>Related Change-Id: (TTCN) I3a52d44f4abde9b6b471b9108c1cee905884c9bc<br>Change-Id: Ife6d954c46b7d8348a4221ab677d0355eb3ee7ac<br>---<br>M src/libmsc/gsm_04_11.c<br>1 file changed, 10 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/28/12628/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c</span><br><span>index 4dc07bd..7261e17 100644</span><br><span>--- a/src/libmsc/gsm_04_11.c</span><br><span>+++ b/src/libmsc/gsm_04_11.c</span><br><span>@@ -147,6 +147,8 @@</span><br><span>        case GSM_PAGING_SUCCEEDED:</span><br><span>           /* Associate transaction with established connection */</span><br><span>              trans->conn = ran_conn_get(conn, RAN_CONN_USE_TRANS_SMS);</span><br><span style="color: hsl(120, 100%, 40%);">+          /* Update SM-RP-MR counter, SM-RP-MR 0x00 is taken by this trans */</span><br><span style="color: hsl(120, 100%, 40%);">+           trans->conn->next_rp_ref++;</span><br><span>            /* Confirm successful connection establishment */</span><br><span>            gsm411_smc_recv(&trans->sms.smc_inst,</span><br><span>                         GSM411_MMSMS_EST_CNF, NULL, 0);</span><br><span>@@ -1052,10 +1054,14 @@</span><br><span>    if (!trans)</span><br><span>          return NULL;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-        if (conn) {</span><br><span style="color: hsl(0, 100%, 40%);">-             /* Generate unique RP Message Reference */</span><br><span style="color: hsl(0, 100%, 40%);">-              trans->sms.sm_rp_mr = conn->next_rp_ref++;</span><br><span style="color: hsl(0, 100%, 40%);">-        }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Assign a unique SM-RP Message Reference:</span><br><span style="color: hsl(120, 100%, 40%);">+    * a) if there is already an active connection,</span><br><span style="color: hsl(120, 100%, 40%);">+        *    then use its counter conn->next_rp_ref;</span><br><span style="color: hsl(120, 100%, 40%);">+       * b) otherwise SM-RP-MR is set to 0x00, and</span><br><span style="color: hsl(120, 100%, 40%);">+   *    as soon as RAN connection is established,</span><br><span style="color: hsl(120, 100%, 40%);">+        *    its counter conn->next_rp_ref is updated</span><br><span style="color: hsl(120, 100%, 40%);">+      *    by the paging call-back. */</span><br><span style="color: hsl(120, 100%, 40%);">+     trans->sms.sm_rp_mr = conn ? conn->next_rp_ref++ : 0x00;</span><br><span> </span><br><span>   /* Use SAPI 3 (see GSM 04.11, section 2.3) */</span><br><span>        trans->dlci = UM_SAPI_SMS;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12628">change 12628</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/12628"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ife6d954c46b7d8348a4221ab677d0355eb3ee7ac </div>
<div style="display:none"> Gerrit-Change-Number: 12628 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>