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.orglaforge has uploaded this change for review. ( 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, 44 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/85/15885/1
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 1b5fc31..11eac81 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -525,6 +525,7 @@
enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in);
int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod);
+bool osmo_ss7_tmode_compatible_xua(enum osmo_ss7_as_traffic_mode tmt, uint32_t m3ua_tmt);
/* VTY related */
struct vty;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index efbceb8..0c1d2c5 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -2059,6 +2059,28 @@
}
}
+bool osmo_ss7_tmode_compatible_xua(enum osmo_ss7_as_traffic_mode tmt, uint32_t m3ua_tmt)
+{
+ switch (m3ua_tmt) {
+ case M3UA_TMOD_OVERRIDE:
+ if (tmt == OSMO_SS7_AS_TMOD_OVERRIDE)
+ return true;
+ break;
+ case M3UA_TMOD_LOADSHARE:
+ if (tmt == OSMO_SS7_AS_TMOD_LOADSHARE ||
+ tmt == OSMO_SS7_AS_TMOD_ROUNDROBIN)
+ return true;
+ break;
+ case M3UA_TMOD_BCAST:
+ if (tmt == 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 890a6b5..011156a 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -416,9 +416,8 @@
struct xua_asp_fsm_priv *xafp = fi->priv;
struct osmo_ss7_asp *asp = xafp->asp;
struct xua_msg *xua_in;
- uint32_t traf_mode;
+ uint32_t traf_mode = 0;
struct xua_msg_part *part;
- uint32_t rctx;
int i;
check_stop_t_ack(fi, event);
@@ -462,11 +461,20 @@
}
if ((part = xua_msg_find_tag(xua_in, M3UA_IEI_ROUTE_CTX))) {
for (i = 0; i < part->len / sizeof(uint32_t); i++) {
- rctx = osmo_load32be(&part->dat[i * sizeof(uint32_t)]);
- if (!osmo_ss7_as_find_by_rctx(asp->inst, rctx)) {
+ uint32_t rctx = osmo_load32be(&part->dat[i * sizeof(uint32_t)]);
+ struct osmo_ss7_as *as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ if (!as) {
peer_send_error(fi, M3UA_ERR_INVAL_ROUT_CTX);
break;
}
+ if (traf_mode) { /* if the peer has specified a traffic mode at all */
+ /* Check if given AS(s) are configured for the respective
+ * traffic mode type; send ERROR if not */
+ if (!osmo_ss7_tmode_compatible_xua(as->cfg.mode, traf_mode)) {
+ peer_send_error(fi, M3UA_ERR_UNSUPP_TRAF_MOD_TYP);
+ break;
+ }
+ }
}
}
/* send ACK */
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index b3c785f..208f8ae 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -219,6 +219,15 @@
}
if (!as->cfg.mode_set_by_vty && _tmode)
as->cfg.mode = osmo_ss7_tmode_from_xua(_tmode);
+ else if (_tmode) {
+ /* verify if existing AS has same traffic-mode as new request (if any) */
+ if (!osmo_ss7_tmode_compatible_xua(as->cfg.mode, _tmode)) {
+ LOGPASP(asp, DLSS7, LOGL_NOTICE, "RKM: Non-matching Traffic Mode %u\n",
+ _tmode);
+ msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE, 0);
+ return -1;
+ }
+ }
} else if (asp->inst->cfg.permit_dyn_rkm_alloc) {
/* Create an AS for this routing key */
snprintf(namebuf, sizeof(namebuf), "as-rkm-%u", rctx);
--
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: 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/20191029/720cfa18/attachment.htm>