aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-05-13 11:35:03 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-05-31 16:44:01 +0200
commit1cde2c169162de3773ccc49b0408a330d61be3d7 (patch)
tree5e063a1c9e4648d1b0d44ec53ea1569eb5314c6e /ggsn
parent93dd798a998824b50b5d65b822ac3db9ad7eafc2 (diff)
ggsn: Use gtp_delete_context_req2() everywhere
Replace calls to gtp_delete_context_req() with gtp_delete_context_req2(). Related: OS#2741 Change-Id: Iecc8c5ac45207e7e20129559c4ac7f3c67dfb36a
Diffstat (limited to 'ggsn')
-rw-r--r--ggsn/ggsn.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 9b45109..c559923 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -107,7 +107,12 @@ static void pool_close_all_pdp(struct ippool_t *pool)
if (!pdp)
continue;
LOGPPDP(LOGL_DEBUG, pdp, "Sending DELETE PDP CTX due to shutdown\n");
- gtp_delete_context_req(pdp->gsn, pdp, NULL, 1);
+ gtp_delete_context_req2(pdp->gsn, pdp, NULL, 1);
+ /* We have nothing more to do with pdp ctx, free it. Upon cb_delete_context
+ called during this call we'll clean up ggsn related stuff attached to this
+ pdp context. After this call, ippool member is cleared so
+ data is no longer valid and should not be accessed anymore. */
+ gtp_freepdp_teardown(pdp->gsn, pdp);
}
}
@@ -980,6 +985,32 @@ static void signal_handler(int s)
}
}
+/* libgtp callback for confirmations */
+static int cb_conf(int type, int cause, struct pdp_t *pdp, void *cbp)
+{
+ int rc = 0;
+
+ if (cause == EOF)
+ LOGP(DGGSN, LOGL_NOTICE, "libgtp EOF (type=%u, pdp=%p, cbp=%p)\n",
+ type, pdp, cbp);
+
+ switch (type) {
+ case GTP_DELETE_PDP_REQ:
+ /* Remark: We actually never reach this path nowadays because
+ only place where we call gtp_delete_context_req2() is during
+ apn_stop()->pool_close_all_pdp() path, and in that case we
+ free all pdp contexts immediatelly without waiting for
+ confirmation since we want to tear down the whole APN
+ anyways. As a result, DeleteCtxResponse will never reach here
+ since it will be dropped at some point in lower layers in the
+ Rx path. This code is nevertheless left here in order to ease
+ future developent and avoid possible future memleaks once more
+ scenarios where GGSN sends a DeleteCtxRequest are introduced. */
+ if (pdp)
+ rc = pdp_freepdp(pdp);
+ }
+ return rc;
+}
/* Start a given GGSN */
int ggsn_start(struct ggsn_ctx *ggsn)
@@ -1027,6 +1058,7 @@ int ggsn_start(struct ggsn_ctx *ggsn)
gtp_set_cb_data_ind(ggsn->gsn, encaps_tun);
gtp_set_cb_delete_context(ggsn->gsn, delete_context);
gtp_set_cb_create_context_ind(ggsn->gsn, create_context_ind);
+ gtp_set_cb_conf(ggsn->gsn, cb_conf);
LOGPGGSN(LOGL_NOTICE, ggsn, "Successfully started\n");
ggsn->started = true;