Change in libosmo-sccp[master]: xua_as_fsm: Only delete a route for an IPA AS if we created one earlier

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/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Apr 29 19:15:06 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/23983 )

Change subject: xua_as_fsm: Only delete a route for an IPA AS if we created one earlier
......................................................................

xua_as_fsm: Only delete a route for an IPA AS if we created one earlier

The current code would potentially delete a route that was statically present in the
configuration in the following situation:

* route exists in config
* identical route is attempted to be added at AS-ACTIVE time, but fails
* route is unconditionally deleted at AS-DOWN time
* user now does 'write file' and has lost a route

Let's make sure we only delete the route if we added it previously.

Change-Id: I9ad5f7ebe0790e6c186b8ea1b12f204860a00cd2
Related: SYS#5422
---
M src/xua_as_fsm.c
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c
index f66ba88..2f52762 100644
--- a/src/xua_as_fsm.c
+++ b/src/xua_as_fsm.c
@@ -200,6 +200,7 @@
 		struct osmo_timer_list t_r;
 		struct llist_head queued_msgs;
 	} recovery;
+	bool ipa_route_created;
 };
 
 /* is the given AS one with a single ASP of IPA type? */
@@ -227,9 +228,13 @@
 	struct osmo_ss7_as *as = xafp->as;
 	struct osmo_ss7_instance *inst = as->inst;
 
+	if (osmo_ss7_route_find_dpc_mask(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff))
+		return;
+
 	/* As opposed to M3UA, there is no RKM and we have to implicitly
 	 * automatically add a route once an IPA connection has come up */
-	osmo_ss7_route_create(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff, as->cfg.name);
+	if (osmo_ss7_route_create(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff, as->cfg.name))
+		xafp->ipa_route_created = true;
 }
 
 static void ipa_del_route(struct osmo_fsm_inst *fi)
@@ -239,6 +244,10 @@
 	struct osmo_ss7_instance *inst = as->inst;
 	struct osmo_ss7_route *rt;
 
+	/* don't delete a route if we added none */
+	if (!xafp->ipa_route_created)
+		return;
+
 	/* find the route which we have created if we ever reached ipa_asp_fsm_wait_id_ack2 */
 	rt = osmo_ss7_route_find_dpc_mask(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff);
 	/* no route found, bail out */
@@ -258,6 +267,7 @@
 	}
 
 	osmo_ss7_route_destroy(rt);
+	xafp->ipa_route_created = false;
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/23983
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I9ad5f7ebe0790e6c186b8ea1b12f204860a00cd2
Gerrit-Change-Number: 23983
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210429/80933766/attachment.htm>


More information about the gerrit-log mailing list