Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10003 )

Change subject: sgsn: Fix T3395 firing forever
......................................................................

sgsn: Fix T3395 firing forever

field pdp->num_T_exp was being reset to 0 every time
pdpctx_timer_start() was called from gsm48_tx_gsm_deact_pdp_req().

Take the chance to test max amount of retrans to 4 as detailed in specs.

Change-Id: Iacce3c66f61578ebee37abaa287f7e183f985c1c
---
M src/gprs/gprs_gmm.c
1 file changed, 13 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index ad56c60..91f769d 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -2170,6 +2170,15 @@

 static void pdpctx_timer_cb(void *_mm);

+
+static void pdpctx_timer_rearm(struct sgsn_pdp_ctx *pdp, unsigned int T, 
unsigned int seconds)
+{
+       if (osmo_timer_pending(&pdp->timer))
+               LOGPDPCTXP(LOGL_ERROR, pdp, "Scheduling PDP timer %u while old "
+                       "timer %u pending\n", T, pdp->T);
+       osmo_timer_schedule(&pdp->timer, seconds, 0);
+}
+
 static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
                                unsigned int seconds)
 {
@@ -2179,9 +2188,8 @@
        pdp->T = T;
        pdp->num_T_exp = 0;

-       /* FIXME: we should do this only once ? */
        osmo_timer_setup(&pdp->timer, pdpctx_timer_cb, pdp);
-       osmo_timer_schedule(&pdp->timer, seconds, 0);
+       pdpctx_timer_rearm(pdp, pdp->T, seconds);
 }

 static void pdpctx_timer_stop(struct sgsn_pdp_ctx *pdp, unsigned int T)
@@ -2724,7 +2732,7 @@

        switch (pdp->T) {
        case 3395:      /* waiting for PDP CTX DEACT ACK */
-               if (pdp->num_T_exp >= 4) {
+               if (pdp->num_T_exp >= 5) {
                        LOGPDPCTXP(LOGL_NOTICE, pdp, "T3395 expired >= 5 
times\n");
                        pdp->state = PDP_STATE_INACTIVE;
                        if (pdp->ggsn)
@@ -2733,7 +2741,8 @@
                                sgsn_pdp_ctx_free(pdp);
                        break;
                }
-               gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_NET_FAIL, true);
+               _gsm48_tx_gsm_deact_pdp_req(pdp->mm, pdp->ti, 
GSM_CAUSE_NET_FAIL, true);
+               pdpctx_timer_rearm(pdp, 3395, sgsn->cfg.timers.T3395);
                break;
        default:
                LOGPDPCTXP(LOGL_ERROR, pdp, "timer expired in unknown mode 
%u\n",

--
To view, visit https://gerrit.osmocom.org/10003
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iacce3c66f61578ebee37abaa287f7e183f985c1c
Gerrit-Change-Number: 10003
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: lynxis lazus <[email protected]>

Reply via email to