<p>Mykola Shchetinin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13744">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gprs_gmm: send Service Reject when no PDP ctxs are available.<br><br>Look at PDP Context Status IE and see if MS's view of<br>activated/deactivated NSAPIs agrees with our view. It is checked if<br>there are any Active NSAPIs in PDP Context Status IE which are not<br>present on the network side. If there are any then Service Reject with<br>the cause "NO PDP ACTIVATED" is sent back. This forces MS to reactivate<br>the PDP contexts.<br><br>3GPP TS 24.008 Section 4.7.13.4 Service request procedure not accepted<br>by the network. Cause # 40.<br><br>Change-Id: If610cbef17c25ec44e65d4f1b2340d102c560437<br>Relates: OS#3973<br>---<br>M src/gprs/gprs_gmm.c<br>1 file changed, 30 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/44/13744/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c</span><br><span>index 358bff9..a237da3 100644</span><br><span>--- a/src/gprs/gprs_gmm.c</span><br><span>+++ b/src/gprs/gprs_gmm.c</span><br><span>@@ -1616,6 +1616,26 @@</span><br><span>  }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Returns false if any active PDP context in pdp_status is not present in the pdp_list for given MS */</span><br><span style="color: hsl(120, 100%, 40%);">+static bool all_ms_ctx_present_on_sgsn(struct sgsn_mm_ctx *mmctx,</span><br><span style="color: hsl(120, 100%, 40%);">+                                       const uint8_t *pdp_status)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  uint8_t pdp_nsapi;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  for (pdp_nsapi = 0; pdp_nsapi < 16; pdp_nsapi++) {</span><br><span style="color: hsl(120, 100%, 40%);">+         bool active;</span><br><span style="color: hsl(120, 100%, 40%);">+          if (pdp_nsapi < 8)</span><br><span style="color: hsl(120, 100%, 40%);">+                 active = (1 << pdp_nsapi) & pdp_status[0];</span><br><span style="color: hsl(120, 100%, 40%);">+          else</span><br><span style="color: hsl(120, 100%, 40%);">+                  active = (1 << (pdp_nsapi - 8)) & pdp_status[1];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+          if (active && (sgsn_pdp_ctx_by_nsapi(mmctx, pdp_nsapi) == NULL))</span><br><span style="color: hsl(120, 100%, 40%);">+                      return false;</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%);">+   return true;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Chapter 9.4.14: Routing area update request */</span><br><span> static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,</span><br><span>                               struct gprs_llc_llme *llme)</span><br><span>@@ -1902,6 +1922,16 @@</span><br><span>      if (TLVP_PRESENT(&tp, GSM48_IE_GMM_PDP_CTX_STATUS)) {</span><br><span>            const uint8_t *pdp_status = TLVP_VAL(&tp, GSM48_IE_GMM_PDP_CTX_STATUS);</span><br><span>          process_ms_ctx_status(ctx, pdp_status);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+             /* 3GPP TS 24.008 Section 4.7.13.4 Service request procedure not</span><br><span style="color: hsl(120, 100%, 40%);">+               * accepted by the network. Cause #40.</span><br><span style="color: hsl(120, 100%, 40%);">+                 * If MS has PDP Contexts in Active state in pdp_status but they</span><br><span style="color: hsl(120, 100%, 40%);">+               * are not activated on the network side then Reject with the</span><br><span style="color: hsl(120, 100%, 40%);">+          * cause will force the mobile to recreate PDP contexts */</span><br><span style="color: hsl(120, 100%, 40%);">+            if (!all_ms_ctx_present_on_sgsn(ctx, pdp_status)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   reject_cause = GMM_CAUSE_NO_PDP_ACTIVATED;</span><br><span style="color: hsl(120, 100%, 40%);">+                    goto rejected;</span><br><span style="color: hsl(120, 100%, 40%);">+                }</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/13744">change 13744</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/13744"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sgsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: If610cbef17c25ec44e65d4f1b2340d102c560437 </div>
<div style="display:none"> Gerrit-Change-Number: 13744 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Mykola Shchetinin <mykola@pentonet.com> </div>