[bsc_hack] Patch the tables before we setup the rsl
Currently we just patch the MCC, MNC and LAC. Allow to change
the siX packages by removing the const.
diff --git a/src/bsc_hack.c b/src/bsc_hack.c
index 1f454e4..145b552 100644
--- a/src/bsc_hack.c
+++ b/src/bsc_hack.c
@@ -358,7 +358,7 @@
call reestablishment not allowed
Access Control Class = 0000
*/
-static const u_int8_t si1[] = {
+static u_int8_t si1[] = {
/* header */0x55, 0x06, 0x19,
/* ccdesc */0x04 /*0x00*/, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*0x01*/,
@@ -381,7 +381,7 @@
call reestablishment not allowed
Access Control Class = 0000
*/
-static const u_int8_t si2[] = {
+static u_int8_t si2[] = {
/* header */0x59, 0x06, 0x1A,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -427,7 +427,7 @@
Early Classmark Sending Control (ECSC): 0 = forbidden
Scheduling Information is not sent in SYSTEM INFORMATION TYPE 9 on the BCCH
*/
-unsigned char si3[] = {
+static u_int8_t si3[] = {
/* header */0x49, 0x06, 0x1B,
/* cell */0x00, 0x01,
/* lai */0x00, 0xF1, 0x10, 0x00, 0x01,
@@ -467,7 +467,7 @@
Temporary Offset = 0 dB
Penalty Time = 20 s
*/
-static const u_int8_t si4[] = {
+static u_int8_t si4[] = {
/* header */0x41, 0x06, 0x1C,
/* lai */0x00, 0xF1, 0x10, 0x00, 0x01,
/* sel */0x62, 0x00,
@@ -485,7 +485,7 @@
CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
-static const u_int8_t si5[] = {
+static u_int8_t si5[] = {
/* header without l2 len*/0x06, 0x1D,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -511,7 +511,7 @@
NCC permitted (NCC) = FF
*/
-static const u_int8_t si6[] = {
+static u_int8_t si6[] = {
/* header */0x06, 0x1E,
/* cell id*/ 0x00, 0x01,
/* lai */ 0x00, 0xF1, 0x10, 0x00, 0x01,
@@ -573,9 +573,34 @@
rsl_chan_activate_tch_f(&trx->ts[i]);
}
+/*
+ * Patch the various SYSTEM INFORMATION tables to update
+ * the LAI
+ */
+static void patch_tables(struct gsm_bts *bts)
+{
+ /* covert the raw packet to the struct */
+ struct gsm48_system_information_type_3 *type_3 =
+ (struct gsm48_system_information_type_3*)&si3;
+ struct gsm48_system_information_type_4 *type_4 =
+ (struct gsm48_system_information_type_4*)&si4;
+ struct gsm48_system_information_type_6 *type_6 =
+ (struct gsm48_system_information_type_6*)&si6;
+
+ /* assign the MCC and MNC */
+ gsm0408_generate_lai(&type_3->lai, bts->network->country_code,
+ bts->network->network_code, bts->location_area_code);
+ gsm0408_generate_lai(&type_4->lai, bts->network->country_code,
+ bts->network->network_code, bts->location_area_code);
+ gsm0408_generate_lai(&type_6->lai, bts->network->country_code,
+ bts->network->network_code, bts->location_area_code);
+}
+
+
static void bootstrap_rsl(struct gsm_bts *bts)
{
fprintf(stdout, "bootstrapping RSL\n");
+ patch_tables(bts);
set_system_infos(bts);
/* FIXME: defer this until the channels are used */
@@ -597,14 +622,6 @@
}
}
-/*
- * Patch the various SYSTEM INFORMATION tables to update
- * the LAI
- */
-static void patch_tables(void)
-{
-}
-
static int bootstrap_network(void)
{
struct gsm_bts *bts;
@@ -766,7 +783,6 @@
}
printf("DB: Database prepared.\n");
- patch_tables();
bootstrap_network();
pag_timer.cb = pag_timer_cb;