[MERGED] libosmo-sccp[master]: get rid of global osmo_ss7_xua_servers variable

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Apr 15 21:04:22 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: get rid of global osmo_ss7_xua_servers variable
......................................................................


get rid of global osmo_ss7_xua_servers variable

By moving this variable into the SS7 instance, we avoid one more global
variable, and we also fix a bug where the xua servers would be saved
multiple times (once per instance).

Change-Id: Icbab59d773f23cc8514cbeb6e21e25ca35dd337f
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M src/osmo_ss7_vty.c
3 files changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 24f83e9..376e399 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -10,7 +10,6 @@
 #include <osmocom/core/prim.h>
 
 extern struct llist_head osmo_ss7_instances;
-extern struct llist_head osmo_ss7_xua_servers;
 
 struct osmo_ss7_instance;
 struct osmo_ss7_user;
@@ -70,6 +69,8 @@
 	struct llist_head asp_list;
 	/*! list of \ref osmo_ss7_route_table */
 	struct llist_head rtable_list;
+	/*! list of \ref osmo_xua_servers */
+	struct llist_head xua_servers;
 	/* array for faster lookup of user (indexed by service
 	 * indicator) */
 	const struct osmo_ss7_user *user[16];
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 9b2377b..771501f 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -53,7 +53,6 @@
 static bool ss7_initialized = false;
 
 LLIST_HEAD(osmo_ss7_instances);
-LLIST_HEAD(osmo_ss7_xua_servers);
 static int32_t next_rctx = 1;
 static int32_t next_l_rk_id = 1;
 
@@ -329,6 +328,7 @@
 	INIT_LLIST_HEAD(&inst->as_list);
 	INIT_LLIST_HEAD(&inst->asp_list);
 	INIT_LLIST_HEAD(&inst->rtable_list);
+	INIT_LLIST_HEAD(&inst->xua_servers);
 	inst->rtable_system = osmo_ss7_route_table_find_or_create(inst, "system");
 
 	/* default point code structure + formatting */
@@ -1546,7 +1546,7 @@
 	struct osmo_xua_server *xs;
 
 	OSMO_ASSERT(ss7_initialized);
-	llist_for_each_entry(xs, &osmo_ss7_xua_servers, list) {
+	llist_for_each_entry(xs, &inst->xua_servers, list) {
 		if (proto == xs->cfg.proto &&
 		    local_port == xs->cfg.local.port)
 			return xs;
@@ -1596,7 +1596,7 @@
 	}
 
 	oxs->inst = inst;
-	llist_add_tail(&oxs->list, &osmo_ss7_xua_servers);
+	llist_add_tail(&oxs->list, &inst->xua_servers);
 
 	return oxs;
 }
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 8356d16..282a5a0 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -915,7 +915,7 @@
 	llist_for_each_entry(rtable, &inst->rtable_list, list)
 		write_one_rtable(vty, rtable);
 
-	llist_for_each_entry(oxs, &osmo_ss7_xua_servers, list)
+	llist_for_each_entry(oxs, &inst->xua_servers, list)
 		write_one_xua(vty, oxs);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/2350
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icbab59d773f23cc8514cbeb6e21e25ca35dd337f
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list