Change in libosmo-sccp[master]: xua_asp_fsm: Ensure xUA client includes traffic-mode if configured

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Dec 1 19:41:37 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/16389 )


Change subject: xua_asp_fsm: Ensure xUA client includes traffic-mode if configured
......................................................................

xua_asp_fsm: Ensure xUA client includes traffic-mode if configured

When a client (ASP) sends an ASPAC to the server (SG), it should include
the traffic-mode configured for it's ASs, if any.

Change-Id: Ia850df22df529dab74959e8666f85976002c482c
Related: OS#4285
---
M src/xua_asp_fsm.c
1 file changed, 30 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/89/16389/1

diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index e09c46c..6114b47 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -141,6 +141,32 @@
 	xua_asp_send_xlm_prim_simple(asp, prim_type, op);
 }
 
+/* determine the osmo_ss7_as_traffic_mode to be used by this ASP; will
+ * iterate over all AS configured for this ASP.  If they're compatible,
+ * a single traffic mode is returned.  If they're incompatible, -EINVAL
+ * is returned.  If there is none configured, -1 is returned */
+static int determine_traf_mode(struct osmo_ss7_asp *asp)
+{
+	struct osmo_ss7_as *as;
+	int tmode = -1;
+
+	llist_for_each_entry(as, &asp->inst->as_list, list) {
+		if (!osmo_ss7_as_has_asp(as, asp))
+			continue;
+		/* we only care about traffic modes explicitly set */
+		if (!as->cfg.mode_set_by_vty)
+			continue;
+		if (tmode == -1) {
+			/* this is the first AS; we use this traffic mode */
+			tmode = as->cfg.mode;
+		} else {
+			if (tmode != as->cfg.mode)
+				return -EINVAL;
+		}
+	}
+	return tmode;
+}
+
 /* ask the xUA implementation to transmit a specific message */
 static int peer_send(struct osmo_fsm_inst *fi, int out_event, struct xua_msg *in)
 {
@@ -148,6 +174,7 @@
 	struct osmo_ss7_asp *asp = xafp->asp;
 	struct xua_msg *xua = xua_msg_alloc();
 	struct msgb *msg;
+	int rc;
 
 	switch (out_event) {
 	case XUA_ASP_E_ASPSM_ASPUP:
@@ -188,6 +215,9 @@
 		/* RFC3868 Ch. 3.6.1 */
 		xua->hdr = XUA_HDR(SUA_MSGC_ASPTM, SUA_ASPTM_ACTIVE);
 		/* Optional: Traffic Mode Type */
+		rc = determine_traf_mode(asp);
+		if (rc >= 0)
+			xua_msg_add_u32(xua, M3UA_IEI_TRAF_MODE_TYP, osmo_ss7_tmode_to_xua(rc));
 		/* Optional: Routing Context */
 		/* Optional: TID Label */
 		/* Optional: DRN Label */

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/16389
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ia850df22df529dab74959e8666f85976002c482c
Gerrit-Change-Number: 16389
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191201/ef8c517e/attachment.htm>


More information about the gerrit-log mailing list