pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30881 )
Change subject: Move global ggsn_list into struct sgsn_instance ......................................................................
Move global ggsn_list into struct sgsn_instance
Change-Id: I9d4c74476b777a866af2796dd376ed50da7b5d01 --- M include/osmocom/sgsn/gprs_sgsn.h M include/osmocom/sgsn/sgsn.h M src/sgsn/gprs_sgsn.c M src/sgsn/gtp_ggsn.c M src/sgsn/sgsn_vty.c 5 files changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/81/30881/1
diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h index 4f8bc3d..541d854 100644 --- a/include/osmocom/sgsn/gprs_sgsn.h +++ b/include/osmocom/sgsn/gprs_sgsn.h @@ -376,7 +376,6 @@ struct apn_ctx *sgsn_apn_ctx_match(const char *name, const char *imsi_prefix);
extern struct llist_head sgsn_mm_ctxts; -extern struct llist_head sgsn_ggsn_ctxts; extern struct llist_head sgsn_apn_ctxts; extern struct llist_head sgsn_pdp_ctxts;
diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index d558d87..90f91f7 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -151,6 +151,7 @@
struct rate_ctr_group *rate_ctrs;
+ struct llist_head ggsn_list; /* list of struct sgsn_ggsn_ctx */ struct llist_head mme_list; /* list of struct sgsn_mme_ctx */
struct ctrl_handle *ctrlh; diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c index 5afddb4..ea07862 100644 --- a/src/sgsn/gprs_sgsn.c +++ b/src/sgsn/gprs_sgsn.c @@ -64,7 +64,6 @@ extern struct osmo_tdef sgsn_T_defs[];
LLIST_HEAD(sgsn_mm_ctxts); -LLIST_HEAD(sgsn_ggsn_ctxts); LLIST_HEAD(sgsn_apn_ctxts); LLIST_HEAD(sgsn_pdp_ctxts);
@@ -918,6 +917,7 @@ inst->rate_ctrs = rate_ctr_group_alloc(inst, &sgsn_ctrg_desc, 0); OSMO_ASSERT(inst->rate_ctrs);
+ INIT_LLIST_HEAD(&inst->ggsn_list); INIT_LLIST_HEAD(&inst->mme_list);
osmo_timer_setup(&inst->llme_timer, sgsn_llme_check_cb, NULL); diff --git a/src/sgsn/gtp_ggsn.c b/src/sgsn/gtp_ggsn.c index 0a670e1..f8e09e8 100644 --- a/src/sgsn/gtp_ggsn.c +++ b/src/sgsn/gtp_ggsn.c @@ -73,7 +73,7 @@ ggc->gsn = sgsn->gsn; INIT_LLIST_HEAD(&ggc->pdp_list); osmo_timer_setup(&ggc->echo_timer, echo_timer_cb, ggc); - llist_add(&ggc->list, &sgsn_ggsn_ctxts); + llist_add(&ggc->list, &sgsn->ggsn_list);
return ggc; } @@ -89,7 +89,7 @@ { struct sgsn_ggsn_ctx *ggc;
- llist_for_each_entry(ggc, &sgsn_ggsn_ctxts, list) { + llist_for_each_entry(ggc, &sgsn->ggsn_list, list) { if (id == ggc->id) return ggc; } @@ -100,7 +100,7 @@ { struct sgsn_ggsn_ctx *ggc;
- llist_for_each_entry(ggc, &sgsn_ggsn_ctxts, list) { + llist_for_each_entry(ggc, &sgsn->ggsn_list, list) { if (!memcmp(addr, &ggc->remote_addr, sizeof(*addr))) return ggc; } diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index 4affa9f..b678f07 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -252,7 +252,7 @@ vty_out(vty, " gtp local-ip %s%s", inet_ntoa(g_cfg->gtp_listenaddr.sin_addr), VTY_NEWLINE);
- llist_for_each_entry(gctx, &sgsn_ggsn_ctxts, list) { + llist_for_each_entry(gctx, &sgsn->ggsn_list, list) { if (gctx->id == UINT32_MAX) continue;