<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-msc/+/25236">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">vlr_sgs: Balance use_count incremented in vlr_sgs_loc_update<br><br>During a recent pcap trace, it was spotted that subscriber coming from<br>SGs had a use count with 16 "SGs" items, and later it incremented to 17.<br>Further investigation shows that the related use_count item was never<br>decreased, meaning every time an SGs-LU was sent by the MME, the item<br>was incremented further and never decremented.<br><br>Let's rename the item to be referenced while in LU, and then decremented<br>when LU is done. At that time, either the LU was accepted and the<br>subscriber object has a use_count item "attached", or it was rejected<br>and we already sent the reject messages, so we are fine deleting it if<br>needed.<br><br>Related: SYS#5337<br>Change-Id: I22c386f02ffa57428f700b003cc2cf23133598d0<br>---<br>M include/osmocom/msc/vlr_sgs.h<br>M src/libvlr/vlr_sgs.c<br>2 files changed, 7 insertions(+), 2 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/36/25236/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/msc/vlr_sgs.h b/include/osmocom/msc/vlr_sgs.h</span><br><span>index 05e062b..7231449 100644</span><br><span>--- a/include/osmocom/msc/vlr_sgs.h</span><br><span>+++ b/include/osmocom/msc/vlr_sgs.h</span><br><span>@@ -26,7 +26,7 @@</span><br><span> struct vlr_subscr;</span><br><span> struct vlr_instance;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#define VSUB_USE_SGS "SGs"</span><br><span style="color: hsl(120, 100%, 40%);">+#define VSUB_USE_SGS_LU "SGs-lu"</span><br><span> #define VSUB_USE_SGS_PAGING_REQ "SGs-paging-req"</span><br><span> </span><br><span> /* See also 3GPP TS 29.118, chapter 4.2.2 States at the VLR */</span><br><span>diff --git a/src/libvlr/vlr_sgs.c b/src/libvlr/vlr_sgs.c</span><br><span>index 6421581..61db585 100644</span><br><span>--- a/src/libvlr/vlr_sgs.c</span><br><span>+++ b/src/libvlr/vlr_sgs.c</span><br><span>@@ -83,7 +83,7 @@</span><br><span>       OSMO_ASSERT(cfg);</span><br><span>    OSMO_ASSERT(imsi);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  vsub = vlr_subscr_find_or_create_by_imsi(vlr, imsi, VSUB_USE_SGS, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+      vsub = vlr_subscr_find_or_create_by_imsi(vlr, imsi, VSUB_USE_SGS_LU, NULL);</span><br><span>  if (!vsub) {</span><br><span>                 LOGP(DSGS, LOGL_ERROR, "VLR subscriber allocation failed\n");</span><br><span>              return -EINVAL;</span><br><span>@@ -119,6 +119,9 @@</span><br><span> {</span><br><span>   osmo_fsm_inst_dispatch(vsub->sgs_fsm, SGS_UE_E_TX_LU_ACCEPT, NULL);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+    /* Balance vlr_subscr_find_or_create_by_imsi() in vlr_sgs_loc_update() */</span><br><span style="color: hsl(120, 100%, 40%);">+     vlr_subscr_put(vsub, VSUB_USE_SGS_LU);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     /* FIXME: At this point we need to check the status of Ts5 and if</span><br><span>     * it is still running this means the LU has interrupted the paging,</span><br><span>          * and we need to start paging again. 3GPP TS 29.118,</span><br><span>@@ -130,6 +133,8 @@</span><br><span> void vlr_sgs_loc_update_rej_sent(struct vlr_subscr *vsub)</span><br><span> {</span><br><span>        osmo_fsm_inst_dispatch(vsub->sgs_fsm, SGS_UE_E_TX_LU_REJECT, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Balance vlr_subscr_find_or_create_by_imsi() in vlr_sgs_loc_update() */</span><br><span style="color: hsl(120, 100%, 40%);">+     vlr_subscr_put(vsub, VSUB_USE_SGS_LU);</span><br><span> }</span><br><span> </span><br><span> /*! Perform an SGs IMSI detach.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-msc/+/25236">change 25236</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/+/25236"/><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: I22c386f02ffa57428f700b003cc2cf23133598d0 </div>
<div style="display:none"> Gerrit-Change-Number: 25236 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>