aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/sysinfo.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-05-28 18:06:21 +0200
committerHarald Welte <laforge@gnumonks.org>2019-05-28 19:59:07 +0200
commit1e96e31c106aed9192ed9ea78ff1a711464390d7 (patch)
tree26b8f5f2eca56890c92ab70a6c1b8c9456aceb7a /src/common/sysinfo.c
parent347fea69a0b97441eaebca488b55d1ff1f539619 (diff)
clear GPRS indicator in SI3 while PCU is disconnected
osmo-bts cannot provide GPRS service while osmo-pcu is not connected. The BSC has no knowledge of the PCU connection state. Prevent MSs from trying to register for GPRS while the PCU is disconnected by erasing the GPRS Indicator in SI3. Change-Id: I1a6f5c636c0fe098ee31c280d4572a3f8122b44b Depends: I690cf308311f910005a325d50f5d5d825678d2b2 (libosmocore.git) Depends: I08e0ca9a8d13c7aa40b9d90f34f0e13adb87d4e0 (libosmocore.git) Depends: I8b1ee2405f6338507e9dfb5f1f437c4c2db2e330 (libosmocore.git) Related: OS#3075
Diffstat (limited to 'src/common/sysinfo.c')
-rw-r--r--src/common/sysinfo.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index e4a05c87..c41f9d6e 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -1,4 +1,4 @@
-/* (C) 2011 by Harald Welte <laforge@gnumonks.org>
+/* (C) 2011-2019 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
*
@@ -24,6 +24,7 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/gsm_data.h>
+#include <osmo-bts/pcu_if.h>
/* properly increment SI2q index and return SI2q data for scheduling */
static inline uint8_t *get_si2q_inc_index(struct gsm_bts *bts)
@@ -175,3 +176,36 @@ uint8_t *lchan_sacch_get(struct gsm_lchan *lchan)
LOGPLCHAN(lchan, DL1P, LOGL_NOTICE, "SACCH no SI available\n");
return NULL;
}
+
+/* re-generate SI3 restoctets with GPRS indicator depending on the PCU socket connection state */
+void regenerate_si3_restoctets(struct gsm_bts *bts)
+{
+ uint8_t *si3_buf = GSM_BTS_SI(bts, SYSINFO_TYPE_3);
+ size_t si3_size = offsetof(struct gsm48_system_information_type_3, rest_octets);
+ struct osmo_gsm48_si_ro_info si3ro_tmp;
+
+ /* If BSC has never set SI3, there's nothing to patch */
+ if (!GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_3))
+ return;
+
+ /* If SI3 from BSC doesn't have a GPRS indicator, we won't have anything to patch */
+ if (!bts->si3_ro_decoded.gprs_ind.present)
+ return;
+
+ /* Create a temporary copy and patch that, if no PCU is around */
+ si3ro_tmp = bts->si3_ro_decoded;
+ if (!pcu_connected()) {
+ if (!bts->si3_gprs_ind_disabled)
+ LOGP(DPCU, LOGL_NOTICE, "Disabling GPRS Indicator in SI3 (No PCU connected)\n");
+ bts->si3_gprs_ind_disabled = true;
+ si3ro_tmp.gprs_ind.present = 0;
+ } else {
+ if (bts->si3_gprs_ind_disabled)
+ LOGP(DPCU, LOGL_NOTICE, "Enabling GPRS Indicator in SI3 (PCU connected)\n");
+ bts->si3_gprs_ind_disabled = false;
+ si3ro_tmp.gprs_ind.present = 1; /* is a no-op as we copy from bts->si3_ro_decoded */
+ }
+
+ /* re-generate the binary SI3 rest octets */
+ osmo_gsm48_rest_octets_si3_encode(si3_buf + si3_size, &si3ro_tmp);
+}