aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/sgsn/gprs_sgsn.h1
-rw-r--r--src/gprs/gprs_sgsn.c14
-rw-r--r--src/gprs/sgsn_libgtp.c7
3 files changed, 15 insertions, 7 deletions
diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index 5f3088961..8eba2d410 100644
--- a/include/osmocom/sgsn/gprs_sgsn.h
+++ b/include/osmocom/sgsn/gprs_sgsn.h
@@ -361,6 +361,7 @@ void sgsn_ggsn_ctx_free(struct sgsn_ggsn_ctx *ggc);
struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_id(uint32_t id);
struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_addr(struct in_addr *addr);
struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_find_alloc(uint32_t id);
+void sgsn_ggsn_ctx_drop_pdp(struct sgsn_pdp_ctx *pctx);
int sgsn_ggsn_ctx_drop_all_pdp(struct sgsn_ggsn_ctx *ggsn);
void sgsn_ggsn_ctx_add_pdp(struct sgsn_ggsn_ctx *ggc, struct sgsn_pdp_ctx *pdp);
void sgsn_ggsn_ctx_remove_pdp(struct sgsn_ggsn_ctx *ggc, struct sgsn_pdp_ctx *pdp);
diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c
index ef0cc23da..e6d88e3cb 100644
--- a/src/gprs/gprs_sgsn.c
+++ b/src/gprs/gprs_sgsn.c
@@ -699,17 +699,17 @@ failed:
return GSM_RESERVED_TMSI;
}
-static void drop_one_pdp(struct sgsn_pdp_ctx *pdp)
+void sgsn_ggsn_ctx_drop_pdp(struct sgsn_pdp_ctx *pctx)
{
- if (pdp->mm->gmm_state == GMM_REGISTERED_NORMAL) {
- gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_NET_FAIL, true);
- sgsn_ggsn_ctx_remove_pdp(pdp->ggsn, pdp);
+ if (pctx->mm->gmm_state == GMM_REGISTERED_NORMAL) {
+ gsm48_tx_gsm_deact_pdp_req(pctx, GSM_CAUSE_NET_FAIL, true);
+ sgsn_ggsn_ctx_remove_pdp(pctx->ggsn, pctx);
} else {
/* FIXME: GPRS paging in case MS is SUSPENDED */
- LOGPDPCTXP(LOGL_NOTICE, pdp, "Hard-dropping PDP ctx due to GGSN "
+ LOGPDPCTXP(LOGL_NOTICE, pctx, "Hard-dropping PDP ctx due to GGSN "
"recovery\n");
/* FIXME: how to tell this to libgtp? */
- sgsn_pdp_ctx_free(pdp);
+ sgsn_pdp_ctx_free(pctx);
}
}
@@ -721,7 +721,7 @@ int sgsn_ggsn_ctx_drop_all_pdp(struct sgsn_ggsn_ctx *ggsn)
struct sgsn_pdp_ctx *pdp, *pdp2;
llist_for_each_entry_safe(pdp, pdp2, &ggsn->pdp_list, ggsn_list) {
- drop_one_pdp(pdp);
+ sgsn_ggsn_ctx_drop_pdp(pdp);
num++;
}
diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index 88cea5d4a..659392ee8 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -639,8 +639,15 @@ static int cb_conf(int type, int cause, struct pdp_t *pdp, void *cbp)
/* Called whenever a PDP context is deleted for any reason */
static int cb_delete_context(struct pdp_t *pdp)
{
+ struct sgsn_pdp_ctx *pctx = pdp->priv;
+
LOGPDPX(DGPRS, LOGL_INFO, pdp, "Context %p was deleted\n", pdp);
+ /* unlink the now non-existing library handle from the pdp
+ * context */
+ pctx->lib = NULL;
+
+ sgsn_ggsn_ctx_drop_pdp(pctx);
return 0;
}