Change in libosmo-sccp[master]: M3UA: Reject ASP activation + RKM registration for incompatible traff...

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
Tue Nov 5 20:50:28 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/15885 )

Change subject: M3UA: Reject ASP activation + RKM registration for incompatible traffic-mode
......................................................................

M3UA: Reject ASP activation + RKM registration for incompatible traffic-mode

If the AS is e.g. configured as broadcast, then individual ASPs cannot
be activated in loadshare or override.  Everyone must agree.

Change-Id: Ic73410fbc88d50710202453f759fa132ce14db4c
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
M src/xua_asp_fsm.c
M src/xua_rkm.c
4 files changed, 30 insertions(+), 8 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 4f20d81..04058c2 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -316,7 +316,7 @@
 		enum osmo_ss7_as_traffic_mode mode;
 		/* traffic mode was configured by VTY / config file */
 		bool mode_set_by_vty;
-		/* traffic mode was configured by RKM (routing key management) or ASPAC */
+		/* traffic mode was configured by RKM (routing key management) or first ASPAC */
 		bool mode_set_by_peer;
 		uint32_t recovery_timeout_msec;
 		uint8_t qos_class;
@@ -346,6 +346,7 @@
 void osmo_ss7_as_destroy(struct osmo_ss7_as *as);
 bool osmo_ss7_as_has_asp(struct osmo_ss7_as *as,
 			 struct osmo_ss7_asp *asp);
+bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
 void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
 
 
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index efbceb8..87f1245 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -2059,6 +2059,31 @@
 	}
 }
 
+bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt)
+{
+	if (!as->cfg.mode_set_by_vty && !as->cfg.mode_set_by_peer)
+		return true;
+
+	switch (m3ua_tmt) {
+	case M3UA_TMOD_OVERRIDE:
+		if (as->cfg.mode == OSMO_SS7_AS_TMOD_OVERRIDE)
+			return true;
+		break;
+	case M3UA_TMOD_LOADSHARE:
+		if (as->cfg.mode == OSMO_SS7_AS_TMOD_LOADSHARE ||
+		    as->cfg.mode == OSMO_SS7_AS_TMOD_ROUNDROBIN)
+			return true;
+		break;
+	case M3UA_TMOD_BCAST:
+		if (as->cfg.mode == OSMO_SS7_AS_TMOD_BCAST)
+			return true;
+		break;
+	default:
+		break;
+	}
+	return false;
+}
+
 static osmo_ss7_asp_rx_unknown_cb *g_osmo_ss7_asp_rx_unknown_cb;
 
 int ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 5814532..16c06d6 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -483,10 +483,7 @@
 					LOGPAS(as, DLSS7, LOGL_INFO,
 						"ASPAC: Traffic mode set dynamically by peer to %s\n",
 						osmo_ss7_as_traffic_mode_name(as->cfg.mode));
-				} else if (as->cfg.mode != tmode) {
-					/*FIXME: ^ properly check if tmode is
-					  compatible with already set
-					  as->cfg.mode */
+				} else if (!osmo_ss7_as_tmode_compatible_xua(as, traf_mode)) {
 					peer_send_error(fi, M3UA_ERR_UNSUPP_TRAF_MOD_TYP);
 					return;
 				}
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index a61ac31..10335ea 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -225,9 +225,8 @@
 				LOGPAS(as, DLSS7, LOGL_INFO,
 					"RKM: Traffic mode set dynamically by peer to %s\n",
 					osmo_ss7_as_traffic_mode_name(as->cfg.mode));
-			} else if (as->cfg.mode != tmode) {
-				/*FIXME: ^ properly check if tmode is
-				  compatible with already set as->cfg.mode */
+			/* verify if existing AS has same traffic-mode as new request (if any) */
+			} else if (!osmo_ss7_as_tmode_compatible_xua(as, _tmode)) {
 				LOGPASP(asp, DLSS7, LOGL_NOTICE, "RKM: Non-matching Traffic Mode %s\n",
 					osmo_ss7_as_traffic_mode_name(tmode));
 				msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE, 0);

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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ic73410fbc88d50710202453f759fa132ce14db4c
Gerrit-Change-Number: 15885
Gerrit-PatchSet: 7
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191105/242347f3/attachment.htm>


More information about the gerrit-log mailing list