Change in osmo-msc[master]: GSUP: include terminating nul in inter-MSC source/destination name

Neels Hofmeyr gerrit-no-reply at
Fri Apr 12 02:52:44 UTC 2019

Neels Hofmeyr has uploaded this change for review. (

Change subject: GSUP: include terminating nul in inter-MSC source/destination name

GSUP: include terminating nul in inter-MSC source/destination name

Before, I was testing with osmo-hlr patch
I01a45900e14d41bcd338f50ad85d9fabf2c61405 applied, but that patch is currently
in an abandoned state.

This is the counterpart implemented in osmo-msc: always include the terminating
nul char in the "blob" that is the MSC IPA name.

The dualities in the formats of routing between MSCs is whether to handle it as
a char*, or as a uint8_t* with explicit len (a blob).

In the VTY config to indicate target MSCs for inter-MSC handover, we have
strings. We currently even completely lack a way of configuring any blob-like
data as a VTY config item.

In osmo-hlr, the IPA names used for routing are currently received as a char*
which *includes* the terminating nul char. So in osmo-msc, if we also always
include the nul char, it works.

Instead, we could just send the char* part without the nul char, and apply
above mentioned osmo-hlr patch. That patch would magically match a name that
lacks a nul with a name that includes one. I think it is better to agree on one
format on the GSUP wire now, instead of making assumptions in osmo-hlr on the
format of the source/target names for routing. This format, from the way GSUP
so far transmits the IPA SERNO tag when a client attaches to osmo-hlr, happens
to include the terminating nul char.

Change-Id: I9ca8c9eef104519ed1ea46e2fef46dcdc0d554eb
M src/libmsc/e_link.c
1 file changed, 14 insertions(+), 7 deletions(-)

  git pull ssh:// refs/changes/12/13612/1

diff --git a/src/libmsc/e_link.c b/src/libmsc/e_link.c
index c0ebbf6..1ec3647 100644
--- a/src/libmsc/e_link.c
+++ b/src/libmsc/e_link.c
@@ -69,6 +69,7 @@
 	struct e_link *e;
 	struct msc_role_common *c = msc_role->priv;
+	size_t use_len;
 	/* use msub as talloc parent, so we can move an e_link from msc_t to msc_i when it is established. */
 	e = talloc_zero(c->msub, struct e_link);
@@ -79,12 +80,18 @@
 		.gcm = gcm,
-	/* Expecting all code paths to print the remote name according to remote_name_len. To be paranoid, place a nul
-	 * character after the end. */
-	e->remote_name = talloc_size(e, remote_name_len + 1);
+	/* FIXME: this is a braindamaged duality of char* and blob, which we can't seem to get rid of easily.
+	 * See also osmo-hlr change I01a45900e14d41bcd338f50ad85d9fabf2c61405 which resolved this on the
+	 * osmo-hlr side, but was abandoned. Not sure which way is the right solution. */
+	/* To be able to include a terminating NUL character when sending the IPA name, append one if there is none yet.
+	 * Current osmo-hlr needs the terminating NUL to be included. */
+	use_len = remote_name_len;
+	if (remote_name[use_len-1] != '\0')
+		use_len++;
+	e->remote_name = talloc_size(e, use_len);
 	memcpy(e->remote_name, remote_name, remote_name_len);
-	e->remote_name[remote_name_len] = '\0';
-	e->remote_name_len = remote_name_len;
+	e->remote_name[use_len-1] = '\0';
+	e->remote_name_len = use_len;
 	e_link_assign(e, msc_role);
 	return e;
@@ -125,9 +132,9 @@
 	*gsup_msg = (struct osmo_gsup_message){
 		.source_name = (const uint8_t*)local_msc_name,
-		.source_name_len = strlen(local_msc_name),
+		.source_name_len = strlen(local_msc_name)+1, /* include terminating nul */
 		.destination_name = (const uint8_t*)e->remote_name,
-		.destination_name_len = e->remote_name_len,
+		.destination_name_len = e->remote_name_len, /* the nul here is also included, from e_link_alloc() */
 	if (vsub)

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ca8c9eef104519ed1ea46e2fef46dcdc0d554eb
Gerrit-Change-Number: 13612
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list