aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-11-07 12:48:04 +0100
committerMax <msuraev@sysmocom.de>2018-11-18 21:01:33 +0000
commit49c7d22c5e2cac38f887175ac70c3dd55bd11c65 (patch)
tree4505ed1766ec79899a0bff391fe7e9d106fcb415
parent654bf62be2b66697f7b71ed82302afd09582aedf (diff)
LCLS: move mode check into separate function
Before closing or breaking the loop in LCLS we do preliminary checks. To facilitate adding new LCLS modes it's restructured as follows: * move check into dedicated static function * explicitly check for MGW mode in endpoint check * check for mode mismatch Change-Id: I32ba232ad802625d97a0ad9d0511edc6ac7f251c Related: OS#3659
-rw-r--r--src/osmo-bsc/osmo_bsc_lcls.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/osmo-bsc/osmo_bsc_lcls.c b/src/osmo-bsc/osmo_bsc_lcls.c
index a25faa487..81daaf070 100644
--- a/src/osmo-bsc/osmo_bsc_lcls.c
+++ b/src/osmo-bsc/osmo_bsc_lcls.c
@@ -227,6 +227,26 @@ void lcls_apply_config(struct gsm_subscriber_connection *conn)
osmo_fsm_inst_dispatch(conn->lcls.fi, LCLS_EV_APPLY_CFG_CSC, NULL);
}
+static inline bool lcls_check_toggle_allowed(const struct gsm_subscriber_connection *conn, bool enable)
+{
+ if (conn->lcls.other &&
+ conn->sccp.msc->lcls_mode != conn->lcls.other->sccp.msc->lcls_mode) {
+ LOGPFSM(conn->lcls.fi, "FIXME: LCLS connection mode mismatch: %s != %s\n",
+ get_value_string(bsc_lcls_mode_names, conn->sccp.msc->lcls_mode),
+ get_value_string(bsc_lcls_mode_names, conn->lcls.other->sccp.msc->lcls_mode));
+ return false;
+ }
+
+ if (conn->sccp.msc->lcls_mode == BSC_LCLS_MODE_MGW_LOOP && !conn->user_plane.mgw_endpoint_ci_msc) {
+ /* the MGCP FSM has died, e.g. due to some MGCP/SDP parsing error */
+ LOGPFSML(conn->lcls.fi, LOGL_NOTICE, "Cannot %s LCLS without MSC-side MGCP FSM\n",
+ enable ? "enable" : "disable");
+ return false;
+ }
+
+ return true;
+}
+
/* Close the loop for LCLS using MGCP */
static inline void lcls_mdcx(const struct gsm_subscriber_connection *conn, struct mgcp_conn_peer *mdcx_info)
{
@@ -242,11 +262,8 @@ static void lcls_break_local_switching(struct gsm_subscriber_connection *conn)
LOGPFSM(conn->lcls.fi, "=== HERE IS WHERE WE DISABLE LCLS(%s)\n",
bsc_lcls_mode_name(conn->sccp.msc->lcls_mode));
- if (!conn->user_plane.mgw_endpoint_ci_msc) {
- /* the MGCP FSM has died, e.g. due to some MGCP/SDP parsing error */
- LOGPFSML(conn->lcls.fi, LOGL_NOTICE, "Cannot disable LCLS without MSC-side MGCP FSM\n");
+ if (!lcls_check_toggle_allowed(conn, false))
return;
- }
if (conn->sccp.msc->lcls_mode == BSC_LCLS_MODE_MGW_LOOP) {
struct mgcp_conn_peer mdcx_info = (struct mgcp_conn_peer){
@@ -583,12 +600,12 @@ static void lcls_locally_switched_onenter(struct osmo_fsm_inst *fi, uint32_t pre
OSMO_ASSERT(conn_other);
+ if (!lcls_check_toggle_allowed(conn, true))
+ return;
+
LOGPFSM(fi, "=== HERE IS WHERE WE ENABLE LCLS(%s)\n",
bsc_lcls_mode_name(conn->sccp.msc->lcls_mode));
- if (!conn->user_plane.mgw_endpoint_ci_msc) {
- LOGPFSML(fi, LOGL_ERROR, "Cannot enable LCLS without MSC-side MGCP FSM. FIXME\n");
- return;
- }
+
if (!conn_other->user_plane.mgw_endpoint_ci_msc) {
LOGPFSML(fi, LOGL_ERROR, "Cannot enable LCLS without MSC-side MGCP FSM. FIXME\n");
return;