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.
This commit is contained in:
Holger Hans Peter Freyther
2010-07-29 18:44:39 +08:00
parent b5fa05ff41
commit c94b9c4eb4
6 changed files with 67 additions and 3 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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;
}