From 88e9ecbfb5e8c8f0438bf6569975ebd407a0fb2f Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Tue, 6 Jun 2017 14:31:36 +0200 Subject: osmo-bsc: Handle RESET/RESET-ACK properly Improve the way the BSC executes its RESET/RESET-ACK sequence. Currently only a simple bool variable serves as a state holder. We set this variable to true when we receive the RESET-ACK message. Unfortunately no further checking is done. This patch replaces the old mechanism with a more elaborated implementation which also detects a loss of the connection and makes sure to reconnect properly afterwards. Also the all open connections are closed on connection loss Change-Id: I876319b15103cc395e74597a52ce4d1a934915f4 --- include/openbsc/Makefile.am | 1 + include/openbsc/bsc_msc.h | 4 +++- include/openbsc/bsc_msc_data.h | 1 + include/openbsc/osmo_bsc_reset.h | 34 ++++++++++++++++++++++++++++++++++ include/openbsc/osmo_bsc_sigtran.h | 8 ++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 include/openbsc/osmo_bsc_reset.h (limited to 'include') diff --git a/include/openbsc/Makefile.am b/include/openbsc/Makefile.am index 094ee5b63..b33bdee02 100644 --- a/include/openbsc/Makefile.am +++ b/include/openbsc/Makefile.am @@ -67,6 +67,7 @@ noinst_HEADERS = \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ + osmo_bsc_reset.h \ osmo_bsc_rf.h \ osmo_msc.h \ osmo_bsc_sigtran.h \ diff --git a/include/openbsc/bsc_msc.h b/include/openbsc/bsc_msc.h index 8b9553bfa..1b1c2d8f4 100644 --- a/include/openbsc/bsc_msc.h +++ b/include/openbsc/bsc_msc.h @@ -61,7 +61,9 @@ struct bsc_msc_connection { struct osmo_sccp_addr g_calling_addr; struct osmo_sccp_addr g_called_addr; struct osmo_timer_list msc_reset_timer; - bool reset_ack; + struct osmo_fsm_inst *fsm_reset; + unsigned int msc_conn_loss_count; + int conn_id_counter; }; diff --git a/include/openbsc/bsc_msc_data.h b/include/openbsc/bsc_msc_data.h index a819abab3..0d7ec224d 100644 --- a/include/openbsc/bsc_msc_data.h +++ b/include/openbsc/bsc_msc_data.h @@ -38,6 +38,7 @@ #include #include #include +#include #include diff --git a/include/openbsc/osmo_bsc_reset.h b/include/openbsc/osmo_bsc_reset.h new file mode 100644 index 000000000..578f763e6 --- /dev/null +++ b/include/openbsc/osmo_bsc_reset.h @@ -0,0 +1,34 @@ +/* (C) 2017 by sysmocom s.f.m.c. GmbH + * All Rights Reserved + * + * Author: Philipp Maier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +/* Create and start state machine which handles the reset/reset-ack procedure */ +void start_reset_fsm(struct bsc_msc_data *msc); + +/* Confirm that we sucessfully received a reset acknowlege message */ +void reset_ack_confirm(struct bsc_msc_data *msc); + +/* Report a failed connection */ +void report_conn_fail(struct bsc_msc_data *msc); + +/* Report a successful connection */ +void report_conn_success(struct bsc_msc_data *msc); + +/* Check if we have a connection to a specified msc */ +bool sccp_conn_ready(struct bsc_msc_data *msc); diff --git a/include/openbsc/osmo_bsc_sigtran.h b/include/openbsc/osmo_bsc_sigtran.h index 37085b653..c57783dc8 100644 --- a/include/openbsc/osmo_bsc_sigtran.h +++ b/include/openbsc/osmo_bsc_sigtran.h @@ -20,6 +20,8 @@ #pragma once +#include + /* Allocate resources to make a new connection oriented sigtran connection * (not the connection ittself!) */ enum bsc_con osmo_bsc_sigtran_new_conn(struct gsm_subscriber_connection *conn, struct bsc_msc_data *msc); @@ -35,5 +37,11 @@ int osmo_bsc_sigtran_send(struct osmo_bsc_sccp_con *conn, struct msgb *msg); * locally, when a connection is closed by the MSC */ int osmo_bsc_sigtran_del_conn(struct osmo_bsc_sccp_con *sccp); +/* Send reset to MSC */ +void osmo_bsc_sigtran_tx_reset(struct bsc_msc_data *msc); + +/* close all open connections */ +void osmo_bsc_sigtran_reset(struct bsc_msc_data *msc); + /* Initalize osmo sigtran backhaul */ int osmo_bsc_sigtran_init(struct llist_head *mscs); -- cgit v1.2.3