<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/9231">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">MSC_ConnectionHandler: check channel mode in f_establish_fully<br><br>The helper function f_establish_fully() checks the channel type<br>for compatibility. If the channel type is compatible with the<br>desired mode a channel mode modification could be necessary if<br>the current channel mode is different from the desired channel<br>mode. However, this is not checked at the momemend. We just<br>blindly expect a MODE MODIFY message from the BSC and ignore<br>the cases where the current channel mode and the desired channel<br>mode already matches up. This is the case if only a signalling<br>channel is requested with f_establish_fully for example.<br><br>- Check if the channel mode of the current channel and the<br>  desired channel mode match up.<br><br>- Make sure that the MODE MODIFY from the BSC is only<br>  expected when the channel modes are different.<br><br>Change-Id: I9004f299220b01ecea6b2316ba3f913c316947dc<br>Closes: OS#2762<br>Related: OS#2936<br>---<br>M bsc/MSC_ConnectionHandler.ttcn<br>1 file changed, 46 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/31/9231/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn</span><br><span>index 991a693..f799bfe 100644</span><br><span>--- a/bsc/MSC_ConnectionHandler.ttcn</span><br><span>+++ b/bsc/MSC_ConnectionHandler.ttcn</span><br><span>@@ -674,6 +674,35 @@</span><br><span>        return false;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Determine if the channel mode specified within rsl_chan_nr requires a</span><br><span style="color: hsl(120, 100%, 40%);">+ * MODE MODIFY in to match the channel mode specified by given BSSMAP</span><br><span style="color: hsl(120, 100%, 40%);">+ * ChannelType */</span><br><span style="color: hsl(120, 100%, 40%);">+function f_channel_needs_modify(BSSMAP_IE_ChannelType bssmap, RslChannelNr rsl_chan_nr)</span><br><span style="color: hsl(120, 100%, 40%);">+return boolean {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       var boolean current_signalling := false;</span><br><span style="color: hsl(120, 100%, 40%);">+      var boolean desired_signalling := false;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    select (rsl_chan_nr) {</span><br><span style="color: hsl(120, 100%, 40%);">+               case (t_RslChanNr_SDCCH4(?, ?)) { current_signalling := true; }</span><br><span style="color: hsl(120, 100%, 40%);">+               case (t_RslChanNr_SDCCH8(?, ?)) { current_signalling := true; }</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (bssmap.speechOrDataIndicator == '0011'B) {</span><br><span style="color: hsl(120, 100%, 40%);">+                desired_signalling := true;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (current_signalling == desired_signalling) {</span><br><span style="color: hsl(120, 100%, 40%);">+               /* The desired channel mode is equal to the one we currently</span><br><span style="color: hsl(120, 100%, 40%);">+           * have, there is no mode modification needed or expected */</span><br><span style="color: hsl(120, 100%, 40%);">+         return false;</span><br><span style="color: hsl(120, 100%, 40%);">+  } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              /* The desired channel mode and the current channel mode do</span><br><span style="color: hsl(120, 100%, 40%);">+            * not match. A mode modification is required */</span><br><span style="color: hsl(120, 100%, 40%);">+             return true;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* establish a channel fully, expecting an assignment matching 'exp' */</span><br><span> function f_establish_fully(template (omit) PDU_BSSAP ass_tpl, template PDU_BSSAP exp_ass_cpl)</span><br><span> runs on MSC_ConnHdlr {</span><br><span>@@ -698,6 +727,7 @@</span><br><span>   timer T := 10.0;</span><br><span>     var boolean exp_compl := ischosen(exp_ass_cpl.pdu.bssmap.assignmentComplete);</span><br><span>        var boolean exp_fail := ischosen(exp_ass_cpl.pdu.bssmap.assignmentFailure);</span><br><span style="color: hsl(120, 100%, 40%);">+   var boolean exp_modify;</span><br><span>      var ExpectCriteria mgcpcrit := {</span><br><span>             connid := omit,</span><br><span>              endpoint := omit,</span><br><span>@@ -707,10 +737,23 @@</span><br><span>    /* if the channel type is SIGNAL, we're not handling a voice call */</span><br><span>     if (ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechOrDataIndicator != '0011'B) {</span><br><span>             st.voice_call := true;</span><br><span style="color: hsl(120, 100%, 40%);">+                exp_modify := true;</span><br><span>  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* determine if the current channel can support the given service or not */</span><br><span>  if (not f_channel_compatible(ass_cmd.pdu.bssmap.assignmentRequest.channelType, g_chan_nr)) {</span><br><span>                 st.is_assignment := true;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           /* We decided to assign a new channel, so we do not expect</span><br><span style="color: hsl(120, 100%, 40%);">+             * any mode modify messages on RSL */</span><br><span style="color: hsl(120, 100%, 40%);">+         exp_modify := false;</span><br><span style="color: hsl(120, 100%, 40%);">+  } else {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+            /* We will continue working with the currently assigned</span><br><span style="color: hsl(120, 100%, 40%);">+                * channel, we must now check if the mode of the current</span><br><span style="color: hsl(120, 100%, 40%);">+               * channel is compatible. If not we expect the BSC to modify</span><br><span style="color: hsl(120, 100%, 40%);">+           * the mode */</span><br><span style="color: hsl(120, 100%, 40%);">+                exp_modify := f_channel_needs_modify(ass_cmd.pdu.bssmap.assignmentRequest.channelType, g_chan_nr);</span><br><span>   }</span><br><span> </span><br><span>        f_create_mgcp_expect(mgcpcrit);</span><br><span>@@ -722,21 +765,20 @@</span><br><span>      [st.is_assignment] as_assignment(st);</span><br><span> </span><br><span>    /* modify related bits */</span><br><span style="color: hsl(0, 100%, 40%);">-       [not st.is_assignment] as_modify(st);</span><br><span style="color: hsl(120, 100%, 40%);">+ [not st.is_assignment and exp_modify] as_modify(st);</span><br><span> </span><br><span>     /* voice call related bits (IPA CRCX/MDCX + MGCP) */</span><br><span>         [st.voice_call] as_Media();</span><br><span> </span><br><span>      /* if we receive exactly what we expected, always return + pass */</span><br><span style="color: hsl(0, 100%, 40%);">-      [st.is_assignment and st.assignment_done or</span><br><span style="color: hsl(0, 100%, 40%);">-      (not st.is_assignment and st.modify_done)] BSSAP.receive(exp_ass_cpl) -> value bssap {</span><br><span style="color: hsl(120, 100%, 40%);">+    [st.is_assignment and st.assignment_done or (not st.is_assignment and (st.modify_done or not exp_modify))] BSSAP.receive(exp_ass_cpl) -> value bssap {</span><br><span>            setverdict(pass);</span><br><span>            }</span><br><span>    [exp_fail] BSSAP.receive(exp_ass_cpl) -> value bssap {</span><br><span>            setverdict(pass);</span><br><span>            }</span><br><span>    [(st.is_assignment and st.assignment_done or</span><br><span style="color: hsl(0, 100%, 40%);">-     (not st.is_assignment and st.modify_done)) and</span><br><span style="color: hsl(120, 100%, 40%);">+        (not st.is_assignment and (st.modify_done or not exp_modify))) and</span><br><span>   exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {</span><br><span>            setverdict(fail, "Received non-matching ASSIGNMENT COMPLETE");</span><br><span>             }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9231">change 9231</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/9231"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I9004f299220b01ecea6b2316ba3f913c316947dc </div>
<div style="display:none"> Gerrit-Change-Number: 9231 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>