aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-01-05 17:23:26 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2023-01-05 17:23:43 +0100
commit44bde6b85a0ceb4041ca7fd91d47614a446fbb91 (patch)
tree4671fea699495a3f7b3b2d607911aaeb51dc55e9
parente659f75cf18705a72335fbe0cf9d041491601ba9 (diff)
Move global ggsn_list into struct sgsn_instance
-rw-r--r--include/osmocom/sgsn/gprs_sgsn.h1
-rw-r--r--include/osmocom/sgsn/sgsn.h1
-rw-r--r--src/sgsn/gprs_sgsn.c2
-rw-r--r--src/sgsn/gtp_ggsn.c6
-rw-r--r--src/sgsn/sgsn_vty.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index 4f8bc3d13..541d854ae 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_by_name(const char *name, const char *imsi_prefix);
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 d558d8781..90f91f748 100644
--- a/include/osmocom/sgsn/sgsn.h
+++ b/include/osmocom/sgsn/sgsn.h
@@ -151,6 +151,7 @@ struct sgsn_instance {
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 5afddb4d5..ea0786282 100644
--- a/src/sgsn/gprs_sgsn.c
+++ b/src/sgsn/gprs_sgsn.c
@@ -64,7 +64,6 @@ extern void *tall_sgsn_ctx;
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 @@ struct sgsn_instance *sgsn_instance_alloc(void *talloc_ctx)
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 0a670e151..f8e09e892 100644
--- a/src/sgsn/gtp_ggsn.c
+++ b/src/sgsn/gtp_ggsn.c
@@ -73,7 +73,7 @@ struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_alloc(uint32_t id)
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 *sgsn_ggsn_ctx_by_id(uint32_t id)
{
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 *sgsn_ggsn_ctx_by_addr(struct in_addr *addr)
{
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 4affa9f20..b678f07ed 100644
--- a/src/sgsn/sgsn_vty.c
+++ b/src/sgsn/sgsn_vty.c
@@ -252,7 +252,7 @@ static int config_write_sgsn(struct vty *vty)
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;