[MERGED] libosmo-sccp[master]: osmo_ss7: When destroying an AS or a linkset, delete all routes

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
Tue Apr 11 22:27:04 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: osmo_ss7: When destroying an AS or a linkset, delete all routes
......................................................................


osmo_ss7: When destroying an AS or a linkset, delete all routes

When we destroy a linkset, it make sense to remove all associated routes
pointing to the linkset, as they would point to nowhere anyway.

Change-Id: I393400bc758c28997e16bc78e3142719b6a61be8
---
M src/osmo_ss7.c
1 file changed, 15 insertions(+), 0 deletions(-)

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



diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 24e9fd3..12289ec 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -453,11 +453,18 @@
  *  \param[in] lset Linkset to be destroyed */
 void osmo_ss7_linkset_destroy(struct osmo_ss7_linkset *lset)
 {
+	struct osmo_ss7_route *rt, *rt2;
 	unsigned int i;
 
 	OSMO_ASSERT(ss7_initialized);
 	LOGSS7(lset->inst, LOGL_INFO, "Destroying Linkset %s\n",
 		lset->cfg.name);
+
+	/* find any routes pointing to this AS and remove them */
+	llist_for_each_entry_safe(rt, rt2, &lset->inst->rtable_system->routes, list) {
+		if (rt->dest.linkset == lset)
+			osmo_ss7_route_destroy(rt);
+	}
 
 	for (i = 0; i < ARRAY_SIZE(lset->links); i++) {
 		struct osmo_ss7_link *link = lset->links[i];
@@ -853,12 +860,20 @@
  *  \param[in] as Application Server to destroy */
 void osmo_ss7_as_destroy(struct osmo_ss7_as *as)
 {
+	struct osmo_ss7_route *rt, *rt2;
+
 	OSMO_ASSERT(ss7_initialized);
 	LOGSS7(as->inst, LOGL_INFO, "Destroying AS %s\n", as->cfg.name);
 
 	if (as->fi)
 		osmo_fsm_inst_term(as->fi, OSMO_FSM_TERM_REQUEST, NULL);
 
+	/* find any routes pointing to this AS and remove them */
+	llist_for_each_entry_safe(rt, rt2, &as->inst->rtable_system->routes, list) {
+		if (rt->dest.as == as)
+			osmo_ss7_route_destroy(rt);
+	}
+
 	as->inst = NULL;
 	llist_del(&as->list);
 	talloc_free(as);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I393400bc758c28997e16bc78e3142719b6a61be8
Gerrit-PatchSet: 3
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