From 9b5d7f6398295af2ea33493f72917f161e8048de Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 16 Jul 2018 14:31:15 +0200 Subject: 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 --- src/gprs/gprs_gmm.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index ad56c6083..91f769d61 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -2170,6 +2170,15 @@ static void mmctx_timer_cb(void *_mm) 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 @@ static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T, 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 @@ static void pdpctx_timer_cb(void *_pdp) 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 @@ static void pdpctx_timer_cb(void *_pdp) 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", -- cgit v1.2.3