aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-11-30 01:20:32 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-11-30 22:44:23 +0100
commitd03e7289156f1b54926a5a63ce97a3ef954f0c9d (patch)
tree39de328217485f1ae6d967e86fdd528f1224846c
parentf41658d52e0ee26283d6f2c67d369473ab671ed9 (diff)
drop msc_compl_l3() return value
msc_compl_l3() always returns MSC_CONN_ACCEPT, because the conn FSM handles (or should handle) all reject cases. The accept/reject return value is a legacy from libbsc internally passing a conn over to libmsc, in osmo-nitb. Drop enum msc_compl_l3_rc. Change msc_compl_l3_rc() to return void. Change all callers to always act like for acceptance, as they always did anyway. Drop some local variables now no longer needed. Adjust the comment to msc_compl_l3(). Drop a bunch of #if-0'd code from msc_compl_l3(). Change-Id: I759d15f4e820d5fc16397ed7210ce92308e52a09
-rw-r--r--include/osmocom/msc/osmo_msc.h9
-rw-r--r--src/libmsc/a_iface_bssap.c15
-rw-r--r--src/libmsc/iucs.c6
-rw-r--r--src/libmsc/osmo_msc.c32
4 files changed, 11 insertions, 51 deletions
diff --git a/include/osmocom/msc/osmo_msc.h b/include/osmocom/msc/osmo_msc.h
index ad81da5d5..674de3bb3 100644
--- a/include/osmocom/msc/osmo_msc.h
+++ b/include/osmocom/msc/osmo_msc.h
@@ -40,11 +40,6 @@ enum subscr_conn_fsm_state {
SUBSCR_CONN_S_RELEASED,
};
-enum msc_compl_l3_rc {
- MSC_CONN_ACCEPT = 0,
- MSC_CONN_REJECT = 1,
-};
-
struct gsm_subscriber_connection *msc_subscr_conn_alloc(struct gsm_network *network,
enum ran_type via_ran, uint16_t lac);
@@ -59,8 +54,8 @@ int msc_vlr_start(struct gsm_network *net);
void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci);
int msc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
-int msc_compl_l3(struct gsm_subscriber_connection *conn,
- struct msgb *msg, uint16_t chosen_channel);
+void msc_compl_l3(struct gsm_subscriber_connection *conn,
+ struct msgb *msg, uint16_t chosen_channel);
void msc_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg);
int msc_classmark_request_then_cipher_mode_cmd(struct gsm_subscriber_connection *conn, bool umts_aka,
bool retrieve_imeisv);
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index 9a2333db5..77d84b32c 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -260,8 +260,6 @@ static int bssmap_rx_l3_compl(struct osmo_sccp_user *scu, const struct a_conn_in
uint16_t lac = 0;
uint8_t data_length;
const uint8_t *data;
- int rc;
-
struct gsm_network *network = a_conn_info->network;
struct gsm_subscriber_connection *conn;
@@ -345,17 +343,8 @@ static int bssmap_rx_l3_compl(struct osmo_sccp_user *scu, const struct a_conn_in
conn = subscr_conn_allocate_a(a_conn_info, network, lac, scu, a_conn_info->conn_id);
/* Handover location update to the MSC code */
- rc = msc_compl_l3(conn, msg, 0);
-
- if (rc == MSC_CONN_ACCEPT) {
- LOGP(DMSC, LOGL_INFO, "User has been accepted by MSC.\n");
- return 0;
- } else if (rc == MSC_CONN_REJECT)
- LOGP(DMSC, LOGL_INFO, "User has been rejected by MSC.\n");
- else
- LOGP(DMSC, LOGL_INFO, "User has been rejected by MSC (unknown error)\n");
-
- return -EINVAL;
+ msc_compl_l3(conn, msg, 0);
+ return 0;
}
/* Endpoint to handle BSSMAP classmark update */
diff --git a/src/libmsc/iucs.c b/src/libmsc/iucs.c
index 95bbbeeae..c3fea0d06 100644
--- a/src/libmsc/iucs.c
+++ b/src/libmsc/iucs.c
@@ -142,7 +142,6 @@ struct gsm_subscriber_connection *subscr_conn_lookup_iu(
int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
uint16_t *lac)
{
- int rc;
struct ranap_ue_conn_ctx *ue_ctx;
struct gsm_subscriber_connection *conn;
@@ -174,7 +173,6 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
OSMO_ASSERT(pdisc != GSM48_PDISC_RR);
msc_dtap(conn, msg);
- rc = 0;
} else {
/* allocate a new connection */
@@ -191,10 +189,10 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
abort();
/* ownership of conn hereby goes to the MSC: */
- rc = msc_compl_l3(conn, msg, 0);
+ msc_compl_l3(conn, msg, 0);
}
- return rc;
+ return 0;
}
int iu_rab_act_cs(struct gsm_trans *trans)
diff --git a/src/libmsc/osmo_msc.c b/src/libmsc/osmo_msc.c
index 88a3dbba9..05ac8452a 100644
--- a/src/libmsc/osmo_msc.c
+++ b/src/libmsc/osmo_msc.c
@@ -87,37 +87,15 @@ void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
gsm411_sapi_n_reject(conn);
}
-/* receive a Level 3 Complete message and return MSC_CONN_ACCEPT or
- * MSC_CONN_REJECT */
-int msc_compl_l3(struct gsm_subscriber_connection *conn,
- struct msgb *msg, uint16_t chosen_channel)
+/* receive a Level 3 Complete message.
+ * Ownership of the conn is completely passed to the conn FSM, i.e. for both acceptance and rejection,
+ * the conn FSM shall decide when to release this conn. It may already be discarded before this exits. */
+void msc_compl_l3(struct gsm_subscriber_connection *conn,
+ struct msgb *msg, uint16_t chosen_channel)
{
msc_subscr_conn_get(conn, MSC_CONN_USE_COMPL_L3);
gsm0408_dispatch(conn, msg);
-
msc_subscr_conn_put(conn, MSC_CONN_USE_COMPL_L3);
-
- /* Always return acceptance, because even if the conn was not accepted,
- * we assumed ownership of it and the caller shall not interfere with
- * that. We may even already have discarded the conn. */
- return MSC_CONN_ACCEPT;
-
-#if 0
- /*
- * If this is a silent call we want the channel to remain open as long as
- * possible and this is why we accept this connection regardless of any
- * pending transaction or ongoing operation.
- */
- if (conn->silent_call)
- return MSC_CONN_ACCEPT;
- if (conn->loc_operation || conn->sec_operation || conn->anch_operation)
- return MSC_CONN_ACCEPT;
- if (trans_has_conn(conn))
- return MSC_CONN_ACCEPT;
-
- LOGP(DRR, LOGL_INFO, "MSC Complete L3: Rejecting connection.\n");
- return MSC_CONN_REJECT;
-#endif
}
/* Receive a DTAP message from BSC */