aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-16 11:31:23 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-07-16 15:17:06 +0200
commit2cf70e01d763f8dcc206a226cd0897ed6b186a8f (patch)
tree78c8f54aae4617059dcf114bb973e229682a91be
parenta733a50931c4836fbda30f40d853bfab98441e98 (diff)
Forward GGSN originated DEACT PDP CTX REQ
This commit fixes TTCN3 sgsn test TC_attach_pdp_act_user_deact_mt. Change-Id: I204209c017aac8a8402cbb8d0a0200540abcc954
-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 5f308896..8eba2d41 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 ef0cc23d..e6d88e3c 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 88cea5d4..659392ee 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;
}