<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/16389">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">xua_asp_fsm: Ensure xUA client includes traffic-mode if configured<br><br>When a client (ASP) sends an ASPAC to the server (SG), it should include<br>the traffic-mode configured for it's ASs, if any.<br><br>Change-Id: Ia850df22df529dab74959e8666f85976002c482c<br>Related: OS#4285<br>---<br>M src/xua_asp_fsm.c<br>1 file changed, 30 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/89/16389/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c</span><br><span>index e09c46c..6114b47 100644</span><br><span>--- a/src/xua_asp_fsm.c</span><br><span>+++ b/src/xua_asp_fsm.c</span><br><span>@@ -141,6 +141,32 @@</span><br><span>       xua_asp_send_xlm_prim_simple(asp, prim_type, op);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* determine the osmo_ss7_as_traffic_mode to be used by this ASP; will</span><br><span style="color: hsl(120, 100%, 40%);">+ * iterate over all AS configured for this ASP.  If they're compatible,</span><br><span style="color: hsl(120, 100%, 40%);">+ * a single traffic mode is returned.  If they're incompatible, -EINVAL</span><br><span style="color: hsl(120, 100%, 40%);">+ * is returned.  If there is none configured, -1 is returned */</span><br><span style="color: hsl(120, 100%, 40%);">+static int determine_traf_mode(struct osmo_ss7_asp *asp)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    struct osmo_ss7_as *as;</span><br><span style="color: hsl(120, 100%, 40%);">+       int tmode = -1;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     llist_for_each_entry(as, &asp->inst->as_list, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+               if (!osmo_ss7_as_has_asp(as, asp))</span><br><span style="color: hsl(120, 100%, 40%);">+                    continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             /* we only care about traffic modes explicitly set */</span><br><span style="color: hsl(120, 100%, 40%);">+         if (!as->cfg.mode_set_by_vty)</span><br><span style="color: hsl(120, 100%, 40%);">+                      continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             if (tmode == -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    /* this is the first AS; we use this traffic mode */</span><br><span style="color: hsl(120, 100%, 40%);">+                  tmode = as->cfg.mode;</span><br><span style="color: hsl(120, 100%, 40%);">+              } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      if (tmode != as->cfg.mode)</span><br><span style="color: hsl(120, 100%, 40%);">+                         return -EINVAL;</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%);">+     return tmode;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* ask the xUA implementation to transmit a specific message */</span><br><span> static int peer_send(struct osmo_fsm_inst *fi, int out_event, struct xua_msg *in)</span><br><span> {</span><br><span>@@ -148,6 +174,7 @@</span><br><span>        struct osmo_ss7_asp *asp = xafp->asp;</span><br><span>     struct xua_msg *xua = xua_msg_alloc();</span><br><span>       struct msgb *msg;</span><br><span style="color: hsl(120, 100%, 40%);">+     int rc;</span><br><span> </span><br><span>  switch (out_event) {</span><br><span>         case XUA_ASP_E_ASPSM_ASPUP:</span><br><span>@@ -188,6 +215,9 @@</span><br><span>            /* RFC3868 Ch. 3.6.1 */</span><br><span>              xua->hdr = XUA_HDR(SUA_MSGC_ASPTM, SUA_ASPTM_ACTIVE);</span><br><span>             /* Optional: Traffic Mode Type */</span><br><span style="color: hsl(120, 100%, 40%);">+             rc = determine_traf_mode(asp);</span><br><span style="color: hsl(120, 100%, 40%);">+                if (rc >= 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                       xua_msg_add_u32(xua, M3UA_IEI_TRAF_MODE_TYP, osmo_ss7_tmode_to_xua(rc));</span><br><span>             /* Optional: Routing Context */</span><br><span>              /* Optional: TID Label */</span><br><span>            /* Optional: DRN Label */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/16389">change 16389</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/+/16389"/><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: Ia850df22df529dab74959e8666f85976002c482c </div>
<div style="display:none"> Gerrit-Change-Number: 16389 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>