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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/15978 ) Change subject: xua: Allow traffic mode set by peer if not set by VTY ...................................................................... xua: Allow traffic mode set by peer if not set by VTY Change-Id: I8ca17439b4dd023625f8f22689c0432341986099 --- M include/osmocom/sigtran/osmo_ss7.h M src/xua_asp_fsm.c M src/xua_rkm.c 3 files changed, 55 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/78/15978/1 diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 1b5fc31..4f20d81 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -314,7 +314,10 @@ enum osmo_ss7_asp_protocol proto; struct osmo_ss7_routing_key routing_key; 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 */ + bool mode_set_by_peer; uint32_t recovery_timeout_msec; uint8_t qos_class; struct { diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c index 890a6b5..5814532 100644 --- a/src/xua_asp_fsm.c +++ b/src/xua_asp_fsm.c @@ -415,10 +415,11 @@ { struct xua_asp_fsm_priv *xafp = fi->priv; struct osmo_ss7_asp *asp = xafp->asp; + struct osmo_ss7_as *as; struct xua_msg *xua_in; - uint32_t traf_mode; + uint32_t traf_mode = 0; + enum osmo_ss7_as_traffic_mode tmode; struct xua_msg_part *part; - uint32_t rctx; int i; check_stop_t_ack(fi, event); @@ -457,18 +458,42 @@ traf_mode != M3UA_TMOD_LOADSHARE && traf_mode != M3UA_TMOD_BCAST) { peer_send_error(fi, M3UA_ERR_UNSUPP_TRAF_MOD_TYP); - break; + return; } + tmode = osmo_ss7_tmode_from_xua(traf_mode); } 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)]); + as = osmo_ss7_as_find_by_rctx(asp->inst, rctx); + if (!as) { peer_send_error(fi, M3UA_ERR_INVAL_ROUT_CTX); - break; + return; } } } + + if (traf_mode) { /* if the peer has specified a traffic mode at all */ + llist_for_each_entry(as, &asp->inst->as_list, list) { + if (!osmo_ss7_as_has_asp(as, asp)) + continue; + + if (!as->cfg.mode_set_by_peer && !as->cfg.mode_set_by_vty) { + as->cfg.mode = tmode; + 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 */ + peer_send_error(fi, M3UA_ERR_UNSUPP_TRAF_MOD_TYP); + return; + } + as->cfg.mode_set_by_peer = true; + } + } + /* send ACK */ peer_send(fi, XUA_ASP_E_ASPTM_ASPAC_ACK, xua_in); /* transition state and inform layer manager */ diff --git a/src/xua_rkm.c b/src/xua_rkm.c index b3c785f..a61ac31 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -152,6 +152,7 @@ unsigned int max_nas_idx, unsigned int *nas_idx) { uint32_t rk_id, rctx, _tmode, dpc; + enum osmo_ss7_as_traffic_mode tmode; struct osmo_ss7_as *as; struct osmo_ss7_route *rt; char namebuf[32]; @@ -217,8 +218,23 @@ msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_INVAL_RKEY, 0); return -1; } - if (!as->cfg.mode_set_by_vty && _tmode) - as->cfg.mode = osmo_ss7_tmode_from_xua(_tmode); + if (_tmode) { /* if the peer has specified a traffic mode at all */ + tmode = osmo_ss7_tmode_from_xua(_tmode); + if (!as->cfg.mode_set_by_peer && !as->cfg.mode_set_by_vty) { + as->cfg.mode = tmode; + 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 */ + 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); + return -1; + } + as->cfg.mode_set_by_peer = true; + } } else if (asp->inst->cfg.permit_dyn_rkm_alloc) { /* Create an AS for this routing key */ snprintf(namebuf, sizeof(namebuf), "as-rkm-%u", rctx); @@ -231,8 +247,10 @@ as->cfg.description = talloc_strdup(as, "Auto-generated by RKM"); as->rkm_dyn_allocated = true; - if (!as->cfg.mode_set_by_vty && _tmode) + if (!as->cfg.mode_set_by_vty && _tmode) { as->cfg.mode = osmo_ss7_tmode_from_xua(_tmode); + as->cfg.mode_set_by_peer = true; + } /* fill routing key */ as->cfg.routing_key.pc = dpc; as->cfg.routing_key.context = rctx; -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/15978 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I8ca17439b4dd023625f8f22689c0432341986099 Gerrit-Change-Number: 15978 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191105/d32a869b/attachment.htm>