aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-01-05 20:26:31 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2023-01-11 12:51:38 +0100
commit15a52d92c41f315d5f463e597be9498d09f83935 (patch)
tree18c941c49384cfec5e2040089eb812c588e2d609 /src
parent05190c36bb73896d72258f1a196ea31ae3a4493a (diff)
Move global pdp_list inside struct sgsn_instance
This way pdp contexts are managed by the lifcycle of the main global struct sgsn_instance automatically. Change-Id: I725218fd54adcc68dceded5eb43675f25771bb96
Diffstat (limited to 'src')
-rw-r--r--src/sgsn/gprs_sgsn.c1
-rw-r--r--src/sgsn/pdpctx.c6
-rw-r--r--src/sgsn/sgsn_vty.c2
3 files changed, 4 insertions, 5 deletions
diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c
index 9d2ed7d98..40efd4aff 100644
--- a/src/sgsn/gprs_sgsn.c
+++ b/src/sgsn/gprs_sgsn.c
@@ -704,6 +704,7 @@ struct sgsn_instance *sgsn_instance_alloc(void *talloc_ctx)
INIT_LLIST_HEAD(&inst->apn_list);
INIT_LLIST_HEAD(&inst->ggsn_list);
INIT_LLIST_HEAD(&inst->mme_list);
+ INIT_LLIST_HEAD(&inst->pdp_list);
osmo_timer_setup(&inst->llme_timer, sgsn_llme_check_cb, NULL);
osmo_timer_schedule(&inst->llme_timer, GPRS_LLME_CHECK_TICK, 0);
diff --git a/src/sgsn/pdpctx.c b/src/sgsn/pdpctx.c
index 52b1c0ff0..77146fc76 100644
--- a/src/sgsn/pdpctx.c
+++ b/src/sgsn/pdpctx.c
@@ -39,8 +39,6 @@
#include <osmocom/sgsn/gprs_sm.h>
#include <osmocom/sgsn/gtp.h>
-LLIST_HEAD(sgsn_pdp_ctxts);
-
static const struct rate_ctr_desc pdpctx_ctr_description[] = {
{ "udata:packets:in", "User Data Messages ( In)" },
{ "udata:packets:out", "User Data Messages (Out)" },
@@ -67,7 +65,7 @@ struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm,
if (pdp)
return NULL;
- pdp = talloc_zero(tall_sgsn_ctx, struct sgsn_pdp_ctx);
+ pdp = talloc_zero(sgsn, struct sgsn_pdp_ctx);
if (!pdp)
return NULL;
@@ -82,7 +80,7 @@ struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm,
}
llist_add(&pdp->list, &mm->pdp_list);
sgsn_ggsn_ctx_add_pdp(pdp->ggsn, pdp);
- llist_add(&pdp->g_list, &sgsn_pdp_ctxts);
+ llist_add(&pdp->g_list, &sgsn->pdp_list);
return pdp;
}
diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c
index 8e94041fc..d8ea42008 100644
--- a/src/sgsn/sgsn_vty.c
+++ b/src/sgsn/sgsn_vty.c
@@ -723,7 +723,7 @@ DEFUN(show_pdpctx_all, show_pdpctx_all_cmd,
{
struct sgsn_pdp_ctx *pdp;
- llist_for_each_entry(pdp, &sgsn_pdp_ctxts, g_list)
+ llist_for_each_entry(pdp, &sgsn->pdp_list, g_list)
vty_dump_pdp(vty, "", pdp);
return CMD_SUCCESS;