<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/24704">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmo_ss7_vty: automatically create routes for routing key<br><br>Operators may set up a routing key in each AS node. However, this does<br>not mean that there is also a route added to the routing table. If the<br>default route is not sufficient (e.g. if multiple AS are defined), then<br>operators are epected to put matching routes into the routing table.<br>However, when libosmo-sigtran runs in ASP role, the VTY commands that<br>allow to routing table changes are not present.<br><br>In an ASP role we are in an endpoint situation, so no complex routing<br>is required, in most cases (single AS) even the default route is enough<br>but to ensure that each AS will get a route, add routing tables<br>automatically when running in ASP role.<br><br>Change-Id: Ic60b36983232308250e591dbad576aaafdd6b586<br>Related: SYS#5392<br>---<br>M src/osmo_ss7_vty.c<br>1 file changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/04/24704/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c</span><br><span>index 63625a8..bd15070 100644</span><br><span>--- a/src/osmo_ss7_vty.c</span><br><span>+++ b/src/osmo_ss7_vty.c</span><br><span>@@ -1050,6 +1050,7 @@</span><br><span> {</span><br><span>   struct osmo_ss7_as *as = vty->index;</span><br><span>      struct osmo_ss7_routing_key *rkey = &as->cfg.routing_key;</span><br><span style="color: hsl(120, 100%, 40%);">+      struct osmo_ss7_route *rt;</span><br><span>   int pc;</span><br><span> </span><br><span>  if (as->cfg.proto == OSMO_SS7_ASP_PROT_IPA && atoi(rcontext) != 0) {</span><br><span>@@ -1063,12 +1064,33 @@</span><br><span>            vty_out(vty, "Invalid point code (%s)%s", dpc, VTY_NEWLINE);</span><br><span>               return CMD_WARNING;</span><br><span>  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* When libosmo-sigtran is used in ASP role, the VTY routing table node</span><br><span style="color: hsl(120, 100%, 40%);">+        * (config-cs7-rt) is not available. However, when we add a routing key</span><br><span style="color: hsl(120, 100%, 40%);">+        * to an AS we still have to put a matching route into the routing</span><br><span style="color: hsl(120, 100%, 40%);">+     * table. This is done automatically by first removing the old route</span><br><span style="color: hsl(120, 100%, 40%);">+   * (users may change the routing key via VTY during runtime) and then</span><br><span style="color: hsl(120, 100%, 40%);">+  * putting a new route (see below). */</span><br><span style="color: hsl(120, 100%, 40%);">+        if (cs7_role == CS7_ROLE_ASP) {</span><br><span style="color: hsl(120, 100%, 40%);">+               rt = osmo_ss7_route_find_dpc_mask(as->inst->rtable_system, rkey->pc, 0xffffff);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (rt)</span><br><span style="color: hsl(120, 100%, 40%);">+                       osmo_ss7_route_destroy(rt);</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  rkey->pc = pc;</span><br><span> </span><br><span>        rkey->context = atoi(rcontext);                              /* FIXME: input validation */</span><br><span>        rkey->si = si ? get_string_value(mtp_si_vals, si) : 0;       /* FIXME: input validation */</span><br><span>        rkey->ssn = ssn ? atoi(ssn) : 0;                     /* FIXME: input validation */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+     /* automatically add new route (see also comment above) */</span><br><span style="color: hsl(120, 100%, 40%);">+    if (cs7_role == CS7_ROLE_ASP) {</span><br><span style="color: hsl(120, 100%, 40%);">+               if (!osmo_ss7_route_create(as->inst->rtable_system, rkey->pc, 0xffffff, as->cfg.name)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  vty_out(vty, "Cannot crate route (pc=%s, linkset=%s) to linkset %s", dpc, as->cfg.name, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+                    return CMD_WARNING;</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 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></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/24704">change 24704</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/+/24704"/><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: Ic60b36983232308250e591dbad576aaafdd6b586 </div>
<div style="display:none"> Gerrit-Change-Number: 24704 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>