diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2017-06-12 19:09:43 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-07-12 23:42:46 +0200 |
commit | 15cc54e85c114c9063e9ca2fda2d6f7c1ea2370a (patch) | |
tree | 73bd70b1445412ac488ee9776471a0cecc5f7e23 | |
parent | ac1f2a0817310addc35a7a2af930622209d6c826 (diff) |
osmo-bsc: react on reset requests from MSC
The bsc side currently can not receive reset commands from an
MSC. This patch adds required functionality to receive a reset
command and acknowlege it properly. The effects are the same
as with when sending resets (all drop all ongoing calls and
sccp connections)
Change-Id: I44c7e54c845948c54614b36d97d2ba1e760ac46b
-rw-r--r-- | include/openbsc/osmo_bsc_sigtran.h | 6 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 21 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_sigtran.c | 27 |
3 files changed, 49 insertions, 5 deletions
diff --git a/include/openbsc/osmo_bsc_sigtran.h b/include/openbsc/osmo_bsc_sigtran.h index caeea6092..afdceeb37 100644 --- a/include/openbsc/osmo_bsc_sigtran.h +++ b/include/openbsc/osmo_bsc_sigtran.h @@ -40,3 +40,9 @@ int osmo_bsc_sigtran_del_conn(struct osmo_bsc_sccp_con *sccp); /* Initalize osmo sigtran backhaul */ int osmo_bsc_sigtran_init(struct llist_head *mscs); + +/* Close all open sigtran connections and channels */ +void osmo_bsc_sigtran_reset(struct bsc_msc_data *msc); + +/* Send reset-ack to MSC */ +void osmo_bsc_sigtran_tx_reset_ack(struct bsc_msc_data *msc); diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index f08811498..afa81b0e5 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -203,6 +203,24 @@ static int bssmap_handle_reset_ack(struct bsc_msc_data *msc, return 0; } +/* Handle MSC sided reset */ +static int bssmap_handle_reset(struct bsc_msc_data *msc, + struct msgb *msg, unsigned int length) +{ + LOGP(DMSC, LOGL_NOTICE, "Reset from MSC No.: %i\n", msc->nr); + + /* Instruct the bsc to close all open sigtran connections and to + * close all active channels on the BTS side as well */ + osmo_bsc_sigtran_reset(msc); + + /* Inform the MSC that we have received the reset request and + * that we acted accordingly */ + osmo_bsc_sigtran_tx_reset_ack(msc); + + return 0; +} + + /* GSM 08.08 ยง 3.2.1.19 */ static int bssmap_handle_paging(struct bsc_msc_data *msc, struct msgb *msg, unsigned int payload_length) @@ -553,6 +571,9 @@ static int bssmap_rcvmsg_udt(struct bsc_msc_data *msc, case BSS_MAP_MSG_RESET_ACKNOWLEDGE: ret = bssmap_handle_reset_ack(msc, msg, length); break; + case BSS_MAP_MSG_RESET: + ret = bssmap_handle_reset(msc, msg, length); + break; case BSS_MAP_MSG_PAGING: ret = bssmap_handle_paging(msc, msg, length); break; diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index 7afe71ee3..80dac828d 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -85,6 +85,17 @@ static void osmo_bsc_sigtran_tx_reset(struct bsc_msc_data *msc) &msc->msc_con->g_called_addr, msg); } +/* Send reset-ack to MSC */ +void osmo_bsc_sigtran_tx_reset_ack(struct bsc_msc_data *msc) +{ + struct msgb *msg; + LOGP(DMSC, LOGL_NOTICE, "Sending RESET RACK to MSC No.: %i\n", msc->nr); + msg = gsm0808_create_reset_ack(); + osmo_sccp_tx_unitdata_msg(msc->msc_con->sccp_user, &msc->msc_con->g_calling_addr, + &msc->msc_con->g_called_addr, msg); +} + + /* Find an MSC by its sigtran point code */ static struct bsc_msc_data *get_msc_by_addr(struct osmo_sccp_addr *calling_addr) { @@ -347,14 +358,11 @@ static void bsc_notify_msc_lost(struct osmo_bsc_sccp_con *con) bsc_send_ussd_release_complete(conn); } - -/* Callback function: Close all open connections */ -static void osmo_bsc_sigtran_reset_cb(void *priv) +/* Close all open sigtran connections and channels */ +void osmo_bsc_sigtran_reset(struct bsc_msc_data *msc) { struct osmo_bsc_sccp_con *conn; struct osmo_bsc_sccp_con *conn_temp; - struct bsc_msc_data *msc = (struct bsc_msc_data*) priv; - OSMO_ASSERT(msc); /* Close all open connections */ @@ -365,6 +373,15 @@ static void osmo_bsc_sigtran_reset_cb(void *priv) osmo_bsc_sigtran_del_conn(conn); } msc->msc_con->conn_id_counter = 0; +} + +/* Callback function: Close all open connections */ +static void osmo_bsc_sigtran_reset_cb(void *priv) +{ + struct bsc_msc_data *msc = (struct bsc_msc_data*) priv; + + /* Shut down all ongoint traffic */ + osmo_bsc_sigtran_reset(msc); /* Send reset to MSC */ osmo_bsc_sigtran_tx_reset(msc); |