From 2b139a65f07bd3afd6fb5c551b8eae2babea978c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 16 Oct 2019 16:27:16 +0200 Subject: ss7: Only override traffic mode from recv REG REQ if not set by VTY RFC 4666 (SS7/MTP3/M3UA) states in isection 4.3.4.3 ASP Active Procedures: """ If the traffic handling mode of the Application Server is not already known via configuration data, then the traffic handling mode indicated in the first ASP Active message causing the transition of the Application Server state to AS-ACTIVE MAY be used to set the mode. """ In section 3.6.1 Registration Request (REG REQ), no related information is provided on how to handle it, but still makes sense to apply same behavior as in 4.3.4.3. Related: OS#4220 Change-Id: Iaebe3a93ad8d2d84ae01e41b02674f8ece9dfc95 --- TODO-RELEASE | 1 + include/osmocom/sigtran/osmo_ss7.h | 1 + src/osmo_ss7.c | 3 ++- src/osmo_ss7_vty.c | 3 ++- src/xua_rkm.c | 8 ++++---- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/TODO-RELEASE b/TODO-RELEASE index 224f6bc..37a636e 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line libosmo-sigtran osmo_ss7_asp_peer ABI breakage (host is now an array of strings) libosmo-sigtran osmo_ss7_as ABI breakage (added field last_asp_idx_sent) +libosmo-sigtran osmo_ss7_as ABI breakage (added field mode_set_by_vty) diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 4f3d6f5..1b5fc31 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -314,6 +314,7 @@ struct osmo_ss7_as { enum osmo_ss7_asp_protocol proto; struct osmo_ss7_routing_key routing_key; enum osmo_ss7_as_traffic_mode mode; + bool mode_set_by_vty; uint32_t recovery_timeout_msec; uint8_t qos_class; struct { diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 6c6e412..efbceb8 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -2049,12 +2049,13 @@ enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in) { switch (in) { case M3UA_TMOD_OVERRIDE: - default: return OSMO_SS7_AS_TMOD_OVERRIDE; case M3UA_TMOD_LOADSHARE: return OSMO_SS7_AS_TMOD_LOADSHARE; case M3UA_TMOD_BCAST: return OSMO_SS7_AS_TMOD_BCAST; + default: + OSMO_ASSERT(false); } } diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index b068fec..9c22fb1 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -811,6 +811,7 @@ DEFUN(as_traf_mode, as_traf_mode_cmd, struct osmo_ss7_as *as = vty->index; as->cfg.mode = get_string_value(osmo_ss7_as_traffic_mode_vals, argv[0]); + as->cfg.mode_set_by_vty = true; return CMD_SUCCESS; } @@ -994,7 +995,7 @@ static void write_one_as(struct vty *vty, struct osmo_ss7_as *as) continue; vty_out(vty, " asp %s%s", asp->cfg.name, VTY_NEWLINE); } - if (as->cfg.mode != OSMO_SS7_AS_TMOD_OVERRIDE) + if (as->cfg.mode_set_by_vty) vty_out(vty, " traffic-mode %s%s", osmo_ss7_as_traffic_mode_name(as->cfg.mode), VTY_NEWLINE); if (as->cfg.recovery_timeout_msec != 2000) { diff --git a/src/xua_rkm.c b/src/xua_rkm.c index 2d8a25e..b3c785f 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -152,7 +152,6 @@ static int handle_rkey_reg(struct osmo_ss7_asp *asp, struct xua_msg *inner, 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]; @@ -171,8 +170,6 @@ static int handle_rkey_reg(struct osmo_ss7_asp *asp, struct xua_msg *inner, return -1; } - tmode = osmo_ss7_tmode_from_xua(_tmode); - /* destination point code (mandatory) */ dpc = xua_msg_get_u32(inner, M3UA_IEI_DEST_PC); @@ -220,6 +217,8 @@ static int handle_rkey_reg(struct osmo_ss7_asp *asp, struct xua_msg *inner, 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); } else if (asp->inst->cfg.permit_dyn_rkm_alloc) { /* Create an AS for this routing key */ snprintf(namebuf, sizeof(namebuf), "as-rkm-%u", rctx); @@ -232,7 +231,8 @@ static int handle_rkey_reg(struct osmo_ss7_asp *asp, struct xua_msg *inner, as->cfg.description = talloc_strdup(as, "Auto-generated by RKM"); as->rkm_dyn_allocated = true; - as->cfg.mode = tmode; + if (!as->cfg.mode_set_by_vty && _tmode) + as->cfg.mode = osmo_ss7_tmode_from_xua(_tmode); /* fill routing key */ as->cfg.routing_key.pc = dpc; as->cfg.routing_key.context = rctx; -- cgit v1.2.3