blob: 016459bddd42ceff5557575560648f0a57501297 [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* ip.access nanoBTS configuration tool */
2
3/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +01004 * (C) 2009 by Holger Hans Peter Freyther
5 * (C) 2009 by On Waves
Harald Welte59b04682009-06-10 05:40:52 +08006 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <unistd.h>
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28#include <getopt.h>
29#include <sys/types.h>
30
31#include <sys/socket.h>
32#include <netinet/in.h>
33#include <arpa/inet.h>
34
35
36#include <openbsc/select.h>
37#include <openbsc/timer.h>
38#include <openbsc/ipaccess.h>
39#include <openbsc/gsm_data.h>
40#include <openbsc/e1_input.h>
41#include <openbsc/abis_nm.h>
Holger Hans Peter Freyther72baef32009-07-07 12:40:07 +020042#include <openbsc/signal.h>
Harald Welte0bf8e302009-08-08 00:02:36 +020043#include <openbsc/debug.h>
Harald Welte59b04682009-06-10 05:40:52 +080044
45static struct gsm_network *gsmnet;
46
Harald Welte12a721e2009-08-10 11:39:47 +020047static int net_listen_testnr;
Harald Welte59b04682009-06-10 05:40:52 +080048static int restart;
49static char *prim_oml_ip;
50static char *unit_id;
Harald Welte21460f02009-07-03 11:26:45 +020051static u_int16_t nv_flags;
52static u_int16_t nv_mask;
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +010053static char *software = NULL;
Holger Hans Peter Freyther0e15b932009-12-28 12:18:37 +010054static int sw_load_state = 0;
55
56struct sw_load {
57 u_int8_t file_id[255];
58 u_int8_t file_id_len;
59
60 u_int8_t file_version[255];
61 u_int8_t file_version_len;
62};
63
64static struct sw_load *sw_load1 = NULL;
65static struct sw_load *sw_load2 = NULL;
Harald Welte59b04682009-06-10 05:40:52 +080066
67/*
68static u_int8_t prim_oml_attr[] = { 0x95, 0x00, 7, 0x88, 192, 168, 100, 11, 0x00, 0x00 };
69static u_int8_t unit_id_attr[] = { 0x91, 0x00, 9, '2', '3', '4', '2', '/' , '0', '/', '0', 0x00 };
70*/
71
Holger Hans Peter Freyther72baef32009-07-07 12:40:07 +020072/*
73 * Callback function for NACK on the OML NM
74 *
75 * Currently we send the config requests but don't check the
76 * result. The nanoBTS will send us a NACK when we did something the
77 * BTS didn't like.
78 */
Harald Welte6a21c732009-11-17 06:09:56 +010079static int ipacc_msg_nack(u_int8_t mt)
Holger Hans Peter Freyther72baef32009-07-07 12:40:07 +020080{
81 fprintf(stderr, "Failure to set attribute. This seems fatal\n");
82 exit(-1);
83 return 0;
84}
85
Harald Welte0bf8e302009-08-08 00:02:36 +020086struct ipacc_ferr_elem {
87 int16_t freq_err;
88 u_int8_t freq_qual;
89 u_int8_t arfcn;
90} __attribute__((packed));
91
Harald Welte12a721e2009-08-10 11:39:47 +020092struct ipacc_cusage_elem {
93 u_int16_t arfcn:10,
94 rxlev:6;
95} __attribute__ ((packed));
96
Harald Welte0bf8e302009-08-08 00:02:36 +020097static int test_rep(void *_msg)
98{
99 struct msgb *msg = _msg;
100 struct abis_om_fom_hdr *foh = msgb_l3(msg);
101 u_int16_t test_rep_len, ferr_list_len;
102 struct ipacc_ferr_elem *ife;
Harald Weltec73d9832009-11-13 14:43:15 +0100103 struct ipac_bcch_info binfo;
104 int i, rc;
Harald Welte0bf8e302009-08-08 00:02:36 +0200105
106 DEBUGP(DNM, "TEST REPORT: ");
107
108 if (foh->data[0] != NM_ATT_TEST_NO ||
109 foh->data[2] != NM_ATT_TEST_REPORT)
110 return -EINVAL;
111
112 DEBUGPC(DNM, "test_no=0x%02x ", foh->data[1]);
113 /* data[2] == NM_ATT_TEST_REPORT */
114 /* data[3..4]: test_rep_len */
115 test_rep_len = ntohs(*(u_int16_t *) &foh->data[3]);
116 /* data[5]: ip.access test result */
Harald Welte12a721e2009-08-10 11:39:47 +0200117 DEBUGPC(DNM, "test_res=%s\n", ipacc_testres_name(foh->data[5]));
Harald Welte0bf8e302009-08-08 00:02:36 +0200118
119 /* data[6]: ip.access nested IE. 3 == freq_err_list */
120 switch (foh->data[6]) {
Harald Weltec73d9832009-11-13 14:43:15 +0100121 case NM_IPAC_EIE_FREQ_ERR_LIST:
Harald Welte0bf8e302009-08-08 00:02:36 +0200122 /* data[7..8]: length of ferr_list */
123 ferr_list_len = ntohs(*(u_int16_t *) &foh->data[7]);
124
125 /* data[9...]: frequency error list elements */
126 for (i = 0; i < ferr_list_len; i+= sizeof(*ife)) {
127 ife = (struct ipacc_ferr_elem *) (foh->data + 9 + i);
128 DEBUGP(DNM, "==> ARFCN %4u, Frequency Error %6hd\n",
129 ife->arfcn, ntohs(ife->freq_err));
130 }
131 break;
Harald Weltec73d9832009-11-13 14:43:15 +0100132 case NM_IPAC_EIE_CHAN_USE_LIST:
Harald Welte12a721e2009-08-10 11:39:47 +0200133 /* data[7..8]: length of ferr_list */
134 ferr_list_len = ntohs(*(u_int16_t *) &foh->data[7]);
135
136 /* data[9...]: channel usage list elements */
137 for (i = 0; i < ferr_list_len; i+= 2) {
138 u_int16_t *cu_ptr = (u_int16_t *)(foh->data + 9 + i);
139 u_int16_t cu = ntohs(*cu_ptr);
140 DEBUGP(DNM, "==> ARFCN %4u, RxLev %2u\n",
141 cu & 0x3ff, cu >> 10);
142 }
143 break;
Harald Weltec73d9832009-11-13 14:43:15 +0100144 case NM_IPAC_EIE_BCCH_INFO_TYPE:
145 break;
146 case NM_IPAC_EIE_BCCH_INFO:
147 rc = ipac_parse_bcch_info(&binfo, foh->data+6);
148 if (rc < 0) {
149 DEBUGP(DNM, "BCCH Info parsing failed\n");
150 break;
151 }
152 DEBUGP(DNM, "==> ARFCN %u, RxLev %2u, RxQual %2u: %3d-%d, LAC %d CI %d\n",
153 binfo.arfcn, binfo.rx_lev, binfo.rx_qual,
154 binfo.cgi.mcc, binfo.cgi.mnc,
155 binfo.cgi.lac, binfo.cgi.ci);
156 break;
Harald Welte0bf8e302009-08-08 00:02:36 +0200157 default:
158 break;
159 }
160
161 return 0;
162}
163
Holger Hans Peter Freyther72baef32009-07-07 12:40:07 +0200164static int nm_sig_cb(unsigned int subsys, unsigned int signal,
165 void *handler_data, void *signal_data)
166{
Harald Welte6a21c732009-11-17 06:09:56 +0100167 u_int8_t *msg_type;
168
Holger Hans Peter Freyther72baef32009-07-07 12:40:07 +0200169 switch (signal) {
170 case S_NM_IPACC_NACK:
Harald Welte6a21c732009-11-17 06:09:56 +0100171 msg_type = signal_data;
172 return ipacc_msg_nack(*msg_type);
Harald Welte0bf8e302009-08-08 00:02:36 +0200173 case S_NM_TEST_REP:
174 return test_rep(signal_data);
Holger Hans Peter Freyther72baef32009-07-07 12:40:07 +0200175 default:
176 break;
177 }
178
179 return 0;
180}
181
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100182/* callback function passed to the ABIS OML code */
183static int percent;
184static int percent_old;
Holger Hans Peter Freyther0e15b932009-12-28 12:18:37 +0100185static int swload_cbfn(unsigned int hook, unsigned int event, struct msgb *_msg,
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100186 void *data, void *param)
187{
Holger Hans Peter Freyther0e15b932009-12-28 12:18:37 +0100188 struct msgb *msg;
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100189 struct gsm_bts *bts;
190
191 if (hook != GSM_HOOK_NM_SWLOAD)
192 return 0;
193
194 bts = (struct gsm_bts *) data;
195
196 switch (event) {
197 case NM_MT_LOAD_INIT_ACK:
198 fprintf(stdout, "Software Load Initiate ACK\n");
199 break;
200 case NM_MT_LOAD_INIT_NACK:
201 fprintf(stderr, "ERROR: Software Load Initiate NACK\n");
202 exit(5);
203 break;
204 case NM_MT_LOAD_END_ACK:
205 fprintf(stderr, "LOAD END ACK...");
Holger Hans Peter Freyther0e15b932009-12-28 12:18:37 +0100206 /* now make it the default */
207 sw_load_state = 1;
208
209 msg = msgb_alloc(1024, "sw: nvattr");
210 msg->l2h = msgb_put(msg, 3);
211 msg->l3h = &msg->l2h[3];
212
213 /* activate software */
214 if (sw_load1) {
215 msgb_v_put(msg, NM_ATT_SW_DESCR);
216 msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load1->file_id_len, sw_load1->file_id);
217 msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load1->file_version_len,
218 sw_load1->file_version);
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100219 }
Holger Hans Peter Freyther0e15b932009-12-28 12:18:37 +0100220
221 if (sw_load2) {
222 msgb_v_put(msg, NM_ATT_SW_DESCR);
Holger Hans Peter Freytherf81445e2009-12-29 11:12:00 +0100223 msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load2->file_id_len, sw_load2->file_id);
Holger Hans Peter Freyther0e15b932009-12-28 12:18:37 +0100224 msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load2->file_version_len,
225 sw_load2->file_version);
226 }
227
228 /* fill in the data */
229 msg->l2h[0] = NM_ATT_IPACC_CUR_SW_CFG;
230 msg->l2h[1] = msgb_l3len(msg) >> 8;
231 msg->l2h[2] = msgb_l3len(msg) & 0xff;
232 printf("Foo l2h: %p l3h: %p... length l2: %u l3: %u\n", msg->l2h, msg->l3h, msgb_l2len(msg), msgb_l3len(msg));
233 abis_nm_ipaccess_set_nvattr(bts, msg->l2h, msgb_l2len(msg));
234 msgb_free(msg);
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100235 break;
236 case NM_MT_LOAD_END_NACK:
237 fprintf(stderr, "ERROR: Software Load End NACK\n");
238 exit(3);
239 break;
240 case NM_MT_ACTIVATE_SW_NACK:
241 fprintf(stderr, "ERROR: Activate Software NACK\n");
242 exit(4);
243 break;
244 case NM_MT_ACTIVATE_SW_ACK:
245 break;
246 case NM_MT_LOAD_SEG_ACK:
247 percent = abis_nm_software_load_status(bts);
248 if (percent > percent_old)
249 printf("Software Download Progress: %d%%\n", percent);
250 percent_old = percent;
251 break;
Holger Hans Peter Freyther61f814d2009-12-28 12:23:02 +0100252 case NM_MT_LOAD_ABORT:
253 fprintf(stderr, "ERROR: Load aborted by the BTS.\n");
254 exit(6);
255 break;
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100256 }
257 return 0;
258}
259
Harald Welte59b04682009-06-10 05:40:52 +0800260static void bootstrap_om(struct gsm_bts *bts)
261{
262 int len;
263 static u_int8_t buf[1024];
Harald Welte21460f02009-07-03 11:26:45 +0200264 u_int8_t *cur = buf;
Harald Welte59b04682009-06-10 05:40:52 +0800265
266 printf("OML link established\n");
267
268 if (unit_id) {
269 len = strlen(unit_id);
270 if (len > sizeof(buf)-10)
271 return;
272 buf[0] = NM_ATT_IPACC_UNIT_ID;
273 buf[1] = (len+1) >> 8;
274 buf[2] = (len+1) & 0xff;
275 memcpy(buf+3, unit_id, len);
276 buf[3+len] = 0;
277 printf("setting Unit ID to '%s'\n", unit_id);
278 abis_nm_ipaccess_set_nvattr(bts, buf, 3+len+1);
279 }
280 if (prim_oml_ip) {
281 struct in_addr ia;
Harald Welte59b04682009-06-10 05:40:52 +0800282
283 if (!inet_aton(prim_oml_ip, &ia)) {
284 fprintf(stderr, "invalid IP address: %s\n",
285 prim_oml_ip);
286 return;
287 }
288
289 /* 0x88 + IP + port */
290 len = 1 + sizeof(ia) + 2;
291
Harald Welte4206d982009-07-12 09:33:54 +0200292 *cur++ = NM_ATT_IPACC_PRIM_OML_CFG_LIST;
Harald Welte59b04682009-06-10 05:40:52 +0800293 *cur++ = (len) >> 8;
294 *cur++ = (len) & 0xff;
295 *cur++ = 0x88;
296 memcpy(cur, &ia, sizeof(ia));
297 cur += sizeof(ia);
298 *cur++ = 0;
299 *cur++ = 0;
300 printf("setting primary OML link IP to '%s'\n", inet_ntoa(ia));
301 abis_nm_ipaccess_set_nvattr(bts, buf, 3+len);
302 }
Harald Welte21460f02009-07-03 11:26:45 +0200303 if (nv_mask) {
304 len = 4;
305
306 *cur++ = NM_ATT_IPACC_NV_FLAGS;
307 *cur++ = (len) >> 8;
308 *cur++ = (len) & 0xff;
309 *cur++ = nv_flags & 0xff;
310 *cur++ = nv_mask & 0xff;
311 *cur++ = nv_flags >> 8;
312 *cur++ = nv_mask >> 8;
313 printf("setting NV Flags/Mask to 0x%04x/0x%04x\n",
314 nv_flags, nv_mask);
315 abis_nm_ipaccess_set_nvattr(bts, buf, 3+len);
316 }
Harald Welte59b04682009-06-10 05:40:52 +0800317
318 if (restart) {
319 printf("restarting BTS\n");
320 abis_nm_ipaccess_restart(bts);
321 }
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100322
Harald Welte59b04682009-06-10 05:40:52 +0800323}
324
325void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx)
326{
327 switch (event) {
328 case EVT_E1_TEI_UP:
329 switch (type) {
330 case E1INP_SIGN_OML:
331 bootstrap_om(trx->bts);
332 break;
333 case E1INP_SIGN_RSL:
334 /* FIXME */
335 break;
336 default:
337 break;
338 }
339 break;
340 case EVT_E1_TEI_DN:
341 fprintf(stderr, "Lost some E1 TEI link\n");
342 /* FIXME: deal with TEI or L1 link loss */
343 break;
344 default:
345 break;
346 }
347}
348
349int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
350 struct gsm_nm_state *old_state, struct gsm_nm_state *new_state)
351{
Harald Welte0bf8e302009-08-08 00:02:36 +0200352 if (evt == EVT_STATECHG_OPER &&
353 obj_class == NM_OC_RADIO_CARRIER &&
Holger Hans Peter Freytherf6dbf7f2009-12-28 07:27:43 +0100354 new_state->availability == 3) {
Harald Welte0bf8e302009-08-08 00:02:36 +0200355 struct gsm_bts_trx *trx = obj;
Holger Hans Peter Freytherf6dbf7f2009-12-28 07:27:43 +0100356
357 if (net_listen_testnr) {
358 u_int8_t phys_config[] = { 0x02, 0x0a, 0x00, 0x01, 0x02 };
359 abis_nm_perform_test(trx->bts, 2, 0, 0, 0xff,
360 net_listen_testnr, 1,
361 phys_config, sizeof(phys_config));
362 } else if (software) {
363 int rc;
364 printf("Attempting software upload with '%s'\n", software);
365 rc = abis_nm_software_load(trx->bts, software, 19, 0, swload_cbfn, trx->bts);
366 if (rc < 0) {
367 fprintf(stderr, "Failed to start software load\n");
368 exit(-3);
369 }
370 }
Harald Welte0bf8e302009-08-08 00:02:36 +0200371 }
Harald Welte59b04682009-06-10 05:40:52 +0800372 return 0;
373}
374
Holger Hans Peter Freyther5bcfb4f2009-07-04 11:53:10 +0200375static void print_usage(void)
376{
377 printf("Usage: ipaccess-config\n");
378}
379
380static void print_help(void)
381{
382 printf(" -u --unit-id UNIT_ID\n");
383 printf(" -o --oml-ip ip\n");
384 printf(" -r --restart\n");
Harald Welte0bf8e302009-08-08 00:02:36 +0200385 printf(" -n flags/mask\tSet NVRAM attributes.\n");
Holger Hans Peter Freythera4434c22009-11-16 19:53:08 +0100386 printf(" -l --listen testnr \tPerform specified test number\n");
Holger Hans Peter Freyther5bcfb4f2009-07-04 11:53:10 +0200387 printf(" -h --help this text\n");
Holger Hans Peter Freyther2e021c62009-10-27 03:41:09 +0100388 printf(" -s --stream-id ID\n");
Holger Hans Peter Freyther5bcfb4f2009-07-04 11:53:10 +0200389}
390
Harald Welte59b04682009-06-10 05:40:52 +0800391int main(int argc, char **argv)
392{
393 struct gsm_bts *bts;
394 struct sockaddr_in sin;
Holger Hans Peter Freyther2e021c62009-10-27 03:41:09 +0100395 int rc, option_index = 0, stream_id = 0xff;
Holger Hans Peter Freytherc8d862e2009-12-22 22:32:51 +0100396 struct debug_target *stderr_target;
397
398 debug_init();
399 stderr_target = debug_target_create_stderr();
400 debug_add_target(stderr_target);
401 debug_set_all_filter(stderr_target, 1);
Harald Welte (local)19497042009-12-28 23:15:36 +0100402 debug_set_log_level(stderr_target, 0);
403 debug_parse_category_mask(stderr_target, "DNM,0");
Harald Welte59b04682009-06-10 05:40:52 +0800404
405 printf("ipaccess-config (C) 2009 by Harald Welte\n");
406 printf("This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY\n\n");
407
408 while (1) {
409 int c;
Harald Welte21460f02009-07-03 11:26:45 +0200410 unsigned long ul;
411 char *slash;
Harald Welte59b04682009-06-10 05:40:52 +0800412 static struct option long_options[] = {
413 { "unit-id", 1, 0, 'u' },
414 { "oml-ip", 1, 0, 'o' },
415 { "restart", 0, 0, 'r' },
Holger Hans Peter Freyther5bcfb4f2009-07-04 11:53:10 +0200416 { "help", 0, 0, 'h' },
Harald Welte12a721e2009-08-10 11:39:47 +0200417 { "listen", 1, 0, 'l' },
Holger Hans Peter Freyther2e021c62009-10-27 03:41:09 +0100418 { "stream-id", 1, 0, 's' },
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100419 { "software", 1, 0, 'd' },
Harald Welte59b04682009-06-10 05:40:52 +0800420 };
421
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100422 c = getopt_long(argc, argv, "u:o:rn:l:hs:d:", long_options,
Harald Welte59b04682009-06-10 05:40:52 +0800423 &option_index);
424
425 if (c == -1)
426 break;
427
428 switch (c) {
429 case 'u':
430 unit_id = optarg;
431 break;
432 case 'o':
433 prim_oml_ip = optarg;
434 break;
435 case 'r':
436 restart = 1;
437 break;
Harald Welte21460f02009-07-03 11:26:45 +0200438 case 'n':
439 slash = strchr(optarg, '/');
440 if (!slash)
441 exit(2);
442 ul = strtoul(optarg, NULL, 16);
443 nv_flags = ul & 0xffff;
444 ul = strtoul(slash+1, NULL, 16);
445 nv_mask = ul & 0xffff;
446 break;
Harald Welte0bf8e302009-08-08 00:02:36 +0200447 case 'l':
Harald Welte12a721e2009-08-10 11:39:47 +0200448 net_listen_testnr = atoi(optarg);
Harald Welte0bf8e302009-08-08 00:02:36 +0200449 break;
Holger Hans Peter Freyther2e021c62009-10-27 03:41:09 +0100450 case 's':
451 stream_id = atoi(optarg);
Holger Hans Peter Freyther2e021c62009-10-27 03:41:09 +0100452 break;
Holger Hans Peter Freyther4b513382009-12-28 03:11:33 +0100453 case 'd':
454 software = strdup(optarg);
455 break;
Holger Hans Peter Freyther5bcfb4f2009-07-04 11:53:10 +0200456 case 'h':
457 print_usage();
458 print_help();
459 exit(0);
Harald Welte59b04682009-06-10 05:40:52 +0800460 }
461 };
462
463 if (optind >= argc) {
Holger Hans Peter Freyther5bcfb4f2009-07-04 11:53:10 +0200464 fprintf(stderr, "you have to specify the IP address of the BTS. Use --help for more information\n");
Harald Welte59b04682009-06-10 05:40:52 +0800465 exit(2);
466 }
467
Harald Weltee712a5f2009-06-21 16:17:15 +0200468 gsmnet = gsm_network_init(1, 1, NULL);
Harald Welte59b04682009-06-10 05:40:52 +0800469 if (!gsmnet)
470 exit(1);
471
Mike Haben66e0ba02009-10-02 12:19:34 +0100472 bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_NANOBTS, HARDCODED_TSC,
Harald Weltee712a5f2009-06-21 16:17:15 +0200473 HARDCODED_BSIC);
Harald Welte (local)19497042009-12-28 23:15:36 +0100474 /* ip.access supports up to 4 chained TRX */
475 gsm_bts_trx_alloc(bts);
476 gsm_bts_trx_alloc(bts);
477 gsm_bts_trx_alloc(bts);
Holger Hans Peter Freyther2e021c62009-10-27 03:41:09 +0100478 bts->oml_tei = stream_id;
Harald Welte59b04682009-06-10 05:40:52 +0800479
Holger Hans Peter Freyther72baef32009-07-07 12:40:07 +0200480 register_signal_handler(SS_NM, nm_sig_cb, NULL);
Harald Welte59b04682009-06-10 05:40:52 +0800481 printf("Trying to connect to ip.access BTS ...\n");
482
483 memset(&sin, 0, sizeof(sin));
484 sin.sin_family = AF_INET;
485 inet_aton(argv[optind], &sin.sin_addr);
486 rc = ia_config_connect(bts, &sin);
487 if (rc < 0) {
488 perror("Error connecting to the BTS");
489 exit(1);
490 }
491
492 while (1) {
493 rc = bsc_select_main(0);
494 if (rc < 0)
495 exit(3);
496 }
497
498 exit(0);
499}
500