<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/15784">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Defer xua server binding until exit of VTY node<br><br>Commit 10d4815bb1b4b548ec0bc97611b2e7ac45e0ebc5 already fixed the issue<br>where binding was done during L_CS7_XUA_NODE (listen) done, meaning<br>local-ip inside it had no effect. In that comment, binding was moved to<br>happen during "local-ip" VTY cmd. Furthermore, that commit added a new<br>osmo_ss7_bind_all_instances() and related APIs to allow osmo-stp to have<br>all xua servers bound if no "local-ip" was provided.<br>These APIs have only been used so far by osmo-stp (which lays in the<br>same git repo that libosmo-sccp) since it's the only program using the<br>xua server features.<br><br>In the present commit, let's drop the APIs added by commit described<br>above, and instead let libosmo-sccp code to internally bind the xua<br>server upon exit of the VTY node. As a result, the previously introduced<br>APIs can be dropped (not used by anyone anymore) and it will provide<br>ways to support multiple "local-ip" commands in the future, hence<br>supporting SCTP multi-home features.<br><br>It's recommended to require libosmocore.git Ia6d88c0e63d94ba99e950da6efbc4c1871070012<br>since it fixes a bug where go_parent_cb was not called for nodes at the<br>end of the file.<br><br>Related: OS#3608<br>Change-Id: I2cff17b5e2e2fbfd4591e23a416e510e94e173d6<br>---<br>M include/osmocom/sigtran/osmo_ss7.h<br>M src/osmo_ss7.c<br>M src/osmo_ss7_vty.c<br>M stp/stp_main.c<br>4 files changed, 3 insertions(+), 44 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h</span><br><span>index d6ae1d4..9e8f2b3 100644</span><br><span>--- a/include/osmocom/sigtran/osmo_ss7.h</span><br><span>+++ b/include/osmocom/sigtran/osmo_ss7.h</span><br><span>@@ -108,8 +108,6 @@</span><br><span> void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst);</span><br><span> int osmo_ss7_instance_set_pc_fmt(struct osmo_ss7_instance *inst,</span><br><span>                                uint8_t c0, uint8_t c1, uint8_t c2);</span><br><span style="color: hsl(0, 100%, 40%);">-int osmo_ss7_instance_bind(struct osmo_ss7_instance *inst);</span><br><span style="color: hsl(0, 100%, 40%);">-int osmo_ss7_bind_all_instances();</span><br><span> </span><br><span> struct osmo_sccp_instance *osmo_ss7_ensure_sccp(struct osmo_ss7_instance *inst);</span><br><span> </span><br><span>diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c</span><br><span>index 8d188fc..9b51c29 100644</span><br><span>--- a/src/osmo_ss7.c</span><br><span>+++ b/src/osmo_ss7.c</span><br><span>@@ -422,42 +422,6 @@</span><br><span>    return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/*! \brief bind all xUA servers belonging to an SS7 Instance</span><br><span style="color: hsl(0, 100%, 40%);">- *  \param[in] inst SS7 Instance to apply the socket binding (and start listening)</span><br><span style="color: hsl(0, 100%, 40%);">- *  \returns 0 on success; negative value on error */</span><br><span style="color: hsl(0, 100%, 40%);">-int osmo_ss7_instance_bind(struct osmo_ss7_instance *inst)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-        struct osmo_xua_server *oxs;</span><br><span style="color: hsl(0, 100%, 40%);">-    int rc = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-     llist_for_each_entry(oxs, &inst->xua_servers, list) {</span><br><span style="color: hsl(0, 100%, 40%);">-            if (osmo_ss7_xua_server_bind(oxs) < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-                     LOGSS7(inst, LOGL_ERROR, "Unable to bind xUA server %s:%u\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                         oxs->cfg.local.host, oxs->cfg.local.port);</span><br><span style="color: hsl(0, 100%, 40%);">-                        rc = -1;</span><br><span style="color: hsl(0, 100%, 40%);">-                }</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-       return rc;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*! \brief bind all xUA servers on each of the stored SS7 instances</span><br><span style="color: hsl(0, 100%, 40%);">- *  \returns 0 on success; negative value on error */</span><br><span style="color: hsl(0, 100%, 40%);">-int osmo_ss7_bind_all_instances()</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-   OSMO_ASSERT(ss7_initialized);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-   struct osmo_ss7_instance *inst;</span><br><span style="color: hsl(0, 100%, 40%);">- int rc = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-     llist_for_each_entry(inst, &osmo_ss7_instances, list) {</span><br><span style="color: hsl(0, 100%, 40%);">-             if (osmo_ss7_instance_bind(inst) < 0 ) {</span><br><span style="color: hsl(0, 100%, 40%);">-                     LOGSS7(inst, LOGL_ERROR, "Unable to bind all xUA servers in ss7 instance\n");</span><br><span style="color: hsl(0, 100%, 40%);">-                 rc = -1;</span><br><span style="color: hsl(0, 100%, 40%);">-                }</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-       return rc;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*! Allocate an SCCP instance, if not present yet.</span><br><span>  * \returns inst->sccp. */</span><br><span> struct osmo_sccp_instance *osmo_ss7_ensure_sccp(struct osmo_ss7_instance *inst)</span><br><span>diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c</span><br><span>index 58a3e29..85cc695 100644</span><br><span>--- a/src/osmo_ss7_vty.c</span><br><span>+++ b/src/osmo_ss7_vty.c</span><br><span>@@ -470,10 +470,7 @@</span><br><span>    struct osmo_xua_server *xs = vty->index;</span><br><span> </span><br><span>      osmo_ss7_xua_server_set_local_host(xs, argv[0]);</span><br><span style="color: hsl(0, 100%, 40%);">-        if (osmo_ss7_xua_server_bind(xs) < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-              vty_out(vty, "Unable to bind xUA server to IP %s%s", argv[0], VTY_NEWLINE);</span><br><span style="color: hsl(0, 100%, 40%);">-           return CMD_WARNING;</span><br><span style="color: hsl(0, 100%, 40%);">-     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  return CMD_SUCCESS;</span><br><span> }</span><br><span> </span><br><span>@@ -1725,6 +1722,8 @@</span><br><span>                 break;</span><br><span>       case L_CS7_XUA_NODE:</span><br><span>                 oxs = vty->index;</span><br><span style="color: hsl(120, 100%, 40%);">+          if (osmo_ss7_xua_server_bind(oxs) < 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                     vty_out(vty, "%% Unable to bind xUA server to IP(s)%s", VTY_NEWLINE);</span><br><span>              vty->node = L_CS7_NODE;</span><br><span>           vty->index = oxs->inst;</span><br><span>                break;</span><br><span>diff --git a/stp/stp_main.c b/stp/stp_main.c</span><br><span>index a3e3a85..4cc2586 100644</span><br><span>--- a/stp/stp_main.c</span><br><span>+++ b/stp/stp_main.c</span><br><span>@@ -191,8 +191,6 @@</span><br><span>            exit(1);</span><br><span>     }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   osmo_ss7_bind_all_instances();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>       rc = telnet_init_dynif(tall_stp_ctx, NULL, vty_get_bind_addr(), OSMO_VTY_PORT_STP);</span><br><span>  if (rc < 0) {</span><br><span>             perror("Error binding VTY port\n");</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/15784">change 15784</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/c/libosmo-sccp/+/15784"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmo-sccp </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I2cff17b5e2e2fbfd4591e23a416e510e94e173d6 </div>
<div style="display:none"> Gerrit-Change-Number: 15784 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>