aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-06-06 14:31:36 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-18 17:50:08 +0200
commit8b0d8a97fb5cddb718c0b35af02bbcfe4599bdc5 (patch)
treed81ce0f11db4ae55542fd702132f3b89c4b3cef8 /openbsc/include
parentfabe468dd47ffd72a3ff2b6387422d304b178665 (diff)
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
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/Makefile.am1
-rw-r--r--openbsc/include/openbsc/bsc_msc.h4
-rw-r--r--openbsc/include/openbsc/bsc_msc_data.h1
-rw-r--r--openbsc/include/openbsc/osmo_bsc_reset.h34
-rw-r--r--openbsc/include/openbsc/osmo_bsc_sigtran.h8
5 files changed, 47 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index be7595877..e1ae6d2d8 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/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/openbsc/include/openbsc/bsc_msc.h b/openbsc/include/openbsc/bsc_msc.h
index 8b9553bfa..1b1c2d8f4 100644
--- a/openbsc/include/openbsc/bsc_msc.h
+++ b/openbsc/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/openbsc/include/openbsc/bsc_msc_data.h b/openbsc/include/openbsc/bsc_msc_data.h
index a819abab3..0d7ec224d 100644
--- a/openbsc/include/openbsc/bsc_msc_data.h
+++ b/openbsc/include/openbsc/bsc_msc_data.h
@@ -38,6 +38,7 @@
#include <osmocom/sigtran/sccp_helpers.h>
#include <osmocom/sigtran/protocol/sua.h>
#include <osmocom/sigtran/protocol/m3ua.h>
+#include <osmocom/core/fsm.h>
#include <regex.h>
diff --git a/openbsc/include/openbsc/osmo_bsc_reset.h b/openbsc/include/openbsc/osmo_bsc_reset.h
new file mode 100644
index 000000000..578f763e6
--- /dev/null
+++ b/openbsc/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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/* 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/openbsc/include/openbsc/osmo_bsc_sigtran.h b/openbsc/include/openbsc/osmo_bsc_sigtran.h
index 37085b653..c57783dc8 100644
--- a/openbsc/include/openbsc/osmo_bsc_sigtran.h
+++ b/openbsc/include/openbsc/osmo_bsc_sigtran.h
@@ -20,6 +20,8 @@
#pragma once
+#include <openbsc/bsc_msc_data.h>
+
/* 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);