pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30892 )
Change subject: Move global pdp_list inside struct sgsn_instance ......................................................................
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 --- M include/osmocom/sgsn/pdpctx.h M include/osmocom/sgsn/sgsn.h M src/sgsn/gprs_sgsn.c M src/sgsn/pdpctx.c M src/sgsn/sgsn_vty.c 5 files changed, 5 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/92/30892/1
diff --git a/include/osmocom/sgsn/pdpctx.h b/include/osmocom/sgsn/pdpctx.h index 1e982af..255a77d 100644 --- a/include/osmocom/sgsn/pdpctx.h +++ b/include/osmocom/sgsn/pdpctx.h @@ -90,7 +90,5 @@ void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp); void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp);
-extern struct llist_head sgsn_pdp_ctxts; - char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len, bool return_ipv6);
diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index 4326846..a2cfa9c 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -154,6 +154,7 @@ struct llist_head apn_list; /* list of struct sgsn_apn_ctx */ struct llist_head ggsn_list; /* list of struct sgsn_ggsn_ctx */ struct llist_head mme_list; /* list of struct sgsn_mme_ctx */ + struct llist_head pdp_list; /* list of struct sgsn_pdp_ctx */
struct ctrl_handle *ctrlh; }; diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c index 20cf82f..6089760 100644 --- a/src/sgsn/gprs_sgsn.c +++ b/src/sgsn/gprs_sgsn.c @@ -706,6 +706,7 @@ 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 52b1c0f..77146fc 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 @@ 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 @@ } 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 3079dfc..959f35b 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -725,7 +725,7 @@ { 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;