<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13612">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">GSUP: include terminating nul in inter-MSC source/destination name<br><br>Before, I was testing with osmo-hlr patch<br>I01a45900e14d41bcd338f50ad85d9fabf2c61405 applied, but that patch is currently<br>in an abandoned state.<br><br>This is the counterpart implemented in osmo-msc: always include the terminating<br>nul char in the "blob" that is the MSC IPA name.<br><br>The dualities in the formats of routing between MSCs is whether to handle it as<br>a char*, or as a uint8_t* with explicit len (a blob).<br><br>In the VTY config to indicate target MSCs for inter-MSC handover, we have<br>strings. We currently even completely lack a way of configuring any blob-like<br>data as a VTY config item.<br><br>In osmo-hlr, the IPA names used for routing are currently received as a char*<br>which *includes* the terminating nul char. So in osmo-msc, if we also always<br>include the nul char, it works.<br><br>Instead, we could just send the char* part without the nul char, and apply<br>above mentioned osmo-hlr patch. That patch would magically match a name that<br>lacks a nul with a name that includes one. I think it is better to agree on one<br>format on the GSUP wire now, instead of making assumptions in osmo-hlr on the<br>format of the source/target names for routing. This format, from the way GSUP<br>so far transmits the IPA SERNO tag when a client attaches to osmo-hlr, happens<br>to include the terminating nul char.<br><br>Change-Id: I9ca8c9eef104519ed1ea46e2fef46dcdc0d554eb<br>---<br>M src/libmsc/e_link.c<br>1 file changed, 14 insertions(+), 7 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/12/13612/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libmsc/e_link.c b/src/libmsc/e_link.c</span><br><span>index c0ebbf6..1ec3647 100644</span><br><span>--- a/src/libmsc/e_link.c</span><br><span>+++ b/src/libmsc/e_link.c</span><br><span>@@ -69,6 +69,7 @@</span><br><span> {</span><br><span>        struct e_link *e;</span><br><span>    struct msc_role_common *c = msc_role->priv;</span><br><span style="color: hsl(120, 100%, 40%);">+        size_t use_len;</span><br><span> </span><br><span>  /* use msub as talloc parent, so we can move an e_link from msc_t to msc_i when it is established. */</span><br><span>        e = talloc_zero(c->msub, struct e_link);</span><br><span>@@ -79,12 +80,18 @@</span><br><span>            .gcm = gcm,</span><br><span>  };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* Expecting all code paths to print the remote name according to remote_name_len. To be paranoid, place a nul</span><br><span style="color: hsl(0, 100%, 40%);">-   * character after the end. */</span><br><span style="color: hsl(0, 100%, 40%);">-  e->remote_name = talloc_size(e, remote_name_len + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+      /* FIXME: this is a braindamaged duality of char* and blob, which we can't seem to get rid of easily.</span><br><span style="color: hsl(120, 100%, 40%);">+      * See also osmo-hlr change I01a45900e14d41bcd338f50ad85d9fabf2c61405 which resolved this on the</span><br><span style="color: hsl(120, 100%, 40%);">+       * osmo-hlr side, but was abandoned. Not sure which way is the right solution. */</span><br><span style="color: hsl(120, 100%, 40%);">+     /* To be able to include a terminating NUL character when sending the IPA name, append one if there is none yet.</span><br><span style="color: hsl(120, 100%, 40%);">+       * Current osmo-hlr needs the terminating NUL to be included. */</span><br><span style="color: hsl(120, 100%, 40%);">+      use_len = remote_name_len;</span><br><span style="color: hsl(120, 100%, 40%);">+    if (remote_name[use_len-1] != '\0')</span><br><span style="color: hsl(120, 100%, 40%);">+           use_len++;</span><br><span style="color: hsl(120, 100%, 40%);">+    e->remote_name = talloc_size(e, use_len);</span><br><span>         memcpy(e->remote_name, remote_name, remote_name_len);</span><br><span style="color: hsl(0, 100%, 40%);">-        e->remote_name[remote_name_len] = '\0';</span><br><span style="color: hsl(0, 100%, 40%);">-      e->remote_name_len = remote_name_len;</span><br><span style="color: hsl(120, 100%, 40%);">+      e->remote_name[use_len-1] = '\0';</span><br><span style="color: hsl(120, 100%, 40%);">+  e->remote_name_len = use_len;</span><br><span> </span><br><span>         e_link_assign(e, msc_role);</span><br><span>  return e;</span><br><span>@@ -125,9 +132,9 @@</span><br><span>      *gsup_msg = (struct osmo_gsup_message){</span><br><span>              .message_class = OSMO_GSUP_MESSAGE_CLASS_INTER_MSC,</span><br><span>          .source_name = (const uint8_t*)local_msc_name,</span><br><span style="color: hsl(0, 100%, 40%);">-          .source_name_len = strlen(local_msc_name),</span><br><span style="color: hsl(120, 100%, 40%);">+            .source_name_len = strlen(local_msc_name)+1, /* include terminating nul */</span><br><span>           .destination_name = (const uint8_t*)e->remote_name,</span><br><span style="color: hsl(0, 100%, 40%);">-          .destination_name_len = e->remote_name_len,</span><br><span style="color: hsl(120, 100%, 40%);">+                .destination_name_len = e->remote_name_len, /* the nul here is also included, from e_link_alloc() */</span><br><span>      };</span><br><span> </span><br><span>       if (vsub)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13612">change 13612</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13612"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-msc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I9ca8c9eef104519ed1ea46e2fef46dcdc0d554eb </div>
<div style="display:none"> Gerrit-Change-Number: 13612 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>