blob: 41dfedb9dc76b87b77213c799dc1d6599a5c1676 [file] [log] [blame]
Neels Hofmeyr84da6b12016-05-20 21:59:55 +02001/* OsmoMSC - Circuit-Switched Core Network (MSC+VLR+HLR+SMSC) implementation
2 */
3
4/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
5 * All Rights Reserved
6 *
7 * Based on OsmoNITB:
8 * (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
9 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
10 * All Rights Reserved
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Affero General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Affero General Public License for more details.
21 *
22 * You should have received a copy of the GNU Affero General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25 */
26
27#include <unistd.h>
28#include <time.h>
29#include <errno.h>
30#include <signal.h>
31#include <fcntl.h>
32#include <sys/stat.h>
33
34#define _GNU_SOURCE
35#include <getopt.h>
36
37/* build switches from the configure script */
38#include "../../bscconfig.h"
39
Neels Hofmeyr90843962017-09-04 15:04:35 +020040#include <osmocom/msc/db.h>
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020041#include <osmocom/core/application.h>
42#include <osmocom/core/select.h>
43#include <osmocom/core/stats.h>
Neels Hofmeyr90843962017-09-04 15:04:35 +020044#include <osmocom/msc/debug.h>
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020045#include <osmocom/abis/abis.h>
46#include <osmocom/abis/e1_input.h>
47#include <osmocom/core/talloc.h>
Neels Hofmeyr90843962017-09-04 15:04:35 +020048#include <osmocom/msc/signal.h>
49#include <osmocom/msc/osmo_msc.h>
50#include <osmocom/msc/bsc_msc_data.h>
51#include <osmocom/msc/sms_queue.h>
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020052#include <osmocom/vty/telnet_interface.h>
53#include <osmocom/vty/ports.h>
54#include <osmocom/vty/logging.h>
Neels Hofmeyr90843962017-09-04 15:04:35 +020055#include <osmocom/msc/vty.h>
56#include <osmocom/msc/bss.h>
57#include <osmocom/msc/mncc.h>
58#include <osmocom/msc/handover_decision.h>
59#include <osmocom/msc/rrlp.h>
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020060#include <osmocom/ctrl/control_if.h>
61#include <osmocom/ctrl/control_vty.h>
62#include <osmocom/ctrl/ports.h>
Neels Hofmeyr90843962017-09-04 15:04:35 +020063#include <osmocom/msc/ctrl.h>
64#include <osmocom/msc/osmo_bsc_rf.h>
65#include <osmocom/msc/smpp.h>
Philipp Maierfbf66102017-04-09 12:32:51 +020066#include <osmocom/sigtran/osmo_ss7.h>
Neels Hofmeyr979cd262017-07-19 16:48:42 +020067#include <osmocom/legacy_mgcp/mgcpgw_client.h>
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020068
Neels Hofmeyr00e82d62017-07-05 15:19:52 +020069#ifdef BUILD_IU
70#include <osmocom/ranap/iu_client.h>
71#endif
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020072
Neels Hofmeyr90843962017-09-04 15:04:35 +020073#include <osmocom/msc/msc_ifaces.h>
74#include <osmocom/msc/iucs.h>
75#include <osmocom/msc/iucs_ranap.h>
76#include <osmocom/msc/a_iface.h>
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020077
78static const char * const osmomsc_copyright =
79 "OsmoMSC - Osmocom Circuit-Switched Core Network implementation\r\n"
80 "Copyright (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>\r\n"
81 "Based on OsmoNITB:\r\n"
82 " (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>\r\n"
83 " (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>\r\n"
84 "Contributions by Daniel Willmann, Jan Lübbe, Stefan Schmidt\r\n"
85 "Dieter Spaar, Andreas Eversberg, Sylvain Munaut, Neels Hofmeyr\r\n\r\n"
86 "License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
87 "This is free software: you are free to change and redistribute it.\r\n"
88 "There is NO WARRANTY, to the extent permitted by law.\r\n";
89
90void *tall_msc_ctx = NULL;
91
92/* satisfy deps from libbsc legacy.
93 TODO double check these */
94void *tall_fle_ctx = NULL;
95void *tall_paging_ctx = NULL;
96void *tall_map_ctx = NULL;
97void *tall_upq_ctx = NULL;
98/* end deps from libbsc legacy. */
99
100static struct {
101 const char *database_name;
102 const char *config_file;
103 int daemonize;
104 const char *mncc_sock_path;
105 int use_db_counter;
106} msc_cmdline_config = {
107 "sms.db",
108 "osmo-msc.cfg",
109 0,
110 0,
111 1
112};
113
114/* timer to store statistics */
115#define DB_SYNC_INTERVAL 60, 0
116#define EXPIRE_INTERVAL 10, 0
117
118static struct osmo_timer_list db_sync_timer;
119
120static void create_pcap_file(char *file)
121{
122 mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
123 int fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, mode);
124
125 if (fd < 0) {
126 perror("Failed to open file for pcap");
127 return;
128 }
129
130 e1_set_pcap_fd(fd);
131}
132
133static void print_usage()
134{
135 printf("Usage: osmo-nitb\n");
136}
137
138static void print_help()
139{
140 printf(" Some useful help...\n");
141 printf(" -h --help This text.\n");
142 printf(" -d option --debug=DRLL:DCC:DMM:DRR:DRSL:DNM Enable debugging.\n");
143 printf(" -D --daemonize Fork the process into a background daemon.\n");
144 printf(" -c --config-file filename The config file to use.\n");
145 printf(" -s --disable-color\n");
146 printf(" -l --database db-name The database to use.\n");
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200147 printf(" -T --timestamp Prefix every log line with a timestamp.\n");
148 printf(" -V --version Print the version of OpenBSC.\n");
149 printf(" -P --rtp-proxy Enable the RTP Proxy code inside OpenBSC.\n");
150 printf(" -e --log-level number Set a global loglevel.\n");
151 printf(" -M --mncc-sock-path PATH Disable built-in MNCC handler and offer socket.\n");
152 printf(" -m --mncc-sock Same as `-M /tmp/bsc_mncc' (deprecated).\n");
153 printf(" -C --no-dbcounter Disable regular syncing of counters to database.\n");
154 printf(" -r --rf-ctl PATH A unix domain socket to listen for cmds.\n");
155 printf(" -p --pcap PATH Write abis communication to pcap trace file.\n");
156}
157
158static void handle_options(int argc, char **argv)
159{
160 while (1) {
161 int option_index = 0, c;
162 static struct option long_options[] = {
163 {"help", 0, 0, 'h'},
164 {"debug", 1, 0, 'd'},
165 {"daemonize", 0, 0, 'D'},
166 {"config-file", 1, 0, 'c'},
167 {"disable-color", 0, 0, 's'},
168 {"database", 1, 0, 'l'},
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200169 {"pcap", 1, 0, 'p'},
170 {"timestamp", 0, 0, 'T'},
171 {"version", 0, 0, 'V' },
172 {"rtp-proxy", 0, 0, 'P'},
173 {"log-level", 1, 0, 'e'},
174 {"mncc-sock", 0, 0, 'm'},
175 {"mncc-sock-path", 1, 0, 'M'},
176 {"no-dbcounter", 0, 0, 'C'},
177 {0, 0, 0, 0}
178 };
179
180 c = getopt_long(argc, argv, "hd:Dsl:ap:TPVc:e:mCM:",
181 long_options, &option_index);
182 if (c == -1)
183 break;
184
185 switch (c) {
186 case 'h':
187 print_usage();
188 print_help();
189 exit(0);
190 case 's':
191 log_set_use_color(osmo_stderr_target, 0);
192 break;
193 case 'd':
194 log_parse_category_mask(osmo_stderr_target, optarg);
195 break;
196 case 'D':
197 msc_cmdline_config.daemonize = 1;
198 break;
199 case 'l':
200 msc_cmdline_config.database_name = optarg;
201 break;
202 case 'c':
203 msc_cmdline_config.config_file = optarg;
204 break;
205 case 'p':
206 create_pcap_file(optarg);
207 break;
208 case 'T':
209 log_set_print_timestamp(osmo_stderr_target, 1);
210 break;
211#if BEFORE_MSCSPLIT
212 case 'P':
213 ipacc_rtp_direct = 0;
214 break;
215#endif
216 case 'e':
217 log_set_log_level(osmo_stderr_target, atoi(optarg));
218 break;
219 case 'M':
220 msc_cmdline_config.mncc_sock_path = optarg;
221 break;
222 case 'm':
223 msc_cmdline_config.mncc_sock_path = "/tmp/bsc_mncc";
224 break;
225 case 'C':
226 msc_cmdline_config.use_db_counter = 0;
227 break;
228 case 'V':
229 print_version(1);
230 exit(0);
231 break;
232 default:
233 /* catch unknown options *as well as* missing arguments. */
234 fprintf(stderr, "Error in command line options. Exiting.\n");
235 exit(-1);
236 }
237 }
238}
239
240struct gsm_network *msc_network_alloc(void *ctx,
241 mncc_recv_cb_t mncc_recv)
242{
243 struct gsm_network *net = gsm_network_init(ctx, 1, 1, mncc_recv);
244 if (!net)
245 return NULL;
246
247 net->name_long = talloc_strdup(net, "OsmoMSC");
248 net->name_short = talloc_strdup(net, "OsmoMSC");
249
250 net->gsup_server_addr_str = talloc_strdup(net,
251 MSC_HLR_REMOTE_IP_DEFAULT);
252 net->gsup_server_port = MSC_HLR_REMOTE_PORT_DEFAULT;
253
254 mgcpgw_client_conf_init(&net->mgcpgw.conf);
255
256 return net;
257}
258
259void msc_network_shutdown(struct gsm_network *net)
260{
261 /* nothing here yet */
262}
263
264static struct gsm_network *msc_network = NULL;
265
266extern void *tall_vty_ctx;
267static void signal_handler(int signal)
268{
269 fprintf(stdout, "signal %u received\n", signal);
270
271 switch (signal) {
272 case SIGINT:
Harald Welte28cd9442017-08-20 20:50:06 +0200273 case SIGTERM:
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200274 msc_network_shutdown(msc_network);
275 osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
276 sleep(3);
277 exit(0);
278 break;
279 case SIGABRT:
280 osmo_generate_backtrace();
281 /* in case of abort, we want to obtain a talloc report
282 * and then return to the caller, who will abort the process */
283 case SIGUSR1:
284 talloc_report(tall_vty_ctx, stderr);
285 talloc_report_full(tall_msc_ctx, stderr);
286 break;
287 case SIGUSR2:
288 talloc_report_full(tall_vty_ctx, stderr);
289 break;
290 default:
291 break;
292 }
293}
294
295/* timer handling */
296static int _db_store_counter(struct osmo_counter *counter, void *data)
297{
298 return db_store_counter(counter);
299}
300
301static void db_sync_timer_cb(void *data)
302{
303 /* store counters to database and re-schedule */
304 osmo_counters_for_each(_db_store_counter, NULL);
305 osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL);
306}
307
308extern int bsc_vty_go_parent(struct vty *vty);
309
310static struct vty_app_info msc_vty_info = {
311 .name = "OsmoMSC",
312 .version = PACKAGE_VERSION,
313 .go_parent_cb = bsc_vty_go_parent,
314 .is_config_node = bsc_vty_is_config_node,
315};
316
Neels Hofmeyr00e82d62017-07-05 15:19:52 +0200317#ifdef BUILD_IU
Philipp Maierfbf66102017-04-09 12:32:51 +0200318static int rcvmsg_iu_cs(struct msgb *msg, struct gprs_ra_id *ra_id, uint16_t *sai)
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200319{
320 DEBUGP(DIUCS, "got IuCS message"
321 " %d bytes: %s\n",
322 msg->len, osmo_hexdump(msg->data, msg->len));
323 if (ra_id) {
324 DEBUGP(DIUCS, "got IuCS message on"
325 " MNC %d MCC %d LAC %d RAC %d\n",
326 ra_id->mnc, ra_id->mcc, ra_id->lac, ra_id->rac);
327 }
328
329 return gsm0408_rcvmsg_iucs(msc_network, msg, ra_id? &ra_id->lac : NULL);
330}
331
Neels Hofmeyr00e82d62017-07-05 15:19:52 +0200332static int rx_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type,
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200333 void *data)
334{
335 DEBUGP(DIUCS, "got IuCS event %u: %s\n", type,
Neels Hofmeyr00e82d62017-07-05 15:19:52 +0200336 ranap_iu_event_type_str(type));
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200337
338 return iucs_rx_ranap_event(msc_network, ctx, type, data);
339}
Neels Hofmeyr00e82d62017-07-05 15:19:52 +0200340#endif
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200341
Philipp Maierfbf66102017-04-09 12:32:51 +0200342#define DEFAULT_M3UA_REMOTE_IP "127.0.0.1"
343#define DEFAULT_PC_A "0.23.1"
344#define DEFAULT_PC_IU "0.23.2"
345#define DEFAULT_PC_A_IU DEFAULT_PC_A
346
347static struct osmo_sccp_instance *sccp_setup(void *ctx, uint32_t cs7_instance,
348 const char *label, const char *default_pc_str)
349{
350 int default_pc = osmo_ss7_pointcode_parse(NULL, default_pc_str);
351 if (default_pc < 0)
352 return NULL;
353
354 return osmo_sccp_simple_client_on_ss7_id(ctx, cs7_instance, label, default_pc,
355 OSMO_SS7_ASP_PROT_M3UA,
356 0, NULL, /* local: use arbitrary port and 0.0.0.0. */
357 0, /* remote: use protocol default port */
358 DEFAULT_M3UA_REMOTE_IP);
359 /* Note: If a differing remote IP is to be used, it was already entered in the vty config at
360 * 'cs7' / 'asp' / 'remote-ip', and this default remote IP has no effect.
361 * Similarly, 'cs7' / 'listen' can specify the local IP address. */
362}
363
364static int ss7_setup(void *ctx)
365{
366 uint32_t cs7_instance_a = msc_network->a.cs7_instance;
367#if BUILD_IU
368 uint32_t cs7_instance_iu = msc_network->iu.cs7_instance;
369
370 if (cs7_instance_a == cs7_instance_iu) {
371 /* Create one single SCCP instance which will be used for both,
372 * Iu and A at the same time, under the same point-code */
373 LOGP(DMSC, LOGL_NOTICE, "CS7 Instance identifiers: A = Iu = %u\n", cs7_instance_a);
374
375 msc_network->a.sccp = sccp_setup(ctx, cs7_instance_a, "OsmoMSC-A-Iu", DEFAULT_PC_A_IU);
376 if (!msc_network->a.sccp)
377 return -EINVAL;
378
379 msc_network->iu.sccp = msc_network->a.sccp;
380 } else {
381 /* Create two separate SCCP instances to run A and Iu independently on different
382 * pointcodes */
383 LOGP(DMSC, LOGL_NOTICE, "CS7 Instance identifiers: A = %u, Iu = %u\n",
384 cs7_instance_a, cs7_instance_iu);
385
386 msc_network->a.sccp = sccp_setup(ctx, cs7_instance_a, "OsmoMSC-A", DEFAULT_PC_A);
387 if (!msc_network->a.sccp)
388 return -EINVAL;
389
390 msc_network->iu.sccp = sccp_setup(ctx, cs7_instance_iu, "OsmoMSC-Iu", DEFAULT_PC_IU);
391 if (!msc_network->iu.sccp)
392 return -EINVAL;
393 }
394#else
395 /* No Iu support, just open up an A instance */
396 msc_network->a.sccp = sccp_setup(ctx, cs7_instance_a, "OsmoMSC-A", DEFAULT_PC_A);
397 if (!msc_network->a.sccp)
398 return -EINVAL;
399#endif
400
401 return 0;
402}
403
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200404int main(int argc, char **argv)
405{
406 int rc;
407
408 msc_vty_info.copyright = osmomsc_copyright;
409
410 tall_msc_ctx = talloc_named_const(NULL, 1, "osmo_msc");
411 talloc_ctx_init(tall_msc_ctx);
412
413 osmo_init_logging(&log_info);
414 osmo_stats_init(tall_msc_ctx);
415
416 /* For --version, vty_init() must be called before handling options */
417 vty_init(&msc_vty_info);
418
Philipp Maierfbf66102017-04-09 12:32:51 +0200419 osmo_ss7_init();
420 osmo_ss7_vty_init_asp(tall_msc_ctx);
421
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200422 /* Parse options */
423 handle_options(argc, argv);
424
425 /* Allocate global gsm_network struct; choose socket/internal MNCC */
426 msc_network = msc_network_alloc(tall_msc_ctx,
427 msc_cmdline_config.mncc_sock_path?
428 mncc_sock_from_cc
429 : int_mncc_recv);
430 if (!msc_network)
431 return -ENOMEM;
432
433 if (msc_vlr_alloc(msc_network)) {
434 fprintf(stderr, "Failed to allocate VLR\n");
435 exit(1);
436 }
437
438 ctrl_vty_init(tall_msc_ctx);
439 logging_vty_add_cmds(&log_info);
440 msc_vty_init(msc_network);
441 bsc_vty_init_extra();
442
443#ifdef BUILD_SMPP
444 if (smpp_openbsc_alloc_init(tall_msc_ctx) < 0)
445 return -1;
446#endif
447
448 /*
449 * For osmo-nitb, skip TCH/F for now, because otherwise dyn TS
450 * always imply the possibility to have a mix of TCH/F and
451 * TCH/H channels; if two phones request a TCH/F and a TCH/H,
452 * respectively, they cannot call each other. If we deny TCH/F,
453 * they will both fall back to TCH/H, and dynamic channels are
454 * usable. See OS#1778.
455 *
456 * A third-party MSC may well be able to handle a TCH/H TCH/F
457 * mismatch. Moreover, this option may be overwritten in the
458 * config file or in VTY.
459 */
460 msc_network->dyn_ts_allow_tch_f = false;
461
462 rc = vty_read_config_file(msc_cmdline_config.config_file, NULL);
463 if (rc < 0) {
464 LOGP(DNM, LOGL_FATAL, "Failed to parse the config file: '%s'\n",
465 msc_cmdline_config.config_file);
466 return 1;
467 }
468
469 /* Initialize MNCC socket if appropriate */
470 if (msc_cmdline_config.mncc_sock_path) {
471 rc = mncc_sock_init(msc_network,
472 msc_cmdline_config.mncc_sock_path);
473 if (rc) {
474 fprintf(stderr, "MNCC socket initialization failed. exiting.\n");
475 exit(1);
476 }
477 } else
478 DEBUGP(DMNCC, "Using internal MNCC handler.\n");
479
480 /* start telnet after reading config for vty_get_bind_addr() */
481 rc = telnet_init_dynif(tall_msc_ctx, &msc_network,
482 vty_get_bind_addr(), OSMO_VTY_PORT_MSC);
483 if (rc < 0)
484 return 2;
485
486 /* BSC stuff is to be split behind an A-interface to be used with
487 * OsmoBSC, but there is no need to remove it yet. Most of the
488 * following code until iu_init() is legacy. */
489
490#ifdef BUILD_SMPP
491 smpp_openbsc_start(msc_network);
492#endif
493
494 /* start control interface after reading config for
495 * ctrl_vty_get_bind_addr() */
496 msc_network->ctrl = ctrl_interface_setup_dynip(msc_network, ctrl_vty_get_bind_addr(),
497 OSMO_CTRL_PORT_MSC, NULL);
498 if (!msc_network->ctrl) {
499 printf("Failed to initialize control interface. Exiting.\n");
500 return -1;
501 }
502
503#if 0
504TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_install().
505 if (bsc_base_ctrl_cmds_install() != 0) {
506 printf("Failed to initialize the BSC control commands.\n");
507 return -1;
508 }
509#endif
510
511 if (msc_ctrl_cmds_install(msc_network) != 0) {
512 printf("Failed to initialize the MSC control commands.\n");
513 return -1;
514 }
515
516 /* seed the PRNG */
517 srand(time(NULL));
518 /* TODO: is this used for crypto?? Improve randomness, at least we
519 * should try to use the nanoseconds part of the current time. */
520
521 if (db_init(msc_cmdline_config.database_name)) {
522 printf("DB: Failed to init database: %s\n",
523 msc_cmdline_config.database_name);
524 return 4;
525 }
526
527 osmo_fsm_log_addr(true);
528 if (msc_vlr_start(msc_network)) {
529 fprintf(stderr, "Failed to start VLR\n");
530 exit(1);
531 }
532
533 msc_subscr_conn_init();
534
535 if (db_prepare()) {
536 printf("DB: Failed to prepare database.\n");
537 return 5;
538 }
539
540 /* setup the timer */
541 osmo_timer_setup(&db_sync_timer, db_sync_timer_cb, NULL);
542 if (msc_cmdline_config.use_db_counter)
543 osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL);
544
545 signal(SIGINT, &signal_handler);
Harald Welte28cd9442017-08-20 20:50:06 +0200546 signal(SIGTERM, &signal_handler);
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200547 signal(SIGABRT, &signal_handler);
548 signal(SIGUSR1, &signal_handler);
549 signal(SIGUSR2, &signal_handler);
550 osmo_init_ignore_signals();
551
552 /* start the SMS queue */
553 if (sms_queue_start(msc_network, 20) != 0)
554 return -1;
555
556 msc_network->mgcpgw.client = mgcpgw_client_init(
557 msc_network, &msc_network->mgcpgw.conf);
558
559 if (mgcpgw_client_connect(msc_network->mgcpgw.client)) {
560 printf("MGCPGW connect failed\n");
561 return 7;
562 }
563
Philipp Maierfbf66102017-04-09 12:32:51 +0200564 if (ss7_setup(tall_msc_ctx)) {
565 printf("Setting up SCCP client failed.\n");
566 return 8;
567 }
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200568
569#ifdef BUILD_IU
570 /* Set up IuCS */
Neels Hofmeyr00e82d62017-07-05 15:19:52 +0200571 ranap_iu_init(tall_msc_ctx, DRANAP, "OsmoMSC-IuCS", msc_network->iu.sccp, rcvmsg_iu_cs, rx_iu_event);
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200572#endif
573
Philipp Maierfbf66102017-04-09 12:32:51 +0200574 /* Set up A interface */
575 a_init(msc_network->a.sccp, msc_network);
576
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200577 if (msc_cmdline_config.daemonize) {
578 rc = osmo_daemonize();
579 if (rc < 0) {
580 perror("Error during daemonize");
581 return 6;
582 }
583 }
584
585 while (1) {
586 log_reset_context();
587 osmo_select_main(0);
588 }
589}