Change in libosmo-sccp[master]: osmo_ss7_vty: automatically create routes for routing key

dexter gerrit-no-reply at
Wed Jun 16 15:59:00 UTC 2021

dexter has uploaded this change for review. ( )

Change subject: osmo_ss7_vty: automatically create routes for routing key

osmo_ss7_vty: automatically create routes for routing key

Operators may set up a routing key in each AS node. However, this does
not mean that there is also a route added to the routing table. If the
default route is not sufficient (e.g. if multiple AS are defined), then
operators are epected to put matching routes into the routing table.
However, when libosmo-sigtran runs in ASP role, the VTY commands that
allow to routing table changes are not present.

In an ASP role we are in an endpoint situation, so no complex routing
is required, in most cases (single AS) even the default route is enough
but to ensure that each AS will get a route, add routing tables
automatically when running in ASP role.

Change-Id: Ic60b36983232308250e591dbad576aaafdd6b586
Related: SYS#5392
M src/osmo_ss7_vty.c
1 file changed, 22 insertions(+), 0 deletions(-)

  git pull ssh:// refs/changes/04/24704/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 63625a8..bd15070 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1050,6 +1050,7 @@
 	struct osmo_ss7_as *as = vty->index;
 	struct osmo_ss7_routing_key *rkey = &as->cfg.routing_key;
+	struct osmo_ss7_route *rt;
 	int pc;
 	if (as->cfg.proto == OSMO_SS7_ASP_PROT_IPA && atoi(rcontext) != 0) {
@@ -1063,12 +1064,33 @@
 		vty_out(vty, "Invalid point code (%s)%s", dpc, VTY_NEWLINE);
 		return CMD_WARNING;
+	/* When libosmo-sigtran is used in ASP role, the VTY routing table node
+	 * (config-cs7-rt) is not available. However, when we add a routing key
+	 * to an AS we still have to put a matching route into the routing
+	 * table. This is done automatically by first removing the old route
+	 * (users may change the routing key via VTY during runtime) and then
+	 * putting a new route (see below). */
+	if (cs7_role == CS7_ROLE_ASP) {
+		rt = osmo_ss7_route_find_dpc_mask(as->inst->rtable_system, rkey->pc, 0xffffff);
+		if (rt)
+			osmo_ss7_route_destroy(rt);
+	}
 	rkey->pc = pc;
 	rkey->context = atoi(rcontext);				/* FIXME: input validation */
 	rkey->si = si ? get_string_value(mtp_si_vals, si) : 0;	/* FIXME: input validation */
 	rkey->ssn = ssn ? atoi(ssn) : 0;			/* FIXME: input validation */
+	/* automatically add new route (see also comment above) */
+	if (cs7_role == CS7_ROLE_ASP) {
+		if (!osmo_ss7_route_create(as->inst->rtable_system, rkey->pc, 0xffffff, as-> {
+			vty_out(vty, "Cannot crate route (pc=%s, linkset=%s) to linkset %s", dpc, as->, VTY_NEWLINE);
+			return CMD_WARNING;
+		}
+	}
 	return CMD_SUCCESS;

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ic60b36983232308250e591dbad576aaafdd6b586
Gerrit-Change-Number: 24704
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list