Change in osmo-bts[master]: clear GPRS indicator in SI3 while PCU is disconnected

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Thu Jul 26 15:03:40 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/10170


Change subject: clear GPRS indicator in SI3 while PCU is disconnected
......................................................................

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 MMs
from trying to register for GPRS while the PCU is disconnected by
erasing the GPRS Indicator in SI3.

Change-Id: I1a6f5c636c0fe098ee31c280d4572a3f8122b44b
Related: OS#3075
---
M src/common/rsl.c
1 file changed, 171 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/70/10170/1

diff --git a/src/common/rsl.c b/src/common/rsl.c
index a24c444..556ecb0 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -285,6 +285,151 @@
  * common channel releated messages
  */
 
+/* Parsed representation of si3 rest octets. */
+struct gsm48_si3_rest {
+	uint8_t				sp;
+	uint8_t				sp_cbq;
+	uint8_t				sp_cro;
+	uint8_t				sp_to;
+	uint8_t				sp_pt;
+	uint8_t				po;
+	uint8_t				po_value;
+	uint8_t				si2ter_ind;
+	uint8_t				ecsm;
+	uint8_t				sched;
+	uint8_t				sched_where;
+	uint8_t				gprs;
+	uint8_t				gprs_ra_colour;
+	uint8_t				gprs_si13_pos;
+	uint8_t				ecmr_3g;
+	uint8_t				si2qter_ind;
+};
+
+/* decode "SI 3 Rest Octets" (10.5.2.34); XXX move to libosmocore? */
+static void gsm48_decode_si3_rest(struct gsm48_si3_rest *s, uint8_t *si,
+	uint8_t len)
+{
+	struct bitvec bv;
+
+	memset(&bv, 0, sizeof(bv));
+	bv.data_len = len;
+	bv.data = si;
+
+	/* Optional Selection Parameters */
+	if (bitvec_get_bit_high(&bv) == H) {
+		s->sp = 1;
+		s->sp_cbq = bitvec_get_uint(&bv, 1);
+		s->sp_cro = bitvec_get_uint(&bv, 6);
+		s->sp_to = bitvec_get_uint(&bv, 3);
+		s->sp_pt = bitvec_get_uint(&bv, 5);
+	} else
+		s->sp = 0;
+	/* Optional Power Offset */
+	if (bitvec_get_bit_high(&bv) == H) {
+		s->po = 1;
+		s->po_value = bitvec_get_uint(&bv, 2);
+	} else
+		s->po = 0;
+	/* System Information 2ter Indicator */
+	if (bitvec_get_bit_high(&bv) == H)
+		s->si2ter_ind = 1;
+	else
+		s->si2ter_ind = 0;
+	/* Early Classmark Sending Control */
+	if (bitvec_get_bit_high(&bv) == H)
+		s->ecsm = 1;
+	else
+		s->ecsm = 0;
+	/* Scheduling if and where */
+	if (bitvec_get_bit_high(&bv) == H) {
+		s->sched = 1;
+		s->sched_where = bitvec_get_uint(&bv, 3);
+	} else
+		s->sched = 0;
+	/* GPRS Indicator */
+	if (bitvec_get_bit_high(&bv) == H) {
+		s->gprs = 1;
+		s->gprs_ra_colour = bitvec_get_uint(&bv, 3);
+		s->gprs_si13_pos = bitvec_get_uint(&bv, 1);
+	} else
+		s->gprs = 0;
+	/* 3G Early Classmark Sending Restriction. If H, then controlled by
+	 * early_cm_ctrl above */
+	if (bitvec_get_bit_high(&bv) == H)
+		s->ecmr_3g = 1;
+	else
+		s->ecmr_3g = 0;
+
+	if (bitvec_get_bit_high(&bv) == H)
+		s->si2qter_ind = 1;
+	else
+		s->si2qter_ind = 0;
+}
+
+/* encode "SI 3 Rest Octets" (10.5.2.34); XXX move to libosmocore? */
+static void gsm48_encode_si3_rest(struct gsm48_si3_rest *s, uint8_t *si,
+	uint8_t len)
+{
+	struct bitvec bv;
+
+	memset(&bv, 0, sizeof(bv));
+	bv.data = si;
+	bv.data_len = len;
+
+	/* Optional Selection Parameters */
+	if (s->sp) {
+		bitvec_set_bit(&bv, H);
+		bitvec_set_bit(&bv, s->sp_cbq);
+		bitvec_set_uint(&bv, s->sp_cro, 6);
+		bitvec_set_uint(&bv, s->sp_to, 3);
+		bitvec_set_uint(&bv, s->sp_pt, 5);
+	} else
+		bitvec_set_bit(&bv, L);
+	/* Optional Power Offset */
+	if (s->po) {
+		bitvec_set_bit(&bv, H);
+		bitvec_set_uint(&bv, s->po_value, 2);
+	} else
+		bitvec_set_bit(&bv, L);
+	/* System Information 2ter Indicator */
+	if (s->si2ter_ind)
+		bitvec_set_bit(&bv, H);
+	else
+		bitvec_set_bit(&bv, L);
+	/* Early Classmark Sending Control */
+	if (s->ecsm)
+		bitvec_set_bit(&bv, H);
+	else
+		bitvec_set_bit(&bv, L);
+	/* Scheduling if and where */
+	if (s->sched) {
+		bitvec_set_bit(&bv, H);
+		bitvec_set_uint(&bv, s->sched_where, 3);
+	} else
+		bitvec_set_bit(&bv, L);
+	/* GPRS Indicator */
+	if (s->gprs) {
+		bitvec_set_bit(&bv, H);
+		bitvec_set_uint(&bv, s->gprs_ra_colour, 3);
+		/* 0 == SI13 in BCCH Norm, 1 == SI13 sent on BCCH Ext */
+		bitvec_set_bit(&bv, s->gprs_si13_pos);
+	} else
+		bitvec_set_bit(&bv, L);
+	/* 3G Early Classmark Sending Restriction. If H, then controlled by
+	 * early_cm_ctrl above */
+	if (s->ecmr_3g)
+		bitvec_set_bit(&bv, L);
+	else
+		bitvec_set_bit(&bv, H);
+
+	if (s->si2qter_ind) {
+		bitvec_set_bit(&bv, H); /* indicator struct present */
+		bitvec_set_uint(&bv, 0, 1); /* message is sent on BCCH Norm */
+	}
+
+	bitvec_spare_padding(&bv, (bv.data_len*8)-1);
+}
+
 /* 8.5.1 BCCH INFOrmation is received */
 static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg)
 {
@@ -356,12 +501,32 @@
 
 		bts->si_valid |= (1 << osmo_si);
 
-		if (SYSINFO_TYPE_3 == osmo_si && trx->nr == 0 &&
-		    num_agch(trx, "RSL") != 1) {
-			lchan_deactivate(&trx->bts->c0->ts[0].lchan[CCCH_LCHAN]);
-			/* will be reactivated by sapi_deactivate_cb() */
-			trx->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
-				LCHAN_REL_ACT_REACT;
+		if (SYSINFO_TYPE_3 == osmo_si) {
+			if (trx->nr == 0 && num_agch(trx, "RSL") != 1) {
+				lchan_deactivate(&trx->bts->c0->ts[0].lchan[CCCH_LCHAN]);
+				/* will be reactivated by sapi_deactivate_cb() */
+				trx->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =
+					LCHAN_REL_ACT_REACT;
+			}
+
+			/* While osmo-pcu is not connected this BTS cannot provide GPRS service.
+			 * The BSC has no knowledge of our PCU connection state, but we want
+			 * to prevent MMs from trying to register for GPRS through this BTS.
+			 * Thus, we erase the GPRS Indicator in SI3 ourselves. See OS#3075. */
+			if (!pcu_connected()) {
+				struct gsm48_system_information_type_3 *si3;
+				size_t rest_octet_len;
+				si3 = (struct gsm48_system_information_type_3 *)GSM_BTS_SI(bts, osmo_si);
+				rest_octet_len = len - offsetof(struct gsm48_system_information_type_3, rest_octets);
+				if (rest_octet_len > 0) {
+					struct gsm48_si3_rest s;
+					gsm48_decode_si3_rest(&s, si3->rest_octets, rest_octet_len);
+					if (s.gprs) {
+						s.gprs = 0;
+						gsm48_encode_si3_rest(&s, si3->rest_octets, rest_octet_len);
+					}
+				}
+			}
 		}
 
 		if (SYSINFO_TYPE_13 == osmo_si)

-- 
To view, visit https://gerrit.osmocom.org/10170
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a6f5c636c0fe098ee31c280d4572a3f8122b44b
Gerrit-Change-Number: 10170
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180726/31d79011/attachment.htm>


More information about the gerrit-log mailing list