fixeria has uploaded this change for review.
gprs_gmm: gsm48_rx_gmm_att_req(): drop stale PDP contexts on re-Attach
When an MS sends an Attach Request with a known IMSI or P-TMSI, it
implies the MS has restarted and lost all its PDP context state. The
SGSN must clean up any PDP contexts it still holds for that subscriber;
otherwise it will not create new ones upon subsequent PDP Context
Activation, causing data connectivity failure after a device reboot.
Change-Id: I20c1f5f741275115635188b2f4b1c5fe7c6e40f1
Related: OS#6922
---
M src/sgsn/gprs_gmm.c
1 file changed, 22 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/94/42594/1
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 3d4b940..fe7d4b4 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1336,6 +1336,17 @@
goto rejected;
}
OSMO_STRLCPY_ARRAY(ctx->imsi, mi.imsi);
+ } else {
+ /* A re-Attach from a known IMSI means the MS has restarted
+ * and lost its PDP state. Clean up stale PDP contexts so the
+ * MS can activate new ones successfully. */
+ struct sgsn_pdp_ctx *pdp, *pdp2;
+ llist_for_each_entry_safe(pdp, pdp2, &ctx->pdp_list, list) {
+ LOGMMCTXP(LOGL_NOTICE, ctx,
+ "Re-Attach: Dropping stale PDP context for NSAPI=%u\n",
+ pdp->nsapi);
+ sgsn_pdp_ctx_terminate(pdp);
+ }
}
break;
case GSM_MI_TYPE_TMSI:
@@ -1354,6 +1365,17 @@
goto rejected;
}
ctx->p_tmsi = mi.tmsi;
+ } else {
+ /* A re-Attach from a known P-TMSI means the MS has restarted
+ * and lost its PDP state. Clean up stale PDP contexts so the
+ * MS can activate new ones successfully. */
+ struct sgsn_pdp_ctx *pdp, *pdp2;
+ llist_for_each_entry_safe(pdp, pdp2, &ctx->pdp_list, list) {
+ LOGMMCTXP(LOGL_NOTICE, ctx,
+ "Re-Attach: Dropping stale PDP context for NSAPI=%u\n",
+ pdp->nsapi);
+ sgsn_pdp_ctx_terminate(pdp);
+ }
}
break;
default:
To view, visit change 42594. To unsubscribe, or for help writing mail filters, visit settings.