aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-10 02:12:32 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-10 04:35:43 +0100
commit0f35f81e80db343994d5488e58877a80a115314e (patch)
tree5aeb94f692ab4f5502943eaaa4a2278242f32b1b
parent66c35525cbb2c36340484fd64be4f462858b4f1c (diff)
mostly cosmetic: have one msc_conn_close() with cause argument
-rw-r--r--openbsc/include/openbsc/osmo_msc.h2
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c19
-rw-r--r--openbsc/src/libmsc/iucs.c2
-rw-r--r--openbsc/src/libmsc/osmo_msc.c8
4 files changed, 17 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/osmo_msc.h b/openbsc/include/openbsc/osmo_msc.h
index 8d25f79d8..d6d2b116b 100644
--- a/openbsc/include/openbsc/osmo_msc.h
+++ b/openbsc/include/openbsc/osmo_msc.h
@@ -77,7 +77,7 @@ int msc_compl_l3(struct gsm_subscriber_connection *conn,
void msc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg);
void msc_cipher_mode_compl(struct gsm_subscriber_connection *conn,
struct msgb *msg, uint8_t alg_id);
-void msc_close_connection(struct gsm_subscriber_connection *conn);
+void msc_conn_close(struct gsm_subscriber_connection *conn, uint32_t cause);
bool msc_subscr_conn_is_accepted(struct gsm_subscriber_connection *conn);
void msc_subscr_conn_communicating(struct gsm_subscriber_connection *conn);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 9909086a8..8b7d3bdd1 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -155,8 +155,7 @@ void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t caus
return;
}
- /* TODO add cause item to msc_close_connection() */
- osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, &cause);
+ msc_conn_close(conn, cause);
}
/* clear all transactions globally; used in case of MNCC socket disconnect */
@@ -810,7 +809,7 @@ static int gsm48_rx_mm_imsi_detach_ind(struct gsm_subscriber_connection *conn, s
return 0;
#endif
- msc_close_connection(conn);
+ msc_conn_close(conn, 0);
return 0;
}
@@ -906,7 +905,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct
if (!conn->vsub) {
LOGP(DMM, LOGL_ERROR,
"MM AUTHENTICATION RESPONSE: invalid: no subscriber\n");
- gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED);
+ msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED);
return -EINVAL;
}
@@ -920,7 +919,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct
}
if (rc) {
- gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED);
+ msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED);
return -EINVAL;
}
@@ -945,7 +944,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct
if (!conn->vsub) {
LOGP(DMM, LOGL_ERROR,
"MM R99 AUTHENTICATION FAILURE: invalid: no subscriber\n");
- gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED);
+ msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED);
return -EINVAL;
}
@@ -954,7 +953,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct
"%s: MM R99 AUTHENTICATION FAILURE:"
" l3 length invalid: %u\n",
vlr_subscr_name(conn->vsub), msgb_l3len(msg));
- gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED);
+ msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED);
return -EINVAL;
}
@@ -977,7 +976,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct
"%s: MM R99 AUTHENTICATION FAILURE:"
" invalid Synch Failure: missing AUTS IE\n",
vlr_subscr_name(conn->vsub));
- gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED);
+ msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED);
return -EINVAL;
}
@@ -994,7 +993,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct
" got IE 0x%02x of %u bytes\n",
vlr_subscr_name(conn->vsub),
GSM48_IE_AUTS, auts_tag, auts_len);
- gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED);
+ msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED);
return -EINVAL;
}
@@ -1003,7 +1002,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct
"%s: MM R99 AUTHENTICATION FAILURE:"
" invalid Synch Failure msg: message truncated (%u)\n",
vlr_subscr_name(conn->vsub), msgb_l3len(msg));
- gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED);
+ msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED);
return -EINVAL;
}
diff --git a/openbsc/src/libmsc/iucs.c b/openbsc/src/libmsc/iucs.c
index 0ef09a820..b991cc921 100644
--- a/openbsc/src/libmsc/iucs.c
+++ b/openbsc/src/libmsc/iucs.c
@@ -151,7 +151,7 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg,
" %s from LAC %d to %d\n",
vlr_subscr_name(conn->vsub), conn->lac, *lac);
/* Deallocate conn with previous LAC */
- gsm0408_clear_request(conn, 0);
+ msc_conn_close(conn, GSM_CAUSE_INV_MAND_INFO);
/* At this point we could be tolerant and allocate a new
* connection, but changing the LAC within the same connection
* is shifty. Rather cancel everything. */
diff --git a/openbsc/src/libmsc/osmo_msc.c b/openbsc/src/libmsc/osmo_msc.c
index 3188d927b..034a69fa0 100644
--- a/openbsc/src/libmsc/osmo_msc.c
+++ b/openbsc/src/libmsc/osmo_msc.c
@@ -239,7 +239,11 @@ struct bsc_api *msc_bsc_api() {
return &msc_handler;
}
-void msc_close_connection(struct gsm_subscriber_connection *conn)
+/* Signal the connection's FSM to gracefully terminate the connection by a
+ * SUBSCR_CONN_E_CN_CLOSE event.
+ * \param cause a GSM_CAUSE_* constant, e.g. GSM_CAUSE_AUTH_FAILED.
+ */
+void msc_conn_close(struct gsm_subscriber_connection *conn, uint32_t cause)
{
if (!conn)
return;
@@ -249,7 +253,7 @@ void msc_close_connection(struct gsm_subscriber_connection *conn)
return;
if (conn->conn_fsm->state == SUBSCR_CONN_S_RELEASED)
return;
- osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, NULL);
+ osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, &cause);
}
/* increment the ref-count. Needs to be called by every user */