aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-07-29 18:44:39 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-07-29 18:44:39 +0800
commitc94b9c4eb4ab6a5165a325d8f250d93da29df6d9 (patch)
treeffeaa62ec3fbd1d0372e9feda42e20cbcc6af837
parentb5fa05ff416fc7244f6a22b2b0d62890fdea3184 (diff)
bsc_grace: Add a new per network check to decide if new connections are allowed
In case of an ordered RF shutdown we can enter a grace period where no new RF connections are allowed but active connections will stay alive until the RF is switched off.
-rw-r--r--openbsc/include/openbsc/Makefile.am3
-rw-r--r--openbsc/include/openbsc/bsc_msc_grace.h29
-rw-r--r--openbsc/src/Makefile.am2
-rw-r--r--openbsc/src/bsc_msc_grace.c27
-rw-r--r--openbsc/src/bsc_msc_ip.c6
-rw-r--r--openbsc/src/bssap.c3
6 files changed, 67 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index e4d1107c1..fdf2f42c7 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -6,7 +6,8 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
bsc_rll.h mncc.h transaction.h ussd.h gsm_04_80.h \
silent_call.h mgcp.h meas_rep.h rest_octets.h \
system_information.h handover.h mgcp_internal.h \
- vty.h bssap.h bsc_msc.h bsc_nat.h bsc_msc_rf.h
+ vty.h bssap.h bsc_msc.h bsc_nat.h bsc_msc_rf.h \
+ bsc_msc_grace.h
openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
openbscdir = $(includedir)/openbsc
diff --git a/openbsc/include/openbsc/bsc_msc_grace.h b/openbsc/include/openbsc/bsc_msc_grace.h
new file mode 100644
index 000000000..31a092533
--- /dev/null
+++ b/openbsc/include/openbsc/bsc_msc_grace.h
@@ -0,0 +1,29 @@
+/*
+ * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010 by On-Waves
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef BSC_MSC_GRACE_H
+#define BSC_MSC_GRACE_H
+
+#include "gsm_data.h"
+
+int bsc_grace_allow_new_connection(struct gsm_network *network);
+
+#endif
diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am
index d4c37b8c1..3c4d9f3ba 100644
--- a/openbsc/src/Makefile.am
+++ b/openbsc/src/Makefile.am
@@ -35,7 +35,7 @@ bsc_hack_LDADD = libmsc.a libbsc.a libmsc.a libvty.a -ldl -ldbi $(LIBCRYPT)
bs11_config_SOURCES = bs11_config.c abis_nm.c gsm_data.c debug.c \
rs232.c bts_siemens_bs11.c
bsc_msc_ip_SOURCES = bssap.c bsc_msc_ip.c bsc_init.c vty_interface.c vty_interface_bsc.c \
- bsc_msc.c bsc_msc_rf.c
+ bsc_msc.c bsc_msc_rf.c bsc_msc_grace.c
bsc_msc_ip_LDADD = libbsc.a libvty.a libsccp.a
diff --git a/openbsc/src/bsc_msc_grace.c b/openbsc/src/bsc_msc_grace.c
new file mode 100644
index 000000000..20b9c3206
--- /dev/null
+++ b/openbsc/src/bsc_msc_grace.c
@@ -0,0 +1,27 @@
+/*
+ * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010 by On-Waves
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <openbsc/bsc_msc_grace.h>
+
+int bsc_grace_allow_new_connection(struct gsm_network *network)
+{
+ return 1;
+}
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index 36381add7..30b07b541 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -46,6 +46,7 @@
#include <openbsc/bsc_msc.h>
#include <openbsc/bsc_nat.h>
#include <openbsc/bsc_msc_rf.h>
+#include <openbsc/bsc_msc_grace.h>
#include <osmocore/select.h>
#include <osmocore/talloc.h>
@@ -294,6 +295,11 @@ static int open_sccp_connection(struct msgb *layer3)
return -1;
}
+ if (!bsc_grace_allow_new_connection(bsc_gsmnet)) {
+ LOGP(DMSC, LOGL_NOTICE, "BSC in grace period. No new connections.\n");
+ return -1;
+ }
+
LOGP(DMSC, LOGL_DEBUG, "Opening new layer3 connection\n");
sccp_connection = sccp_connection_socket();
if (!sccp_connection) {
diff --git a/openbsc/src/bssap.c b/openbsc/src/bssap.c
index 1e53e99bb..43b7f2880 100644
--- a/openbsc/src/bssap.c
+++ b/openbsc/src/bssap.c
@@ -622,7 +622,8 @@ int bssmap_rcvmsg_udt(struct gsm_network *net, struct msgb *msg, unsigned int le
ret = bssmap_handle_reset_ack(net, msg, length);
break;
case BSS_MAP_MSG_PAGING:
- ret = bssmap_handle_paging(net, msg, length);
+ if (bsc_grace_allow_new_connection(net))
+ ret = bssmap_handle_paging(net, msg, length);
break;
}