aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-10 02:12:32 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-16 15:32:34 +0100
commit525a8ac9d7e78fea1b03a0f9687b83dd63d33c7c (patch)
tree68f36606945f30b84fe06b144c9f406229aa1ded /openbsc
parent78fc746b10755a645d8d1b52bdcca88fa492f32c (diff)
mostly cosmetic: have one msc_conn_close() with cause argument
Diffstat (limited to 'openbsc')
-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 01cae149e..fc70f0e7f 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -202,8 +202,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 */
@@ -802,7 +801,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;
}
@@ -898,7 +897,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;
}
@@ -912,7 +911,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;
}
@@ -937,7 +936,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;
}
@@ -946,7 +945,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;
}
@@ -969,7 +968,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;
}
@@ -986,7 +985,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;
}
@@ -995,7 +994,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 644c55c1c..1267a6e76 100644
--- a/openbsc/src/libmsc/osmo_msc.c
+++ b/openbsc/src/libmsc/osmo_msc.c
@@ -241,7 +241,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;
@@ -251,7 +255,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 */