aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-06-28 19:11:41 +0200
committerHarald Welte <laforge@gnumonks.org>2010-06-28 19:11:41 +0200
commitc0d59504b48fc3896082a12fbebd7102ecb87094 (patch)
treeb291484460a3d4a1a8324a00e4a18a6af2d26874 /openbsc/src/gprs
parent376d5e521e2b77f892d10e744728882618330c8e (diff)
[SGSN] Deactivate all PDP contexts on GPRS DETACH
Diffstat (limited to 'openbsc/src/gprs')
-rw-r--r--openbsc/src/gprs/gprs_gmm.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 17d2ed07f..63583eccb 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -629,6 +629,7 @@ err_inval:
static int gsm48_rx_gmm_det_req(struct sgsn_mm_ctx *ctx, struct msgb *msg)
{
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
+ struct sgsn_pdp_ctx *pdp, *pdp2;
uint8_t detach_type, power_off;
detach_type = gh->data[0] & 0x7;
@@ -643,6 +644,15 @@ static int gsm48_rx_gmm_det_req(struct sgsn_mm_ctx *ctx, struct msgb *msg)
/* Mark MM state as deregistered */
ctx->mm_state = GMM_DEREGISTERED;
+ /* delete all existing PDP contexts for this MS */
+ llist_for_each_entry_safe(pdp, pdp2, &ctx->pdp_list, list) {
+ LOGP(DMM, LOGL_NOTICE, "Dropping PDP context for NSAPI=%u "
+ "due to GPRS DETACH REQUEST\n", pdp->nsapi);
+ sgsn_delete_pdp_ctx(pdp);
+ /* FIXME: the callback wants to transmit a DEACT PDP CTX ACK,
+ * which is quite stupid for a MS that has just detached.. */
+ }
+
/* force_stby = 0 */
return gsm48_tx_gmm_det_ack(ctx, 0);
}