blob: 5f845136ca4a60c647d1e3041d92ac6106c4afc0 [file] [log] [blame]
Harald Welte52b1f982008-12-23 20:25:15 +00001/* A hackish minimal BSC (+MSC +HLR) implementation */
2
Harald Welte32201c12009-03-10 12:15:10 +00003/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
Holger Freyther219518d2009-01-02 22:04:43 +00004 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
Harald Welte52b1f982008-12-23 20:25:15 +00005 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
Harald Weltef6b7a902008-12-26 00:05:11 +000023#include <unistd.h>
24#include <stdlib.h>
25#include <stdio.h>
26#include <stdarg.h>
27#include <time.h>
28#include <string.h>
Harald Weltead384642008-12-26 10:20:07 +000029#include <errno.h>
Harald Welted1252502009-01-01 01:50:32 +000030#include <signal.h>
Holger Freyther9a3ee0f2009-01-02 00:40:15 +000031#include <fcntl.h>
32#include <sys/stat.h>
Harald Welte52b1f982008-12-23 20:25:15 +000033
Holger Freytherb332f612008-12-27 12:46:51 +000034#define _GNU_SOURCE
35#include <getopt.h>
36
Harald Welte255539c2008-12-28 02:26:27 +000037#include <openbsc/db.h>
38#include <openbsc/timer.h>
Harald Welte8470bf22008-12-25 23:28:35 +000039#include <openbsc/gsm_data.h>
Harald Welte66b6a8d2009-08-09 14:45:18 +020040#include <openbsc/gsm_utils.h>
Harald Welte255539c2008-12-28 02:26:27 +000041#include <openbsc/gsm_04_08.h>
Harald Weltead384642008-12-26 10:20:07 +000042#include <openbsc/select.h>
Harald Welte8470bf22008-12-25 23:28:35 +000043#include <openbsc/abis_rsl.h>
44#include <openbsc/abis_nm.h>
Harald Welte702d8702008-12-26 20:25:35 +000045#include <openbsc/debug.h>
Holger Freyther5677ae32008-12-27 09:41:03 +000046#include <openbsc/misdn.h>
Holger Freyther219518d2009-01-02 22:04:43 +000047#include <openbsc/telnet_interface.h>
Harald Welte38c2f132009-01-06 23:10:57 +000048#include <openbsc/paging.h>
Harald Welte1fa60c82009-02-09 18:13:26 +000049#include <openbsc/e1_input.h>
Harald Welteb4630602009-05-01 15:43:22 +000050#include <openbsc/signal.h>
Harald Welte2cf161b2009-06-20 22:36:41 +020051#include <openbsc/talloc.h>
52
Harald Welte52b1f982008-12-23 20:25:15 +000053/* global pointer to the gsm network data structure */
Harald Welte879c85a2009-05-01 15:00:20 +000054static struct gsm_network *gsmnet;
Harald Welte52b1f982008-12-23 20:25:15 +000055
Holger Freytherefde7fb2008-12-28 14:14:56 +000056/* MCC and MNC for the Location Area Identifier */
57static int MCC = 1;
58static int MNC = 1;
Holger Freytherdda22c12009-04-22 22:07:31 +000059static int cardnr = 0;
Holger Freytherb5c00f52009-04-22 22:08:07 +000060static int release_l2 = 0;
Harald Welte8c1d0e42009-02-15 03:38:12 +000061static enum gsm_bts_type BTS_TYPE = GSM_BTS_TYPE_BS11;
Holger Freytherbde36102008-12-28 22:51:39 +000062static const char *database_name = "hlr.sqlite3";
Holger Hans Peter Freytherd5d1cef2009-08-10 08:39:27 +020063static const char *config_file = "openbsc.cfg";
Harald Welte805f6442009-07-28 18:25:29 +020064extern int ipacc_rtp_direct;
Holger Freytherefde7fb2008-12-28 14:14:56 +000065
Harald Welte000c0f42009-08-12 21:45:02 +020066static void patch_nm_tables(struct gsm_bts *bts);
67static void patch_si_tables(struct gsm_bts *bts);
Holger Hans Peter Freyther03582a82009-07-16 15:24:27 +020068
Harald Welte52b1f982008-12-23 20:25:15 +000069/* The following definitions are for OM and NM packets that we cannot yet
70 * generate by code but we just pass on */
71
72// BTS Site Manager, SET ATTRIBUTES
73
74/*
75 Object Class: BTS Site Manager
76 Instance 1: FF
77 Instance 2: FF
78 Instance 3: FF
79SET ATTRIBUTES
80 sAbisExternalTime: 2007/09/08 14:36:11
81 omLAPDRelTimer: 30sec
82 shortLAPDIntTimer: 5sec
83 emergencyTimer1: 10 minutes
84 emergencyTimer2: 0 minutes
85*/
86
87unsigned char msg_1[] =
88{
Harald Weltea865f1b2009-06-20 10:42:17 +020089 NM_MT_BS11_SET_ATTR, NM_OC_SITE_MANAGER, 0xFF, 0xFF, 0xFF,
Harald Welte110c0ab2009-05-23 16:27:05 +000090 NM_ATT_BS11_ABIS_EXT_TIME, 0x07,
91 0xD7, 0x09, 0x08, 0x0E, 0x24, 0x0B, 0xCE,
92 0x02,
93 0x00, 0x1E,
94 NM_ATT_BS11_SH_LAPD_INT_TIMER,
95 0x01, 0x05,
Harald Weltecd993872009-02-15 16:16:28 +000096 0x42, 0x02, 0x00, 0x0A,
97 0x44, 0x02, 0x00, 0x00
Harald Welte52b1f982008-12-23 20:25:15 +000098};
99
100// BTS, SET BTS ATTRIBUTES
101
102/*
103 Object Class: BTS
104 BTS relat. Number: 0
105 Instance 2: FF
106 Instance 3: FF
107SET BTS ATTRIBUTES
108 bsIdentityCode / BSIC:
109 PLMN_colour_code: 7h
110 BS_colour_code: 7h
111 BTS Air Timer T3105: 4 ,unit 10 ms
112 btsIsHopping: FALSE
Harald Welte83282292009-02-01 16:22:19 +0000113 periodCCCHLoadIndication: 1sec
Holger Freyther3b910432009-02-11 00:43:48 +0000114 thresholdCCCHLoadIndication: 0%
Harald Welte52b1f982008-12-23 20:25:15 +0000115 cellAllocationNumber: 00h = GSM 900
116 enableInterferenceClass: 00h = Disabled
117 fACCHQual: 6 (FACCH stealing flags minus 1)
118 intaveParameter: 31 SACCH multiframes
119 interferenceLevelBoundaries:
120 Interference Boundary 1: 0Ah
121 Interference Boundary 2: 0Fh
122 Interference Boundary 3: 14h
123 Interference Boundary 4: 19h
124 Interference Boundary 5: 1Eh
125 mSTxPwrMax: 11
126 GSM range: 2=39dBm, 15=13dBm, stepsize 2 dBm
127 DCS1800 range: 0=30dBm, 15=0dBm, stepsize 2 dBm
128 PCS1900 range: 0=30dBm, 15=0dBm, stepsize 2 dBm
129 30=33dBm, 31=32dBm
130 ny1:
131 Maximum number of repetitions for PHYSICAL INFORMATION message (GSM 04.08): 20
132 powerOutputThresholds:
133 Out Power Fault Threshold: -10 dB
134 Red Out Power Threshold: - 6 dB
135 Excessive Out Power Threshold: 5 dB
136 rACHBusyThreshold: -127 dBm
137 rACHLoadAveragingSlots: 250 ,number of RACH burst periods
138 rfResourceIndicationPeriod: 125 SACCH multiframes
139 T200:
140 SDCCH: 044 in 5 ms
141 FACCH/Full rate: 031 in 5 ms
142 FACCH/Half rate: 041 in 5 ms
143 SACCH with TCH SAPI0: 090 in 10 ms
144 SACCH with SDCCH: 090 in 10 ms
145 SDCCH with SAPI3: 090 in 5 ms
146 SACCH with TCH SAPI3: 135 in 10 ms
147 tSync: 9000 units of 10 msec
148 tTrau: 9000 units of 10 msec
149 enableUmLoopTest: 00h = disabled
150 enableExcessiveDistance: 00h = Disabled
151 excessiveDistance: 64km
152 hoppingMode: 00h = baseband hopping
153 cellType: 00h = Standard Cell
154 BCCH ARFCN / bCCHFrequency: 1
155*/
156
Harald Weltea865f1b2009-06-20 10:42:17 +0200157static unsigned char bs11_attr_bts[] =
Harald Welte52b1f982008-12-23 20:25:15 +0000158{
Harald Welte060f6df2009-05-23 17:50:53 +0000159 NM_ATT_BSIC, HARDCODED_BSIC,
Harald Welte8c1d0e42009-02-15 03:38:12 +0000160 NM_ATT_BTS_AIR_TIMER, 0x04,
Harald Weltecd993872009-02-15 16:16:28 +0000161 NM_ATT_BS11_BTSLS_HOPPING, 0x00,
Harald Welte8c1d0e42009-02-15 03:38:12 +0000162 NM_ATT_CCCH_L_I_P, 0x01,
163 NM_ATT_CCCH_L_T, 0x00,
Harald Welte7b26bcb2009-05-28 11:39:21 +0000164 NM_ATT_BS11_CELL_ALLOC_NR, NM_BS11_CANR_GSM,
165 NM_ATT_BS11_ENA_INTERF_CLASS, 0x01,
Harald Weltecd993872009-02-15 16:16:28 +0000166 NM_ATT_BS11_FACCH_QUAL, 0x06,
Harald Weltefe609d82009-05-23 18:14:31 +0000167 /* interference avg. period in numbers of SACCH multifr */
Harald Welte8c1d0e42009-02-15 03:38:12 +0000168 NM_ATT_INTAVE_PARAM, 0x1F,
169 NM_ATT_INTERF_BOUND, 0x0A, 0x0F, 0x14, 0x19, 0x1E, 0x7B,
170 NM_ATT_CCCH_L_T, 0x23,
171 NM_ATT_GSM_TIME, 0x28, 0x00,
172 NM_ATT_ADM_STATE, 0x03,
173 NM_ATT_RACH_B_THRESH, 0x7F,
174 NM_ATT_LDAVG_SLOTS, 0x00, 0xFA,
Harald Weltecd993872009-02-15 16:16:28 +0000175 NM_ATT_BS11_RF_RES_IND_PER, 0x7D,
Harald Welte8c1d0e42009-02-15 03:38:12 +0000176 NM_ATT_T200, 0x2C, 0x1F, 0x29, 0x5A, 0x5A, 0x5A, 0x87,
Harald Weltecd993872009-02-15 16:16:28 +0000177 NM_ATT_BS11_TSYNC, 0x23, 0x28,
178 NM_ATT_BS11_TTRAU, 0x23, 0x28,
179 NM_ATT_TEST_DUR, 0x01, 0x00,
180 NM_ATT_OUTST_ALARM, 0x01, 0x00,
181 NM_ATT_BS11_EXCESSIVE_DISTANCE, 0x01, 0x40,
182 NM_ATT_BS11_HOPPING_MODE, 0x01, 0x00,
183 NM_ATT_BS11_PLL, 0x01, 0x00,
Harald Welte8c1d0e42009-02-15 03:38:12 +0000184 NM_ATT_BCCH_ARFCN, 0x00, HARDCODED_ARFCN/*0x01*/,
Harald Welte52b1f982008-12-23 20:25:15 +0000185};
186
187// Handover Recognition, SET ATTRIBUTES
188
189/*
190Illegal Contents GSM Formatted O&M Msg
191 Object Class: Handover Recognition
192 BTS relat. Number: 0
193 Instance 2: FF
194 Instance 3: FF
195SET ATTRIBUTES
196 enableDelayPowerBudgetHO: 00h = Disabled
197 enableDistanceHO: 00h = Disabled
198 enableInternalInterCellHandover: 00h = Disabled
199 enableInternalIntraCellHandover: 00h = Disabled
200 enablePowerBudgetHO: 00h = Disabled
201 enableRXLEVHO: 00h = Disabled
202 enableRXQUALHO: 00h = Disabled
203 hoAveragingDistance: 8 SACCH multiframes
204 hoAveragingLev:
205 A_LEV_HO: 8 SACCH multiframes
206 W_LEV_HO: 1 SACCH multiframes
207 hoAveragingPowerBudget: 16 SACCH multiframes
208 hoAveragingQual:
209 A_QUAL_HO: 8 SACCH multiframes
210 W_QUAL_HO: 2 SACCH multiframes
211 hoLowerThresholdLevDL: (10 - 110) dBm
212 hoLowerThresholdLevUL: (5 - 110) dBm
213 hoLowerThresholdQualDL: 06h = 6.4% < BER < 12.8%
214 hoLowerThresholdQualUL: 06h = 6.4% < BER < 12.8%
215 hoThresholdLevDLintra : (20 - 110) dBm
216 hoThresholdLevULintra: (20 - 110) dBm
217 hoThresholdMsRangeMax: 20 km
218 nCell: 06h
219 timerHORequest: 3 ,unit 2 SACCH multiframes
220*/
221
222unsigned char msg_3[] =
223{
Harald Weltea865f1b2009-06-20 10:42:17 +0200224 NM_MT_BS11_SET_ATTR, NM_OC_BS11_HANDOVER, 0x00, 0xFF, 0xFF,
Harald Welte56554712009-07-18 16:18:11 +0200225 0xD0, 0x00, /* enableDelayPowerBudgetHO */
226 0x64, 0x00, /* enableDistanceHO */
227 0x67, 0x00, /* enableInternalInterCellHandover */
228 0x68, 0x00, /* enableInternalInterCellHandover */
229 0x6A, 0x00, /* enablePowerBudgetHO */
230 0x6C, 0x00, /* enableRXLEVHO */
231 0x6D, 0x00, /* enableRXQUALHO */
232 0x6F, 0x08, /* hoAveragingDistance */
233 0x70, 0x08, 0x01, /* hoAveragingLev */
Harald Weltecd993872009-02-15 16:16:28 +0000234 0x71, 0x10, 0x10, 0x10,
Harald Welte56554712009-07-18 16:18:11 +0200235 0x72, 0x08, 0x02, /* hoAveragingQual */
236 0x73, 0x0A, /* hoLowerThresholdLevDL */
237 0x74, 0x05, /* hoLowerThresholdLevUL */
238 0x75, 0x06, /* hoLowerThresholdQualDL */
239 0x76, 0x06, /* hoLowerThresholdQualUL */
240 0x78, 0x14, /* hoThresholdLevDLintra */
241 0x79, 0x14, /* hoThresholdLevULintra */
242 0x7A, 0x14, /* hoThresholdMsRangeMax */
243 0x7D, 0x06, /* nCell */
244 NM_ATT_BS11_TIMER_HO_REQUEST, 0x03,
245 0x20, 0x01, 0x00,
Harald Weltecd993872009-02-15 16:16:28 +0000246 0x45, 0x01, 0x00,
247 0x48, 0x01, 0x00,
248 0x5A, 0x01, 0x00,
249 0x5B, 0x01, 0x05,
250 0x5E, 0x01, 0x1A,
251 0x5F, 0x01, 0x20,
252 0x9D, 0x01, 0x00,
253 0x47, 0x01, 0x00,
254 0x5C, 0x01, 0x64,
255 0x5D, 0x01, 0x1E,
256 0x97, 0x01, 0x20,
257 0xF7, 0x01, 0x3C,
Harald Welte52b1f982008-12-23 20:25:15 +0000258};
259
260// Power Control, SET ATTRIBUTES
261
262/*
263 Object Class: Power Control
264 BTS relat. Number: 0
265 Instance 2: FF
266 Instance 3: FF
267SET ATTRIBUTES
268 enableMsPowerControl: 00h = Disabled
269 enablePowerControlRLFW: 00h = Disabled
270 pcAveragingLev:
271 A_LEV_PC: 4 SACCH multiframes
272 W_LEV_PC: 1 SACCH multiframes
273 pcAveragingQual:
274 A_QUAL_PC: 4 SACCH multiframes
275 W_QUAL_PC: 2 SACCH multiframes
276 pcLowerThresholdLevDL: 0Fh
277 pcLowerThresholdLevUL: 0Ah
278 pcLowerThresholdQualDL: 05h = 3.2% < BER < 6.4%
279 pcLowerThresholdQualUL: 05h = 3.2% < BER < 6.4%
280 pcRLFThreshold: 0Ch
281 pcUpperThresholdLevDL: 14h
282 pcUpperThresholdLevUL: 0Fh
283 pcUpperThresholdQualDL: 04h = 1.6% < BER < 3.2%
284 pcUpperThresholdQualUL: 04h = 1.6% < BER < 3.2%
285 powerConfirm: 2 ,unit 2 SACCH multiframes
286 powerControlInterval: 2 ,unit 2 SACCH multiframes
287 powerIncrStepSize: 02h = 4 dB
288 powerRedStepSize: 01h = 2 dB
289 radioLinkTimeoutBs: 64 SACCH multiframes
290 enableBSPowerControl: 00h = disabled
291*/
292
293unsigned char msg_4[] =
294{
Harald Weltea865f1b2009-06-20 10:42:17 +0200295 NM_MT_BS11_SET_ATTR, NM_OC_BS11_PWR_CTRL, 0x00, 0xFF, 0xFF,
Harald Weltecd993872009-02-15 16:16:28 +0000296 NM_ATT_BS11_ENA_MS_PWR_CTRL, 0x00,
297 NM_ATT_BS11_ENA_PWR_CTRL_RLFW, 0x00,
Harald Welte56554712009-07-18 16:18:11 +0200298 0x7E, 0x04, 0x01, /* pcAveragingLev */
299 0x7F, 0x04, 0x02, /* pcAveragingQual */
300 0x80, 0x0F, /* pcLowerThresholdLevDL */
301 0x81, 0x0A, /* pcLowerThresholdLevUL */
302 0x82, 0x05, /* pcLowerThresholdQualDL */
303 0x83, 0x05, /* pcLowerThresholdQualUL */
304 0x84, 0x0C, /* pcRLFThreshold */
305 0x85, 0x14, /* pcUpperThresholdLevDL */
306 0x86, 0x0F, /* pcUpperThresholdLevUL */
307 0x87, 0x04, /* pcUpperThresholdQualDL */
308 0x88, 0x04, /* pcUpperThresholdQualUL */
309 0x89, 0x02, /* powerConfirm */
310 0x8A, 0x02, /* powerConfirmInterval */
311 0x8B, 0x02, /* powerIncrStepSize */
312 0x8C, 0x01, /* powerRedStepSize */
313 0x8D, 0x40, /* radioLinkTimeoutBs */
Harald Weltecd993872009-02-15 16:16:28 +0000314 0x65, 0x01, 0x00 // set to 0x01 to enable BSPowerControl
Harald Welte52b1f982008-12-23 20:25:15 +0000315};
316
317
318// Transceiver, SET TRX ATTRIBUTES (TRX 0)
319
320/*
321 Object Class: Transceiver
322 BTS relat. Number: 0
323 Tranceiver number: 0
324 Instance 3: FF
325SET TRX ATTRIBUTES
326 aRFCNList (HEX): 0001
Harald Weltecd993872009-02-15 16:16:28 +0000327 txPwrMaxReduction: 00h = 30dB
Harald Welte52b1f982008-12-23 20:25:15 +0000328 radioMeasGran: 254 SACCH multiframes
329 radioMeasRep: 01h = enabled
330 memberOfEmergencyConfig: 01h = TRUE
331 trxArea: 00h = TRX doesn't belong to a concentric cell
332*/
333
Harald Weltea865f1b2009-06-20 10:42:17 +0200334static unsigned char bs11_attr_radio[] =
Harald Welte52b1f982008-12-23 20:25:15 +0000335{
Harald Weltecd993872009-02-15 16:16:28 +0000336 NM_ATT_ARFCN_LIST, 0x01, 0x00, HARDCODED_ARFCN /*0x01*/,
Harald Welte311d0cf2009-02-17 17:45:59 +0000337 NM_ATT_RF_MAXPOWR_R, 0x00,
Harald Weltee991c262009-08-10 14:09:28 +0200338 NM_ATT_BS11_RADIO_MEAS_GRAN, 0x01, 0x05,
Harald Weltecd993872009-02-15 16:16:28 +0000339 NM_ATT_BS11_RADIO_MEAS_REP, 0x01, 0x01,
340 NM_ATT_BS11_EMRG_CFG_MEMBER, 0x01, 0x01,
341 NM_ATT_BS11_TRX_AREA, 0x01, 0x00,
Harald Welte52b1f982008-12-23 20:25:15 +0000342};
343
Harald Welte8c1d0e42009-02-15 03:38:12 +0000344static unsigned char nanobts_attr_bts[] = {
345 NM_ATT_INTERF_BOUND, 0x55, 0x5b, 0x61, 0x67, 0x6d, 0x73,
Harald Weltefe609d82009-05-23 18:14:31 +0000346 /* interference avg. period in numbers of SACCH multifr */
Harald Welte8c1d0e42009-02-15 03:38:12 +0000347 NM_ATT_INTAVE_PARAM, 0x06,
Harald Welted0fbab52009-06-09 20:04:44 +0000348 /* conn fail based on SACCH error rate */
Harald Welte8c1d0e42009-02-15 03:38:12 +0000349 NM_ATT_CONN_FAIL_CRIT, 0x00, 0x02, 0x01, 0x10,
350 NM_ATT_T200, 0x1e, 0x24, 0x24, 0xa8, 0x34, 0x21, 0xa8,
351 NM_ATT_MAX_TA, 0x3f,
Harald Welte311d0cf2009-02-17 17:45:59 +0000352 NM_ATT_OVERL_PERIOD, 0x00, 0x01, 10, /* seconds */
353 NM_ATT_CCCH_L_T, 10, /* percent */
354 NM_ATT_CCCH_L_I_P, 1, /* seconds */
Harald Weltefe609d82009-05-23 18:14:31 +0000355 NM_ATT_RACH_B_THRESH, 10, /* busy threshold in - dBm */
Harald Welted0fbab52009-06-09 20:04:44 +0000356 NM_ATT_LDAVG_SLOTS, 0x03, 0xe8, /* rach load averaging 1000 slots */
Harald Weltefe609d82009-05-23 18:14:31 +0000357 NM_ATT_BTS_AIR_TIMER, 128, /* miliseconds */
358 NM_ATT_NY1, 10, /* 10 retransmissions of physical config */
Harald Welte8c1d0e42009-02-15 03:38:12 +0000359 NM_ATT_BCCH_ARFCN, HARDCODED_ARFCN >> 8, HARDCODED_ARFCN & 0xff,
Harald Welte060f6df2009-05-23 17:50:53 +0000360 NM_ATT_BSIC, HARDCODED_BSIC,
Harald Welte8c1d0e42009-02-15 03:38:12 +0000361};
Harald Welte52b1f982008-12-23 20:25:15 +0000362
Harald Welte8c1d0e42009-02-15 03:38:12 +0000363static unsigned char nanobts_attr_radio[] = {
Harald Welted0fbab52009-06-09 20:04:44 +0000364 NM_ATT_RF_MAXPOWR_R, 0x0c, /* number of -2dB reduction steps / Pn */
Harald Welte8c1d0e42009-02-15 03:38:12 +0000365 NM_ATT_ARFCN_LIST, 0x00, 0x02, HARDCODED_ARFCN >> 8, HARDCODED_ARFCN & 0xff,
366};
367
Harald Welte5c1e4582009-02-15 11:57:29 +0000368static unsigned char nanobts_attr_e0[] = {
Harald Welte0efe9b72009-07-12 09:33:54 +0200369 NM_ATT_IPACC_STREAM_ID, 0x00,
370 NM_ATT_IPACC_DST_IP_PORT, 0x0b, 0xbb, /* TCP PORT for RSL */
Harald Welte5c1e4582009-02-15 11:57:29 +0000371};
372
Harald Welteb4630602009-05-01 15:43:22 +0000373/* Callback function to be called whenever we get a GSM 12.21 state change event */
Harald Welte8c1d0e42009-02-15 03:38:12 +0000374int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
375 struct gsm_nm_state *old_state, struct gsm_nm_state *new_state)
376{
377 struct gsm_bts *bts;
378 struct gsm_bts_trx *trx;
379 struct gsm_bts_trx_ts *ts;
380
381 /* This is currently only required on nanoBTS */
382
383 switch (evt) {
384 case EVT_STATECHG_OPER:
385 switch (obj_class) {
386 case NM_OC_SITE_MANAGER:
387 bts = container_of(obj, struct gsm_bts, site_mgr);
388 if (old_state->operational != 2 && new_state->operational == 2) {
389 abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
390 }
391 break;
392 case NM_OC_BTS:
393 bts = obj;
394 if (new_state->availability == 5) {
Harald Welte000c0f42009-08-12 21:45:02 +0200395 patch_nm_tables(bts);
Harald Welte8c1d0e42009-02-15 03:38:12 +0000396 abis_nm_set_bts_attr(bts, nanobts_attr_bts,
397 sizeof(nanobts_attr_bts));
398 abis_nm_opstart(bts, NM_OC_BTS,
Harald Welte191280d2009-05-01 13:20:04 +0000399 bts->bts_nr, 0xff, 0xff);
Harald Welte8c1d0e42009-02-15 03:38:12 +0000400 abis_nm_chg_adm_state(bts, NM_OC_BTS,
Harald Welte191280d2009-05-01 13:20:04 +0000401 bts->bts_nr, 0xff, 0xff,
Harald Welte8c1d0e42009-02-15 03:38:12 +0000402 NM_STATE_UNLOCKED);
403 }
404 break;
Harald Welte8c1d0e42009-02-15 03:38:12 +0000405 case NM_OC_CHANNEL:
406 ts = obj;
407 trx = ts->trx;
408 if (new_state->availability == 5) {
409 if (ts->nr == 0 && trx == trx->bts->c0)
Harald Welte89e9d592009-08-09 22:01:26 +0200410 abis_nm_set_channel_attr(ts, NM_CHANC_BCCHComb);
Harald Welte8c1d0e42009-02-15 03:38:12 +0000411 else
412 abis_nm_set_channel_attr(ts, NM_CHANC_TCHFull);
413 abis_nm_opstart(trx->bts, NM_OC_CHANNEL,
Harald Welte191280d2009-05-01 13:20:04 +0000414 trx->bts->bts_nr, trx->nr, ts->nr);
Harald Welte8c1d0e42009-02-15 03:38:12 +0000415 abis_nm_chg_adm_state(trx->bts, NM_OC_CHANNEL,
Harald Welte191280d2009-05-01 13:20:04 +0000416 trx->bts->bts_nr, trx->nr, ts->nr,
Harald Welte8c1d0e42009-02-15 03:38:12 +0000417 NM_STATE_UNLOCKED);
418 }
419 break;
Harald Weltea994a482009-05-01 15:54:23 +0000420 default:
Harald Welte8c1d0e42009-02-15 03:38:12 +0000421 break;
422 }
423 break;
Harald Weltea994a482009-05-01 15:54:23 +0000424 default:
425 //DEBUGP(DMM, "Unhandled state change in %s:%d\n", __func__, __LINE__);
Holger Freytherff9592f2009-03-09 16:17:14 +0000426 break;
Harald Welte8c1d0e42009-02-15 03:38:12 +0000427 }
428 return 0;
429}
430
Harald Welteb4630602009-05-01 15:43:22 +0000431/* Callback function to be called every time we receive a 12.21 SW activated report */
432static int sw_activ_rep(struct msgb *mb)
433{
434 struct abis_om_fom_hdr *foh = msgb_l3(mb);
435 struct gsm_bts_trx *trx = mb->trx;
436
437 switch (foh->obj_class) {
438 case NM_OC_BASEB_TRANSC:
439 /* TRX software is active, tell it to initiate RSL Link */
440 abis_nm_ipaccess_msg(trx->bts, 0xe0, NM_OC_BASEB_TRANSC,
441 trx->bts->bts_nr, trx->nr, 0xff,
442 nanobts_attr_e0, sizeof(nanobts_attr_e0));
443 abis_nm_opstart(trx->bts, NM_OC_BASEB_TRANSC,
444 trx->bts->bts_nr, trx->nr, 0xff);
445 abis_nm_chg_adm_state(trx->bts, NM_OC_BASEB_TRANSC,
446 trx->bts->bts_nr, trx->nr, 0xff,
447 NM_STATE_UNLOCKED);
448 break;
449 case NM_OC_RADIO_CARRIER:
Harald Welte000c0f42009-08-12 21:45:02 +0200450 patch_nm_tables(trx->bts);
Harald Welteb4630602009-05-01 15:43:22 +0000451 abis_nm_set_radio_attr(trx, nanobts_attr_radio,
452 sizeof(nanobts_attr_radio));
453 abis_nm_opstart(trx->bts, NM_OC_RADIO_CARRIER,
454 trx->bts->bts_nr, trx->nr, 0xff);
455 abis_nm_chg_adm_state(trx->bts, NM_OC_RADIO_CARRIER,
456 trx->bts->bts_nr, trx->nr, 0xff,
457 NM_STATE_UNLOCKED);
458 break;
459 }
460 return 0;
461}
462
Holger Hans Peter Freyther500f3ca2009-06-10 10:48:14 +0200463/* Callback function for NACK on the OML NM */
464static int oml_msg_nack(int mt)
465{
466 if (mt == NM_MT_SET_BTS_ATTR_NACK) {
467 fprintf(stderr, "Failed to set BTS attributes. That is fatal. "
468 "Was the bts type and frequency properly specified?\n");
469 exit(-1);
470 }
471
472 return 0;
473}
474
Harald Welteb4630602009-05-01 15:43:22 +0000475/* Callback function to be called every time we receive a signal from NM */
476static int nm_sig_cb(unsigned int subsys, unsigned int signal,
477 void *handler_data, void *signal_data)
478{
479 switch (signal) {
480 case S_NM_SW_ACTIV_REP:
481 return sw_activ_rep(signal_data);
Holger Hans Peter Freyther500f3ca2009-06-10 10:48:14 +0200482 case S_NM_NACK:
483 return oml_msg_nack((int)signal_data);
Harald Welteb4630602009-05-01 15:43:22 +0000484 default:
485 break;
486 }
487 return 0;
488}
489
Harald Welte8c1d0e42009-02-15 03:38:12 +0000490static void bootstrap_om_nanobts(struct gsm_bts *bts)
491{
Harald Weltee1bd2412009-02-15 14:40:09 +0000492 /* We don't do callback based bootstrapping, but event driven (see above) */
Harald Welte8c1d0e42009-02-15 03:38:12 +0000493}
494
Harald Welte349aba62009-08-10 12:31:31 +0200495static void nm_reconfig_ts(struct gsm_bts_trx_ts *ts)
Harald Welte52b1f982008-12-23 20:25:15 +0000496{
Harald Welte349aba62009-08-10 12:31:31 +0200497 enum abis_nm_chan_comb ccomb = abis_nm_chcomb4pchan(ts->pchan);
498 struct gsm_e1_subslot *e1l = &ts->e1_link;
Harald Welteac56e8b2009-08-06 17:40:24 +0200499
Harald Welte349aba62009-08-10 12:31:31 +0200500 abis_nm_set_channel_attr(ts, ccomb);
501
502 if (is_ipaccess_bts(ts->trx->bts))
Harald Welteac56e8b2009-08-06 17:40:24 +0200503 return;
Harald Welte349aba62009-08-10 12:31:31 +0200504
505 switch (ts->pchan) {
506 case GSM_PCHAN_TCH_F:
507 case GSM_PCHAN_TCH_H:
508 abis_nm_conn_terr_traf(ts, e1l->e1_nr, e1l->e1_ts,
509 e1l->e1_ts_ss);
510 break;
511 default:
512 break;
513 }
514}
515
516static void nm_reconfig_trx(struct gsm_bts_trx *trx)
517{
518 struct gsm_e1_subslot *e1l = &trx->rsl_e1_link;
519 int i;
520
Harald Welte000c0f42009-08-12 21:45:02 +0200521 patch_nm_tables(trx->bts);
522
Harald Welte349aba62009-08-10 12:31:31 +0200523 switch (trx->bts->type) {
524 case GSM_BTS_TYPE_BS11:
Harald Welte (local)7f28cd52009-08-12 10:40:17 +0200525 /* FIXME: discover this by fetching an attribute */
526#if 0
527 trx->nominal_power = 15; /* 15dBm == 30mW PA configuration */
528#else
529 trx->nominal_power = 24; /* 24dBm == 250mW PA configuration */
530#endif
Harald Welte349aba62009-08-10 12:31:31 +0200531 abis_nm_conn_terr_sign(trx, e1l->e1_nr, e1l->e1_ts,
532 e1l->e1_ts_ss);
533 abis_nm_establish_tei(trx->bts, trx->nr, e1l->e1_nr,
534 e1l->e1_ts, e1l->e1_ts_ss, trx->rsl_tei);
535
536 /* Set Radio Attributes */
537 if (trx == trx->bts->c0)
538 abis_nm_set_radio_attr(trx, bs11_attr_radio,
539 sizeof(bs11_attr_radio));
540 else {
541 u_int8_t trx1_attr_radio[sizeof(bs11_attr_radio)];
542 u_int8_t arfcn_low = trx->arfcn & 0xff;
543 u_int8_t arfcn_high = (trx->arfcn >> 8) & 0x0f;
544 memcpy(trx1_attr_radio, bs11_attr_radio,
545 sizeof(trx1_attr_radio));
546
547 /* patch ARFCN into TRX Attributes */
548 trx1_attr_radio[2] &= 0xf0;
549 trx1_attr_radio[2] |= arfcn_high;
550 trx1_attr_radio[3] = arfcn_low;
551
552 abis_nm_set_radio_attr(trx, trx1_attr_radio,
553 sizeof(trx1_attr_radio));
554 }
555 break;
Harald Welte (local)7f28cd52009-08-12 10:40:17 +0200556 case GSM_BTS_TYPE_NANOBTS_900:
557 case GSM_BTS_TYPE_NANOBTS_1800:
558 trx->nominal_power = 20;
Harald Welte349aba62009-08-10 12:31:31 +0200559 default:
560 break;
Harald Welteac56e8b2009-08-06 17:40:24 +0200561 }
Harald Welte52b1f982008-12-23 20:25:15 +0000562
Harald Welte349aba62009-08-10 12:31:31 +0200563 for (i = 0; i < TRX_NR_TS; i++)
564 nm_reconfig_ts(&trx->ts[i]);
565}
566
567static void nm_reconfig_bts(struct gsm_bts *bts)
568{
569 struct gsm_bts_trx *trx;
570
571 switch (bts->type) {
572 case GSM_BTS_TYPE_BS11:
573 abis_nm_raw_msg(bts, sizeof(msg_1), msg_1); /* set BTS SiteMgr attr*/
574 abis_nm_set_bts_attr(bts, bs11_attr_bts, sizeof(bs11_attr_bts));
575 abis_nm_raw_msg(bts, sizeof(msg_3), msg_3); /* set BTS handover attr */
576 abis_nm_raw_msg(bts, sizeof(msg_4), msg_4); /* set BTS power control attr */
577 break;
578 default:
579 break;
580 }
581
582 llist_for_each_entry(trx, &bts->trx_list, list)
583 nm_reconfig_trx(trx);
584}
585
586static void bootstrap_om_bs11(struct gsm_bts *bts)
587{
Harald Welte52b1f982008-12-23 20:25:15 +0000588 /* stop sending event reports */
589 abis_nm_event_reports(bts, 0);
590
591 /* begin DB transmission */
Harald Welte05188ee2009-01-18 11:39:08 +0000592 abis_nm_bs11_db_transmission(bts, 1);
Harald Welte52b1f982008-12-23 20:25:15 +0000593
Harald Welte702d8702008-12-26 20:25:35 +0000594 /* end DB transmission */
Harald Welte05188ee2009-01-18 11:39:08 +0000595 abis_nm_bs11_db_transmission(bts, 0);
Harald Welte702d8702008-12-26 20:25:35 +0000596
597 /* Reset BTS Site manager resource */
Harald Welte78374892009-01-18 19:09:22 +0000598 abis_nm_bs11_reset_resource(bts);
Harald Welte702d8702008-12-26 20:25:35 +0000599
600 /* begin DB transmission */
Harald Welte05188ee2009-01-18 11:39:08 +0000601 abis_nm_bs11_db_transmission(bts, 1);
Harald Welte702d8702008-12-26 20:25:35 +0000602
Harald Welte349aba62009-08-10 12:31:31 +0200603 /* reconfigure BTS with all TRX and all TS */
604 nm_reconfig_bts(bts);
Harald Welte67b4c302009-07-29 16:42:16 +0200605
Harald Welte52b1f982008-12-23 20:25:15 +0000606 /* end DB transmission */
Harald Welte05188ee2009-01-18 11:39:08 +0000607 abis_nm_bs11_db_transmission(bts, 0);
Harald Welte52b1f982008-12-23 20:25:15 +0000608
609 /* Reset BTS Site manager resource */
Harald Welte78374892009-01-18 19:09:22 +0000610 abis_nm_bs11_reset_resource(bts);
Harald Welte52b1f982008-12-23 20:25:15 +0000611
612 /* restart sending event reports */
613 abis_nm_event_reports(bts, 1);
614}
615
Harald Welte8c1d0e42009-02-15 03:38:12 +0000616static void bootstrap_om(struct gsm_bts *bts)
617{
Harald Welteedb37782009-05-01 14:59:07 +0000618 fprintf(stdout, "bootstrapping OML for BTS %u\n", bts->nr);
Harald Welte8c1d0e42009-02-15 03:38:12 +0000619
620 switch (bts->type) {
621 case GSM_BTS_TYPE_BS11:
622 bootstrap_om_bs11(bts);
623 break;
624 case GSM_BTS_TYPE_NANOBTS_900:
625 case GSM_BTS_TYPE_NANOBTS_1800:
626 bootstrap_om_nanobts(bts);
627 break;
628 default:
629 fprintf(stderr, "Unable to bootstrap OML: Unknown BTS type %d\n", bts->type);
630 }
631}
632
Harald Welted1252502009-01-01 01:50:32 +0000633static int shutdown_om(struct gsm_bts *bts)
634{
Harald Weltef294f452009-08-06 17:43:50 +0200635 fprintf(stdout, "shutting down OML for BTS %u\n", bts->nr);
636
Harald Welted1252502009-01-01 01:50:32 +0000637 /* stop sending event reports */
638 abis_nm_event_reports(bts, 0);
Harald Welte52b1f982008-12-23 20:25:15 +0000639
Harald Welted1252502009-01-01 01:50:32 +0000640 /* begin DB transmission */
Harald Welte05188ee2009-01-18 11:39:08 +0000641 abis_nm_bs11_db_transmission(bts, 1);
Harald Welted1252502009-01-01 01:50:32 +0000642
643 /* end DB transmission */
Harald Welte05188ee2009-01-18 11:39:08 +0000644 abis_nm_bs11_db_transmission(bts, 0);
Harald Welted1252502009-01-01 01:50:32 +0000645
646 /* Reset BTS Site manager resource */
Harald Welte78374892009-01-18 19:09:22 +0000647 abis_nm_bs11_reset_resource(bts);
Harald Welted1252502009-01-01 01:50:32 +0000648
649 return 0;
650}
651
652static int shutdown_net(struct gsm_network *net)
653{
Harald Weltee441d9c2009-06-21 16:17:15 +0200654 struct gsm_bts *bts;
655
656 llist_for_each_entry(bts, &net->bts_list, list) {
Harald Welted1252502009-01-01 01:50:32 +0000657 int rc;
Harald Weltee441d9c2009-06-21 16:17:15 +0200658 rc = shutdown_om(bts);
Harald Welted1252502009-01-01 01:50:32 +0000659 if (rc < 0)
660 return rc;
661 }
662
663 return 0;
664}
Harald Welte52b1f982008-12-23 20:25:15 +0000665
666struct bcch_info {
667 u_int8_t type;
668 u_int8_t len;
669 const u_int8_t *data;
670};
671
672/*
673SYSTEM INFORMATION TYPE 1
674 Cell channel description
675 Format-ID bit map 0
676 CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
677 RACH Control Parameters
678 maximum 7 retransmissions
679 8 slots used to spread transmission
680 cell not barred for access
681 call reestablishment not allowed
682 Access Control Class = 0000
683*/
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000684static u_int8_t si1[] = {
Holger Freyther4d505472008-12-28 16:32:42 +0000685 /* header */0x55, 0x06, 0x19,
686 /* ccdesc */0x04 /*0x00*/, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
687 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*0x01*/,
Harald Welte7f698162009-08-13 20:26:10 +0200688 /* rach */0xD5, 0x04, 0x00,
Holger Freyther4d505472008-12-28 16:32:42 +0000689 /* s1 reset*/0x2B
Harald Welte52b1f982008-12-23 20:25:15 +0000690};
691
692/*
693 SYSTEM INFORMATION TYPE 2
694 Neighbour Cells Description
695 EXT-IND: Carries the complete BA
696 BA-IND = 0
697 Format-ID bit map 0
698 CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
699 NCC permitted (NCC) = FF
700 RACH Control Parameters
701 maximum 7 retransmissions
702 8 slots used to spread transmission
703 cell not barred for access
704 call reestablishment not allowed
705 Access Control Class = 0000
706*/
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000707static u_int8_t si2[] = {
Holger Freyther4d505472008-12-28 16:32:42 +0000708 /* header */0x59, 0x06, 0x1A,
709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
710 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
711 /* ncc */0xFF,
Harald Welte7f698162009-08-13 20:26:10 +0200712 /* rach*/0xD5, 0x04, 0x00
Harald Welte52b1f982008-12-23 20:25:15 +0000713};
714
715/*
716SYSTEM INFORMATION TYPE 3
717 Cell identity = 00001 (1h)
718 Location area identification
719 Mobile Country Code (MCC): 001
720 Mobile Network Code (MNC): 01
721 Location Area Code (LAC): 00001 (1h)
722 Control Channel Description
723 Attach-detach: MSs in the cell are not allowed to apply IMSI attach /detach
724 0 blocks reserved for access grant
725 1 channel used for CCCH, with SDCCH
726 5 multiframes period for PAGING REQUEST
727 Time-out T3212 = 0
728 Cell Options BCCH
729 Power control indicator: not set
730 MSs shall not use uplink DTX
731 Radio link timeout = 36
732 Cell Selection Parameters
733 Cell reselect hysteresis = 6 dB RXLEV hysteresis for LA re-selection
Harald Welte3b2ec422008-12-29 04:11:14 +0000734 max.TX power level MS may use for CCH = 2 <- according to GSM05.05 39dBm (max)
Harald Welte52b1f982008-12-23 20:25:15 +0000735 Additional Reselect Parameter Indication (ACS) = only SYSTEM INFO 4: The SI rest octets, if present, shall be used to derive the value of PI and possibly C2 parameters
736 Half rate support (NECI): New establishment causes are not supported
737 min.RX signal level for MS = 0
738 RACH Control Parameters
739 maximum 7 retransmissions
740 8 slots used to spread transmission
741 cell not barred for access
742 call reestablishment not allowed
743 Access Control Class = 0000
Harald Welte53833f62009-07-05 13:41:40 +0200744 SI 3 Rest Octets (not present)
Harald Welte52b1f982008-12-23 20:25:15 +0000745*/
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000746static u_int8_t si3[] = {
Holger Freyther4d505472008-12-28 16:32:42 +0000747 /* header */0x49, 0x06, 0x1B,
748 /* cell */0x00, 0x01,
749 /* lai */0x00, 0xF1, 0x10, 0x00, 0x01,
750 /* desc */0x01, 0x03, 0x00,
751 /* option*/0x28,
752 /* selection*/0x62, 0x00,
Harald Welte7f698162009-08-13 20:26:10 +0200753 /* rach */0xD5, 0x04, 0x00,
Harald Welte53833f62009-07-05 13:41:40 +0200754 /* rest */ 0x2B, 0x2B, 0x2B, 0x2B
Harald Welte52b1f982008-12-23 20:25:15 +0000755};
756
757/*
758SYSTEM INFORMATION TYPE 4
759 Location area identification
760 Mobile Country Code (MCC): 001
761 Mobile Network Code (MNC): 01
762 Location Area Code (LAC): 00001 (1h)
763 Cell Selection Parameters
764 Cell reselect hysteresis = 6 dB RXLEV hysteresis for LA re-selection
765 max.TX power level MS may use for CCH = 2
766 Additional Reselect Parameter Indication (ACS) = only SYSTEM INFO 4: The SI rest octets, if present, shall be used to derive the value of PI and possibly C2 parameters
767 Half rate support (NECI): New establishment causes are not supported
768 min.RX signal level for MS = 0
769 RACH Control Parameters
770 maximum 7 retransmissions
771 8 slots used to spread transmission
772 cell not barred for access
773 call reestablishment not allowed
774 Access Control Class = 0000
Harald Welte53833f62009-07-05 13:41:40 +0200775 CBCH Channel Description
Harald Welte52b1f982008-12-23 20:25:15 +0000776 Type = SDCCH/4[2]
777 Timeslot Number: 0
778 Training Sequence Code: 7h
779 ARFCN: 1
Harald Welte53833f62009-07-05 13:41:40 +0200780 SI Rest Octets (not present)
Harald Welte52b1f982008-12-23 20:25:15 +0000781*/
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000782static u_int8_t si4[] = {
Holger Freyther4d505472008-12-28 16:32:42 +0000783 /* header */0x41, 0x06, 0x1C,
784 /* lai */0x00, 0xF1, 0x10, 0x00, 0x01,
785 /* sel */0x62, 0x00,
Harald Welte7f698162009-08-13 20:26:10 +0200786 /* rach*/0xD5, 0x04, 0x00,
Harald Welte53833f62009-07-05 13:41:40 +0200787 /* cbch chan desc */ 0x64, 0x30, 0xE0, HARDCODED_ARFCN/*0x01*/,
788 /* rest octets */ 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B
Harald Welte52b1f982008-12-23 20:25:15 +0000789};
790
791/*
792 SYSTEM INFORMATION TYPE 5
793 Neighbour Cells Description
794 EXT-IND: Carries the complete BA
795 BA-IND = 0
796 Format-ID bit map 0
797 CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
798*/
799
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000800static u_int8_t si5[] = {
Holger Freyther4d505472008-12-28 16:32:42 +0000801 /* header without l2 len*/0x06, 0x1D,
802 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
803 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Harald Welte52b1f982008-12-23 20:25:15 +0000804};
805
806// SYSTEM INFORMATION TYPE 6
807
808/*
809SACCH FILLING
810 System Info Type: SYSTEM INFORMATION 6
811 L3 Information (Hex): 06 1E 00 01 xx xx 10 00 01 28 FF
812
813SYSTEM INFORMATION TYPE 6
814 Cell identity = 00001 (1h)
815 Location area identification
816 Mobile Country Code (MCC): 001
817 Mobile Network Code (MNC): 01
818 Location Area Code (LAC): 00001 (1h)
819 Cell Options SACCH
820 Power control indicator: not set
821 MSs shall not use uplink DTX on a TCH-F. MS shall not use uplink DTX on TCH-H.
822 Radio link timeout = 36
823 NCC permitted (NCC) = FF
824*/
825
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000826static u_int8_t si6[] = {
Holger Freyther4d505472008-12-28 16:32:42 +0000827 /* header */0x06, 0x1E,
828 /* cell id*/ 0x00, 0x01,
829 /* lai */ 0x00, 0xF1, 0x10, 0x00, 0x01,
830 /* options */ 0x28,
831 /* ncc */ 0xFF,
Harald Welte52b1f982008-12-23 20:25:15 +0000832};
833
834
835
836static const struct bcch_info bcch_infos[] = {
837 {
838 .type = RSL_SYSTEM_INFO_1,
839 .len = sizeof(si1),
840 .data = si1,
841 }, {
842 .type = RSL_SYSTEM_INFO_2,
843 .len = sizeof(si2),
844 .data = si2,
845 }, {
846 .type = RSL_SYSTEM_INFO_3,
847 .len = sizeof(si3),
848 .data = si3,
849 }, {
850 .type = RSL_SYSTEM_INFO_4,
851 .len = sizeof(si4),
852 .data = si4,
853 },
854};
855
Holger Freyther24287b62008-12-28 16:32:41 +0000856static_assert(sizeof(si1) == sizeof(struct gsm48_system_information_type_1), type1)
857static_assert(sizeof(si2) == sizeof(struct gsm48_system_information_type_2), type2)
858static_assert(sizeof(si3) == sizeof(struct gsm48_system_information_type_3), type3)
859static_assert(sizeof(si4) >= sizeof(struct gsm48_system_information_type_4), type4)
Harald Welte104604e2008-12-28 16:36:11 +0000860static_assert(sizeof(si5) == sizeof(struct gsm48_system_information_type_5), type5)
861static_assert(sizeof(si6) >= sizeof(struct gsm48_system_information_type_6), type6)
Holger Freyther24287b62008-12-28 16:32:41 +0000862
Harald Welte52b1f982008-12-23 20:25:15 +0000863/* set all system information types */
Harald Weltee79769b2009-02-07 00:48:17 +0000864static int set_system_infos(struct gsm_bts_trx *trx)
Harald Welte52b1f982008-12-23 20:25:15 +0000865{
866 int i;
867
Harald Welted1586052009-08-06 17:41:19 +0200868 if (trx == trx->bts->c0) {
869 for (i = 0; i < ARRAY_SIZE(bcch_infos); i++) {
870 rsl_bcch_info(trx, bcch_infos[i].type,
871 bcch_infos[i].data,
872 bcch_infos[i].len);
873 }
Harald Welte52b1f982008-12-23 20:25:15 +0000874 }
Harald Weltee79769b2009-02-07 00:48:17 +0000875 rsl_sacch_filling(trx, RSL_SYSTEM_INFO_5, si5, sizeof(si5));
876 rsl_sacch_filling(trx, RSL_SYSTEM_INFO_6, si6, sizeof(si6));
Harald Weltead384642008-12-26 10:20:07 +0000877
878 return 0;
Harald Welte52b1f982008-12-23 20:25:15 +0000879}
880
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000881/*
882 * Patch the various SYSTEM INFORMATION tables to update
883 * the LAI
884 */
Harald Welte000c0f42009-08-12 21:45:02 +0200885static void patch_nm_tables(struct gsm_bts *bts)
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000886{
Harald Weltee441d9c2009-06-21 16:17:15 +0200887 u_int8_t arfcn_low = bts->c0->arfcn & 0xff;
888 u_int8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
Harald Welte000c0f42009-08-12 21:45:02 +0200889
890 /* patch ARFCN into BTS Attributes */
891 bs11_attr_bts[69] &= 0xf0;
892 bs11_attr_bts[69] |= arfcn_high;
893 bs11_attr_bts[70] = arfcn_low;
894 nanobts_attr_bts[42] &= 0xf0;
895 nanobts_attr_bts[42] |= arfcn_high;
896 nanobts_attr_bts[43] = arfcn_low;
897
898 /* patch ARFCN into TRX Attributes */
899 bs11_attr_radio[2] &= 0xf0;
900 bs11_attr_radio[2] |= arfcn_high;
901 bs11_attr_radio[3] = arfcn_low;
902 nanobts_attr_radio[5] &= 0xf0;
903 nanobts_attr_radio[5] |= arfcn_high;
904 nanobts_attr_radio[6] = arfcn_low;
905
906 /* patch BSIC */
907 bs11_attr_bts[1] = bts->bsic;
908 nanobts_attr_bts[sizeof(nanobts_attr_bts)-1] = bts->bsic;
Harald Welte61cd8832009-08-12 21:50:41 +0200909
910 /* patch the power reduction */
911 bs11_attr_radio[5] = bts->c0->max_power_red / 2;
912 nanobts_attr_radio[1] = bts->c0->max_power_red / 2;
Harald Welte000c0f42009-08-12 21:45:02 +0200913}
914
915/*
916 * Patch the various SYSTEM INFORMATION tables to update
917 * the LAI
918 */
919static void patch_si_tables(struct gsm_bts *bts)
920{
921 u_int8_t arfcn_low = bts->c0->arfcn & 0xff;
922 u_int8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
923
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000924 /* covert the raw packet to the struct */
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200925 struct gsm48_system_information_type_1 *type_1 =
926 (struct gsm48_system_information_type_1*)&si1;
927 struct gsm48_system_information_type_2 *type_2 =
928 (struct gsm48_system_information_type_2*)&si2;
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000929 struct gsm48_system_information_type_3 *type_3 =
930 (struct gsm48_system_information_type_3*)&si3;
931 struct gsm48_system_information_type_4 *type_4 =
932 (struct gsm48_system_information_type_4*)&si4;
933 struct gsm48_system_information_type_6 *type_6 =
934 (struct gsm48_system_information_type_6*)&si6;
Harald Welteb84e2f42008-12-28 23:42:04 +0000935 struct gsm48_loc_area_id lai;
936
937 gsm0408_generate_lai(&lai, bts->network->country_code,
Harald Welte110c0ab2009-05-23 16:27:05 +0000938 bts->network->network_code,
939 bts->location_area_code);
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000940
941 /* assign the MCC and MNC */
Harald Welteb84e2f42008-12-28 23:42:04 +0000942 type_3->lai = lai;
943 type_4->lai = lai;
944 type_6->lai = lai;
Harald Welte98981882009-01-06 18:59:11 +0000945
Harald Welte98981882009-01-06 18:59:11 +0000946 type_4->data[2] &= 0xf0;
947 type_4->data[2] |= arfcn_high;
948 type_4->data[3] = arfcn_low;
Holger Freyther1adb4ff2009-02-04 00:04:52 +0000949
950 /* patch Control Channel Description 10.5.2.11 */
951 type_3->control_channel_desc = bts->chan_desc;
Harald Welte78f2f502009-05-23 16:56:52 +0000952
Harald Weltef8d536d2009-07-21 22:12:23 +0200953 /* patch TSC */
954 si4[15] &= ~0xe0;
955 si4[15] |= (bts->tsc & 7) << 5;
Harald Welte31f03a62009-08-09 14:38:49 +0200956
957 /* patch MS max power for CCH */
958 type_4->cell_sel_par.ms_txpwr_max_ccch =
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200959 ms_pwr_ctl_lvl(bts->band, bts->ms_max_power);
Harald Welte (local)5dececf2009-08-12 13:28:23 +0200960
961 if (bts->cell_barred) {
962 type_1->rach_control.cell_bar = 1;
963 type_2->rach_control.cell_bar = 1;
964 type_3->rach_control.cell_bar = 1;
965 type_4->rach_control.cell_bar = 1;
966 } else {
967 type_1->rach_control.cell_bar = 0;
968 type_2->rach_control.cell_bar = 0;
969 type_3->rach_control.cell_bar = 0;
970 type_4->rach_control.cell_bar = 0;
971 }
Holger Freytherb9ddfd02008-12-28 16:32:45 +0000972}
973
974
Harald Weltee79769b2009-02-07 00:48:17 +0000975static void bootstrap_rsl(struct gsm_bts_trx *trx)
Harald Welte52b1f982008-12-23 20:25:15 +0000976{
Harald Welteedb37782009-05-01 14:59:07 +0000977 fprintf(stdout, "bootstrapping RSL for BTS/TRX (%u/%u) "
Harald Weltef8d536d2009-07-21 22:12:23 +0200978 "using MCC=%u MNC=%u BSIC=%u TSC=%u\n",
Harald Welte42581822009-08-08 16:12:58 +0200979 trx->bts->nr, trx->nr, gsmnet->country_code,
980 gsmnet->network_code, trx->bts->bsic, trx->bts->tsc);
Harald Welte000c0f42009-08-12 21:45:02 +0200981 patch_si_tables(trx->bts);
Harald Weltee79769b2009-02-07 00:48:17 +0000982 set_system_infos(trx);
Harald Welte52b1f982008-12-23 20:25:15 +0000983}
984
Harald Welte1fa60c82009-02-09 18:13:26 +0000985void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx)
Harald Weltead384642008-12-26 10:20:07 +0000986{
987 switch (event) {
Harald Welte1fa60c82009-02-09 18:13:26 +0000988 case EVT_E1_TEI_UP:
989 switch (type) {
990 case E1INP_SIGN_OML:
991 bootstrap_om(trx->bts);
992 break;
993 case E1INP_SIGN_RSL:
994 bootstrap_rsl(trx);
995 break;
996 default:
997 break;
998 }
Harald Weltead384642008-12-26 10:20:07 +0000999 break;
Harald Welte1fa60c82009-02-09 18:13:26 +00001000 case EVT_E1_TEI_DN:
1001 fprintf(stderr, "Lost some E1 TEI link\n");
1002 /* FIXME: deal with TEI or L1 link loss */
Harald Weltead384642008-12-26 10:20:07 +00001003 break;
1004 default:
Harald Weltead384642008-12-26 10:20:07 +00001005 break;
1006 }
1007}
1008
Harald Welteedb37782009-05-01 14:59:07 +00001009static int bootstrap_bts(struct gsm_bts *bts)
Harald Welte52b1f982008-12-23 20:25:15 +00001010{
Harald Welte42581822009-08-08 16:12:58 +02001011 switch (bts->type) {
1012 case GSM_BTS_TYPE_NANOBTS_1800:
1013 if (bts->c0->arfcn < 512 || bts->c0->arfcn > 885) {
1014 fprintf(stderr, "GSM1800 channel must be between 512-885.\n");
1015 return -EINVAL;
1016 }
1017 break;
1018 case GSM_BTS_TYPE_BS11:
1019 case GSM_BTS_TYPE_NANOBTS_900:
1020 /* Assume we have a P-GSM900 here */
1021 if (bts->c0->arfcn < 1 || bts->c0->arfcn > 124) {
1022 fprintf(stderr, "GSM900 channel must be between 1-124.\n");
1023 return -EINVAL;
1024 }
1025 break;
1026 case GSM_BTS_TYPE_UNKNOWN:
1027 fprintf(stderr, "Unknown BTS. Please specify\n");
1028 return -EINVAL;
1029 }
Holger Freyther1adb4ff2009-02-04 00:04:52 +00001030
1031 /* Control Channel Description */
Harald Welte41fbf442009-02-24 22:34:22 +00001032 bts->chan_desc.att = 1;
Holger Freyther1adb4ff2009-02-04 00:04:52 +00001033 bts->chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C;
1034 bts->chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5;
Harald Welte (local)efc92312009-08-14 23:09:25 +02001035 /* T3212 is set from vty/config */
Holger Freyther1adb4ff2009-02-04 00:04:52 +00001036
Holger Freyther1fd34142009-02-09 23:42:03 +00001037 paging_init(bts);
Harald Welte38c2f132009-01-06 23:10:57 +00001038
Harald Welteedb37782009-05-01 14:59:07 +00001039 return 0;
1040}
1041
1042static int bootstrap_network(void)
1043{
Harald Welte42581822009-08-08 16:12:58 +02001044 struct gsm_bts *bts;
Harald Welte51460062009-08-06 17:54:21 +02001045 int rc;
1046
Harald Welteedb37782009-05-01 14:59:07 +00001047 /* initialize our data structures */
Harald Weltee441d9c2009-06-21 16:17:15 +02001048 gsmnet = gsm_network_init(MCC, MNC, mncc_recv);
Harald Welteedb37782009-05-01 14:59:07 +00001049 if (!gsmnet)
1050 return -ENOMEM;
1051
Harald Welte42581822009-08-08 16:12:58 +02001052 gsmnet->name_long = talloc_strdup(gsmnet, "OpenBSC");
1053 gsmnet->name_short = talloc_strdup(gsmnet, "OpenBSC");
Harald Welteedb37782009-05-01 14:59:07 +00001054
Holger Freytherc7b86f92009-06-06 13:54:20 +00001055 if (db_init(database_name)) {
Holger Freytheref7f7ce2009-04-19 06:35:12 +00001056 printf("DB: Failed to init database. Please check the option settings.\n");
1057 return -1;
1058 }
1059 printf("DB: Database initialized.\n");
1060
1061 if (db_prepare()) {
1062 printf("DB: Failed to prepare database.\n");
1063 return -1;
1064 }
1065 printf("DB: Database prepared.\n");
1066
Holger Freyther219518d2009-01-02 22:04:43 +00001067 telnet_init(gsmnet, 4242);
Holger Hans Peter Freytherd5d1cef2009-08-10 08:39:27 +02001068 rc = vty_read_config_file(config_file);
Holger Hans Peter Freyther100325a2009-08-10 10:35:24 +02001069 if (rc < 0) {
1070 fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file);
Harald Welte42581822009-08-08 16:12:58 +02001071 return rc;
Holger Hans Peter Freyther100325a2009-08-10 10:35:24 +02001072 }
Harald Weltead384642008-12-26 10:20:07 +00001073
Harald Welteb4630602009-05-01 15:43:22 +00001074 register_signal_handler(SS_NM, nm_sig_cb, NULL);
1075
Harald Welte42581822009-08-08 16:12:58 +02001076 llist_for_each_entry(bts, &gsmnet->bts_list, list) {
Holger Hans Peter Freyther03582a82009-07-16 15:24:27 +02001077 bootstrap_bts(bts);
Holger Hans Peter Freyther557ca782009-08-10 14:16:08 +02001078 if (!is_ipaccess_bts(bts))
Harald Welte42581822009-08-08 16:12:58 +02001079 rc = e1_reconfig_bts(bts);
Holger Hans Peter Freyther03582a82009-07-16 15:24:27 +02001080
Harald Welte42581822009-08-08 16:12:58 +02001081 if (rc < 0)
1082 exit (1);
Harald Welteedb37782009-05-01 14:59:07 +00001083 }
Harald Welte42581822009-08-08 16:12:58 +02001084
Holger Hans Peter Freyther557ca782009-08-10 14:16:08 +02001085 /* initialize nanoBTS support omce */
1086 rc = ipaccess_setup(gsmnet);
1087
Harald Welte42581822009-08-08 16:12:58 +02001088 return 0;
Harald Welte52b1f982008-12-23 20:25:15 +00001089}
Harald Weltef6b7a902008-12-26 00:05:11 +00001090
Holger Freyther9a3ee0f2009-01-02 00:40:15 +00001091static void create_pcap_file(char *file)
1092{
1093 mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
1094 int fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, mode);
1095
1096 if (fd < 0) {
1097 perror("Failed to open file for pcap");
1098 return;
1099 }
1100
Holger Freyther0469cf62009-03-31 12:14:16 +00001101 e1_set_pcap_fd(fd);
Holger Freyther9a3ee0f2009-01-02 00:40:15 +00001102}
1103
Holger Freytherb332f612008-12-27 12:46:51 +00001104static void print_usage()
1105{
1106 printf("Usage: bsc_hack\n");
1107}
1108
1109static void print_help()
1110{
1111 printf(" Some useful help...\n");
Harald Welte42581822009-08-08 16:12:58 +02001112 printf(" -h --help this text\n");
Holger Freytherb332f612008-12-27 12:46:51 +00001113 printf(" -d option --debug=DRLL:DCC:DMM:DRR:DRSL:DNM enable debugging\n");
Holger Freytherefde7fb2008-12-28 14:14:56 +00001114 printf(" -s --disable-color\n");
Holger Hans Peter Freytherd5d1cef2009-08-10 08:39:27 +02001115 printf(" -c --config-file filename The config file to use.\n");
Holger Freytherbde36102008-12-28 22:51:39 +00001116 printf(" -l --database db-name The database to use\n");
Holger Freythere97f7fb2008-12-31 18:52:11 +00001117 printf(" -r --reject-cause number The reject cause for LOCATION UPDATING REJECT.\n");
Holger Freyther9a3ee0f2009-01-02 00:40:15 +00001118 printf(" -p --pcap file The filename of the pcap file\n");
Holger Freytherdda22c12009-04-22 22:07:31 +00001119 printf(" -C --cardnr number For bs11 select E1 card number other than 0\n");
Holger Freytherb5c00f52009-04-22 22:08:07 +00001120 printf(" -R --release-l2 Releases mISDN layer 2 after exit, to unload driver.\n");
Harald Weltec70979a2009-08-12 21:52:11 +02001121 printf(" -T --timestamp Prefix every log line with a timestamp\n");
Holger Freytherb332f612008-12-27 12:46:51 +00001122}
1123
1124static void handle_options(int argc, char** argv)
1125{
1126 while (1) {
Harald Welte2cf161b2009-06-20 22:36:41 +02001127 int option_index = 0, c;
Holger Freytherb332f612008-12-27 12:46:51 +00001128 static struct option long_options[] = {
1129 {"help", 0, 0, 'h'},
1130 {"debug", 1, 0, 'd'},
Holger Hans Peter Freytherd5d1cef2009-08-10 08:39:27 +02001131 {"config-file", 1, 0, 'c'},
Holger Freytherefde7fb2008-12-28 14:14:56 +00001132 {"disable-color", 0, 0, 's'},
Holger Freytherbde36102008-12-28 22:51:39 +00001133 {"database", 1, 0, 'l'},
Holger Freyther89824fc2008-12-30 16:18:18 +00001134 {"authorize-everyone", 0, 0, 'a'},
Holger Freythere97f7fb2008-12-31 18:52:11 +00001135 {"reject-cause", 1, 0, 'r'},
Holger Freyther9a3ee0f2009-01-02 00:40:15 +00001136 {"pcap", 1, 0, 'p'},
Holger Freytherdda22c12009-04-22 22:07:31 +00001137 {"cardnr", 1, 0, 'C'},
Holger Freytherb5c00f52009-04-22 22:08:07 +00001138 {"release-l2", 0, 0, 'R'},
Harald Welted3ff51d2009-06-09 20:21:57 +00001139 {"timestamp", 0, 0, 'T'},
Harald Welte805f6442009-07-28 18:25:29 +02001140 {"rtp-proxy", 0, 0, 'P'},
Holger Freytherb332f612008-12-27 12:46:51 +00001141 {0, 0, 0, 0}
1142 };
1143
Holger Hans Peter Freytherd5d1cef2009-08-10 08:39:27 +02001144 c = getopt_long(argc, argv, "hd:sl:ar:p:C:RTPc:",
Holger Freytherb332f612008-12-27 12:46:51 +00001145 long_options, &option_index);
1146 if (c == -1)
1147 break;
1148
1149 switch (c) {
1150 case 'h':
1151 print_usage();
1152 print_help();
1153 exit(0);
Holger Freytherefde7fb2008-12-28 14:14:56 +00001154 case 's':
Holger Freytherb332f612008-12-27 12:46:51 +00001155 debug_use_color(0);
1156 break;
1157 case 'd':
1158 debug_parse_category_mask(optarg);
1159 break;
Harald Welte8965da42009-01-06 18:09:02 +00001160 case 'l':
Holger Freytherbde36102008-12-28 22:51:39 +00001161 database_name = strdup(optarg);
1162 break;
Holger Hans Peter Freytherd5d1cef2009-08-10 08:39:27 +02001163 case 'c':
1164 config_file = strdup(optarg);
1165 break;
Holger Freythere97f7fb2008-12-31 18:52:11 +00001166 case 'r':
1167 gsm0408_set_reject_cause(atoi(optarg));
1168 break;
Holger Freyther9a3ee0f2009-01-02 00:40:15 +00001169 case 'p':
1170 create_pcap_file(optarg);
1171 break;
Harald Welte8c1d0e42009-02-15 03:38:12 +00001172 case 't':
1173 BTS_TYPE = parse_btstype(optarg);
1174 break;
Holger Freytherdda22c12009-04-22 22:07:31 +00001175 case 'C':
1176 cardnr = atoi(optarg);
1177 break;
Holger Freytherb5c00f52009-04-22 22:08:07 +00001178 case 'R':
1179 release_l2 = 1;
1180 break;
Harald Welted3ff51d2009-06-09 20:21:57 +00001181 case 'T':
1182 debug_timestamp(1);
1183 break;
Harald Welte805f6442009-07-28 18:25:29 +02001184 case 'P':
1185 ipacc_rtp_direct = 0;
1186 break;
Holger Freytherb332f612008-12-27 12:46:51 +00001187 default:
1188 /* ignore */
1189 break;
1190 }
1191 }
1192}
1193
Harald Welted1252502009-01-01 01:50:32 +00001194static void signal_handler(int signal)
1195{
1196 fprintf(stdout, "signal %u received\n", signal);
1197
1198 switch (signal) {
Harald Weltef294f452009-08-06 17:43:50 +02001199 case SIGINT:
Harald Welted1252502009-01-01 01:50:32 +00001200 shutdown_net(gsmnet);
Harald Weltef294f452009-08-06 17:43:50 +02001201 sleep(3);
1202 exit(0);
Harald Welted1252502009-01-01 01:50:32 +00001203 break;
Harald Welte31c3d342009-08-07 00:29:44 +02001204 case SIGABRT:
1205 /* in case of abort, we want to obtain a talloc report
1206 * and then return to the caller, who will abort the process */
Harald Welte2cf161b2009-06-20 22:36:41 +02001207 case SIGUSR1:
1208 talloc_report_full(tall_bsc_ctx, stderr);
1209 break;
Harald Welted1252502009-01-01 01:50:32 +00001210 default:
1211 break;
1212 }
1213}
1214
Harald Weltef6b7a902008-12-26 00:05:11 +00001215int main(int argc, char **argv)
1216{
Harald Welte1fa60c82009-02-09 18:13:26 +00001217 int rc;
1218
Harald Welte2cf161b2009-06-20 22:36:41 +02001219 tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc");
Harald Welte (local)d19e58b2009-08-15 02:30:58 +02001220 talloc_ctx_init();
Harald Welte (local)50d12712009-08-13 13:52:14 +02001221 on_dso_load_token();
Harald Welte2cf161b2009-06-20 22:36:41 +02001222
Holger Freytherb332f612008-12-27 12:46:51 +00001223 /* parse options */
1224 handle_options(argc, argv);
1225
Harald Welte65ccf882009-02-24 22:36:20 +00001226 /* seed the PRNG */
1227 srand(time(NULL));
1228
Harald Welte1fa60c82009-02-09 18:13:26 +00001229 rc = bootstrap_network();
1230 if (rc < 0)
1231 exit(1);
Harald Weltef6b7a902008-12-26 00:05:11 +00001232
Harald Weltef294f452009-08-06 17:43:50 +02001233 signal(SIGINT, &signal_handler);
Harald Welted1252502009-01-01 01:50:32 +00001234 signal(SIGABRT, &signal_handler);
Harald Welte2cf161b2009-06-20 22:36:41 +02001235 signal(SIGUSR1, &signal_handler);
Harald Welted1252502009-01-01 01:50:32 +00001236
Harald Weltef6b7a902008-12-26 00:05:11 +00001237 while (1) {
Harald Welte4bfdfe72009-06-10 23:11:52 +08001238 bsc_upqueue(gsmnet);
Harald Welte04d3c922009-05-23 06:07:04 +00001239 bsc_select_main(0);
Harald Weltef6b7a902008-12-26 00:05:11 +00001240 }
1241}