<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14516">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sgsn: new test for N(U) = 0 in GMM ID response<br><br>Related: OS#2951<br>Change-Id: I19939892d6a49f80453de977021892ba02d3bed2<br>---<br>M sgsn/SGSN_Tests.ttcn<br>1 file changed, 39 insertions(+), 5 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/16/14516/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn</span><br><span>index 03c9d05..b8b2d29 100644</span><br><span>--- a/sgsn/SGSN_Tests.ttcn</span><br><span>+++ b/sgsn/SGSN_Tests.ttcn</span><br><span>@@ -392,23 +392,26 @@</span><br><span>       BSSGP[gb_index].send(ts_BSSGP_UL_UD(g_pars.tlli, g_pars.bssgp_cell_id[gb_index], llc_enc));</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-function f_send_l3_gmm_llc(template PDU_L3_MS_SGSN l3_mo, integer gb_index := 0) runs on BSSGP_ConnHdlr {</span><br><span style="color: hsl(120, 100%, 40%);">+function f_send_l3_gmm_llc(template PDU_L3_MS_SGSN l3_mo, integer gb_index := 0, integer n_u := -1) runs on BSSGP_ConnHdlr {</span><br><span>  var octetstring l3_enc := enc_PDU_L3_MS_SGSN(valueof(l3_mo));</span><br><span>        var BIT4 sapi := f_llc_sapi_by_l3_mo(valueof(l3_mo));</span><br><span style="color: hsl(0, 100%, 40%);">-   var integer n_u := f_llc_get_n_u_tx(llc[bit2int(sapi)]);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    if (n_u == -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+              n_u := f_llc_get_n_u_tx(llc[bit2int(sapi)]);</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span>    f_send_llc(ts_LLC_UI(l3_enc, sapi, '0'B, n_u), gb_index);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-altstep as_mm_identity(integer gb_idx := 0) runs on BSSGP_ConnHdlr {</span><br><span style="color: hsl(120, 100%, 40%);">+altstep as_mm_identity(integer gb_idx := 0, integer n_u := -1) runs on BSSGP_ConnHdlr {</span><br><span>      var MobileL3_CommonIE_Types.MobileIdentityLV mi;</span><br><span>     [] BSSGP[gb_idx].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('001'B))) {</span><br><span>               mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));</span><br><span style="color: hsl(0, 100%, 40%);">-              f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+                f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx, n_u);</span><br><span>          repeat;</span><br><span>      }</span><br><span>    [] BSSGP[gb_idx].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('010'B))) {</span><br><span>               mi := valueof(ts_MI_IMEI_LV(g_pars.imei));</span><br><span style="color: hsl(0, 100%, 40%);">-              f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+                f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx, n_u);</span><br><span>          repeat;</span><br><span>      }</span><br><span> }</span><br><span>@@ -2447,6 +2450,36 @@</span><br><span>      vc_conn.done;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Attach reject after sending two ML L3 messages with N(U) set to zero (OS#2951) */</span><br><span style="color: hsl(120, 100%, 40%);">+private function f_TC_attach_pdp_resp_nu_0(charstring id) runs on BSSGP_ConnHdlr {</span><br><span style="color: hsl(120, 100%, 40%);">+      var RoutingAreaIdentificationV old_ra := f_random_RAI();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit), n_u := 0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    alt {</span><br><span style="color: hsl(120, 100%, 40%);">+ [] as_mm_identity(n_u := 0);</span><br><span style="color: hsl(120, 100%, 40%);">+  /* FIXME: sgsn ignores the wrong N(U) two times, and then "learns" the one we are using. Is this what we want?</span><br><span style="color: hsl(120, 100%, 40%);">+         *        if this test gets used, count the ID REQs we get from sgsn, and add verdicts here. */</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%);">+testcase TC_attach_pdp_resp_nu_0() runs on test_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+    /* MS  -> SGSN: Attach Request, with N(U) = 0</span><br><span style="color: hsl(120, 100%, 40%);">+       * MS <-  SGSN: Identity Request</span><br><span style="color: hsl(120, 100%, 40%);">+    * MS  -> SGSN: Identity Response, with N(U) = 0 (broken behavior!)</span><br><span style="color: hsl(120, 100%, 40%);">+         *              (SGSN drops the message due to invalid N(U))</span><br><span style="color: hsl(120, 100%, 40%);">+   * MS <-  SGSN: Identity Request (2nd try)</span><br><span style="color: hsl(120, 100%, 40%);">+  * MS  -> SGSN: Identity Response, with N(U) = 0 (broken behavior!)</span><br><span style="color: hsl(120, 100%, 40%);">+         *              (SGSN drops the message due to invalid N(U))</span><br><span style="color: hsl(120, 100%, 40%);">+   * MS <-  SGSN: Identity Request (3rd try)</span><br><span style="color: hsl(120, 100%, 40%);">+  * MS  -> SGSN: Identity Response, with N(U) = 0 (broken behavior!)</span><br><span style="color: hsl(120, 100%, 40%);">+         *              (SGSN does recovery handling and accepts the message)</span><br><span style="color: hsl(120, 100%, 40%);">+  * MS <-  SGSN: Attach Reject (Network Failure)</span><br><span style="color: hsl(120, 100%, 40%);">+     *              (SGSN requests subscriber auth info from HLR, but HLR does not answer in this test) */</span><br><span style="color: hsl(120, 100%, 40%);">+        var BSSGP_ConnHdlr vc_conn;</span><br><span style="color: hsl(120, 100%, 40%);">+   f_init();</span><br><span style="color: hsl(120, 100%, 40%);">+     vc_conn := f_start_handler(refers(f_TC_attach_pdp_resp_nu_0), testcasename(), g_gb, 2, 40.0);</span><br><span style="color: hsl(120, 100%, 40%);">+ vc_conn.done;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span> </span><br><span> control {</span><br><span>    execute( TC_attach() );</span><br><span>@@ -2502,6 +2535,7 @@</span><br><span>      execute( TC_llc_null() );</span><br><span>    execute( TC_llc_sabm_dm_llgmm() );</span><br><span>   execute( TC_llc_sabm_dm_ll5() );</span><br><span style="color: hsl(120, 100%, 40%);">+      execute( TC_attach_pdp_resp_nu_0() );</span><br><span> }</span><br><span> </span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14516">change 14516</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-ttcn3-hacks/+/14516"/><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-Change-Id: I19939892d6a49f80453de977021892ba02d3bed2 </div>
<div style="display:none"> Gerrit-Change-Number: 14516 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>