Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 1 | /* 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 | |
| 40 | #include <openbsc/db.h> |
| 41 | #include <osmocom/core/application.h> |
| 42 | #include <osmocom/core/select.h> |
| 43 | #include <osmocom/core/stats.h> |
| 44 | #include <openbsc/debug.h> |
| 45 | #include <osmocom/abis/abis.h> |
| 46 | #include <osmocom/abis/e1_input.h> |
| 47 | #include <osmocom/core/talloc.h> |
| 48 | #include <openbsc/signal.h> |
| 49 | #include <openbsc/osmo_msc.h> |
| 50 | #include <openbsc/bsc_msc_data.h> |
| 51 | #include <openbsc/sms_queue.h> |
| 52 | #include <osmocom/vty/telnet_interface.h> |
| 53 | #include <osmocom/vty/ports.h> |
| 54 | #include <osmocom/vty/logging.h> |
| 55 | #include <openbsc/vty.h> |
| 56 | #include <openbsc/bss.h> |
| 57 | #include <openbsc/mncc.h> |
| 58 | #include <openbsc/handover_decision.h> |
| 59 | #include <openbsc/rrlp.h> |
| 60 | #include <osmocom/ctrl/control_if.h> |
| 61 | #include <osmocom/ctrl/control_vty.h> |
| 62 | #include <osmocom/ctrl/ports.h> |
| 63 | #include <openbsc/ctrl.h> |
| 64 | #include <openbsc/osmo_bsc_rf.h> |
| 65 | #include <openbsc/smpp.h> |
| 66 | #include <openbsc/mgcpgw_client.h> |
| 67 | |
| 68 | #include <openbsc/msc_ifaces.h> |
| 69 | |
| 70 | #include <openbsc/iu.h> |
| 71 | #include <openbsc/iucs.h> |
| 72 | #include <openbsc/iucs_ranap.h> |
| 73 | |
| 74 | static const char * const osmomsc_copyright = |
| 75 | "OsmoMSC - Osmocom Circuit-Switched Core Network implementation\r\n" |
| 76 | "Copyright (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>\r\n" |
| 77 | "Based on OsmoNITB:\r\n" |
| 78 | " (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>\r\n" |
| 79 | " (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>\r\n" |
| 80 | "Contributions by Daniel Willmann, Jan Lübbe, Stefan Schmidt\r\n" |
| 81 | "Dieter Spaar, Andreas Eversberg, Sylvain Munaut, Neels Hofmeyr\r\n\r\n" |
| 82 | "License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n" |
| 83 | "This is free software: you are free to change and redistribute it.\r\n" |
| 84 | "There is NO WARRANTY, to the extent permitted by law.\r\n"; |
| 85 | |
| 86 | void *tall_msc_ctx = NULL; |
| 87 | |
| 88 | /* satisfy deps from libbsc legacy. |
| 89 | TODO double check these */ |
| 90 | void *tall_fle_ctx = NULL; |
| 91 | void *tall_paging_ctx = NULL; |
| 92 | void *tall_map_ctx = NULL; |
| 93 | void *tall_upq_ctx = NULL; |
| 94 | /* end deps from libbsc legacy. */ |
| 95 | |
| 96 | static struct { |
| 97 | const char *database_name; |
| 98 | const char *config_file; |
| 99 | int daemonize; |
| 100 | const char *mncc_sock_path; |
| 101 | int use_db_counter; |
| 102 | } msc_cmdline_config = { |
| 103 | "sms.db", |
| 104 | "osmo-msc.cfg", |
| 105 | 0, |
| 106 | 0, |
| 107 | 1 |
| 108 | }; |
| 109 | |
| 110 | /* timer to store statistics */ |
| 111 | #define DB_SYNC_INTERVAL 60, 0 |
| 112 | #define EXPIRE_INTERVAL 10, 0 |
| 113 | |
| 114 | static struct osmo_timer_list db_sync_timer; |
| 115 | |
| 116 | static void create_pcap_file(char *file) |
| 117 | { |
| 118 | mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; |
| 119 | int fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, mode); |
| 120 | |
| 121 | if (fd < 0) { |
| 122 | perror("Failed to open file for pcap"); |
| 123 | return; |
| 124 | } |
| 125 | |
| 126 | e1_set_pcap_fd(fd); |
| 127 | } |
| 128 | |
| 129 | static void print_usage() |
| 130 | { |
| 131 | printf("Usage: osmo-nitb\n"); |
| 132 | } |
| 133 | |
| 134 | static void print_help() |
| 135 | { |
| 136 | printf(" Some useful help...\n"); |
| 137 | printf(" -h --help This text.\n"); |
| 138 | printf(" -d option --debug=DRLL:DCC:DMM:DRR:DRSL:DNM Enable debugging.\n"); |
| 139 | printf(" -D --daemonize Fork the process into a background daemon.\n"); |
| 140 | printf(" -c --config-file filename The config file to use.\n"); |
| 141 | printf(" -s --disable-color\n"); |
| 142 | printf(" -l --database db-name The database to use.\n"); |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 143 | printf(" -T --timestamp Prefix every log line with a timestamp.\n"); |
| 144 | printf(" -V --version Print the version of OpenBSC.\n"); |
| 145 | printf(" -P --rtp-proxy Enable the RTP Proxy code inside OpenBSC.\n"); |
| 146 | printf(" -e --log-level number Set a global loglevel.\n"); |
| 147 | printf(" -M --mncc-sock-path PATH Disable built-in MNCC handler and offer socket.\n"); |
| 148 | printf(" -m --mncc-sock Same as `-M /tmp/bsc_mncc' (deprecated).\n"); |
| 149 | printf(" -C --no-dbcounter Disable regular syncing of counters to database.\n"); |
| 150 | printf(" -r --rf-ctl PATH A unix domain socket to listen for cmds.\n"); |
| 151 | printf(" -p --pcap PATH Write abis communication to pcap trace file.\n"); |
| 152 | } |
| 153 | |
| 154 | static void handle_options(int argc, char **argv) |
| 155 | { |
| 156 | while (1) { |
| 157 | int option_index = 0, c; |
| 158 | static struct option long_options[] = { |
| 159 | {"help", 0, 0, 'h'}, |
| 160 | {"debug", 1, 0, 'd'}, |
| 161 | {"daemonize", 0, 0, 'D'}, |
| 162 | {"config-file", 1, 0, 'c'}, |
| 163 | {"disable-color", 0, 0, 's'}, |
| 164 | {"database", 1, 0, 'l'}, |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 165 | {"pcap", 1, 0, 'p'}, |
| 166 | {"timestamp", 0, 0, 'T'}, |
| 167 | {"version", 0, 0, 'V' }, |
| 168 | {"rtp-proxy", 0, 0, 'P'}, |
| 169 | {"log-level", 1, 0, 'e'}, |
| 170 | {"mncc-sock", 0, 0, 'm'}, |
| 171 | {"mncc-sock-path", 1, 0, 'M'}, |
| 172 | {"no-dbcounter", 0, 0, 'C'}, |
| 173 | {0, 0, 0, 0} |
| 174 | }; |
| 175 | |
| 176 | c = getopt_long(argc, argv, "hd:Dsl:ap:TPVc:e:mCM:", |
| 177 | long_options, &option_index); |
| 178 | if (c == -1) |
| 179 | break; |
| 180 | |
| 181 | switch (c) { |
| 182 | case 'h': |
| 183 | print_usage(); |
| 184 | print_help(); |
| 185 | exit(0); |
| 186 | case 's': |
| 187 | log_set_use_color(osmo_stderr_target, 0); |
| 188 | break; |
| 189 | case 'd': |
| 190 | log_parse_category_mask(osmo_stderr_target, optarg); |
| 191 | break; |
| 192 | case 'D': |
| 193 | msc_cmdline_config.daemonize = 1; |
| 194 | break; |
| 195 | case 'l': |
| 196 | msc_cmdline_config.database_name = optarg; |
| 197 | break; |
| 198 | case 'c': |
| 199 | msc_cmdline_config.config_file = optarg; |
| 200 | break; |
| 201 | case 'p': |
| 202 | create_pcap_file(optarg); |
| 203 | break; |
| 204 | case 'T': |
| 205 | log_set_print_timestamp(osmo_stderr_target, 1); |
| 206 | break; |
| 207 | #if BEFORE_MSCSPLIT |
| 208 | case 'P': |
| 209 | ipacc_rtp_direct = 0; |
| 210 | break; |
| 211 | #endif |
| 212 | case 'e': |
| 213 | log_set_log_level(osmo_stderr_target, atoi(optarg)); |
| 214 | break; |
| 215 | case 'M': |
| 216 | msc_cmdline_config.mncc_sock_path = optarg; |
| 217 | break; |
| 218 | case 'm': |
| 219 | msc_cmdline_config.mncc_sock_path = "/tmp/bsc_mncc"; |
| 220 | break; |
| 221 | case 'C': |
| 222 | msc_cmdline_config.use_db_counter = 0; |
| 223 | break; |
| 224 | case 'V': |
| 225 | print_version(1); |
| 226 | exit(0); |
| 227 | break; |
| 228 | default: |
| 229 | /* catch unknown options *as well as* missing arguments. */ |
| 230 | fprintf(stderr, "Error in command line options. Exiting.\n"); |
| 231 | exit(-1); |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | struct gsm_network *msc_network_alloc(void *ctx, |
| 237 | mncc_recv_cb_t mncc_recv) |
| 238 | { |
| 239 | struct gsm_network *net = gsm_network_init(ctx, 1, 1, mncc_recv); |
| 240 | if (!net) |
| 241 | return NULL; |
| 242 | |
| 243 | net->name_long = talloc_strdup(net, "OsmoMSC"); |
| 244 | net->name_short = talloc_strdup(net, "OsmoMSC"); |
| 245 | |
| 246 | net->gsup_server_addr_str = talloc_strdup(net, |
| 247 | MSC_HLR_REMOTE_IP_DEFAULT); |
| 248 | net->gsup_server_port = MSC_HLR_REMOTE_PORT_DEFAULT; |
| 249 | |
| 250 | mgcpgw_client_conf_init(&net->mgcpgw.conf); |
| 251 | |
| 252 | return net; |
| 253 | } |
| 254 | |
| 255 | void msc_network_shutdown(struct gsm_network *net) |
| 256 | { |
| 257 | /* nothing here yet */ |
| 258 | } |
| 259 | |
| 260 | static struct gsm_network *msc_network = NULL; |
| 261 | |
| 262 | extern void *tall_vty_ctx; |
| 263 | static void signal_handler(int signal) |
| 264 | { |
| 265 | fprintf(stdout, "signal %u received\n", signal); |
| 266 | |
| 267 | switch (signal) { |
| 268 | case SIGINT: |
Harald Welte | 6f750e6 | 2017-08-20 20:50:06 +0200 | [diff] [blame^] | 269 | case SIGTERM: |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 270 | msc_network_shutdown(msc_network); |
| 271 | osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL); |
| 272 | sleep(3); |
| 273 | exit(0); |
| 274 | break; |
| 275 | case SIGABRT: |
| 276 | osmo_generate_backtrace(); |
| 277 | /* in case of abort, we want to obtain a talloc report |
| 278 | * and then return to the caller, who will abort the process */ |
| 279 | case SIGUSR1: |
| 280 | talloc_report(tall_vty_ctx, stderr); |
| 281 | talloc_report_full(tall_msc_ctx, stderr); |
| 282 | break; |
| 283 | case SIGUSR2: |
| 284 | talloc_report_full(tall_vty_ctx, stderr); |
| 285 | break; |
| 286 | default: |
| 287 | break; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | /* timer handling */ |
| 292 | static int _db_store_counter(struct osmo_counter *counter, void *data) |
| 293 | { |
| 294 | return db_store_counter(counter); |
| 295 | } |
| 296 | |
| 297 | static void db_sync_timer_cb(void *data) |
| 298 | { |
| 299 | /* store counters to database and re-schedule */ |
| 300 | osmo_counters_for_each(_db_store_counter, NULL); |
| 301 | osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL); |
| 302 | } |
| 303 | |
| 304 | extern int bsc_vty_go_parent(struct vty *vty); |
| 305 | |
| 306 | static struct vty_app_info msc_vty_info = { |
| 307 | .name = "OsmoMSC", |
| 308 | .version = PACKAGE_VERSION, |
| 309 | .go_parent_cb = bsc_vty_go_parent, |
| 310 | .is_config_node = bsc_vty_is_config_node, |
| 311 | }; |
| 312 | |
| 313 | static int rcvmsg_iu_cs(struct msgb *msg, struct gprs_ra_id *ra_id, |
| 314 | uint16_t *sai) |
| 315 | { |
| 316 | DEBUGP(DIUCS, "got IuCS message" |
| 317 | " %d bytes: %s\n", |
| 318 | msg->len, osmo_hexdump(msg->data, msg->len)); |
| 319 | if (ra_id) { |
| 320 | DEBUGP(DIUCS, "got IuCS message on" |
| 321 | " MNC %d MCC %d LAC %d RAC %d\n", |
| 322 | ra_id->mnc, ra_id->mcc, ra_id->lac, ra_id->rac); |
| 323 | } |
| 324 | |
| 325 | return gsm0408_rcvmsg_iucs(msc_network, msg, ra_id? &ra_id->lac : NULL); |
| 326 | } |
| 327 | |
| 328 | static int rx_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, |
| 329 | void *data) |
| 330 | { |
| 331 | DEBUGP(DIUCS, "got IuCS event %u: %s\n", type, |
| 332 | iu_event_type_str(type)); |
| 333 | |
| 334 | return iucs_rx_ranap_event(msc_network, ctx, type, data); |
| 335 | } |
| 336 | |
| 337 | int main(int argc, char **argv) |
| 338 | { |
| 339 | int rc; |
| 340 | |
| 341 | msc_vty_info.copyright = osmomsc_copyright; |
| 342 | |
| 343 | tall_msc_ctx = talloc_named_const(NULL, 1, "osmo_msc"); |
| 344 | talloc_ctx_init(tall_msc_ctx); |
| 345 | |
| 346 | osmo_init_logging(&log_info); |
| 347 | osmo_stats_init(tall_msc_ctx); |
| 348 | |
| 349 | /* For --version, vty_init() must be called before handling options */ |
| 350 | vty_init(&msc_vty_info); |
| 351 | |
| 352 | /* Parse options */ |
| 353 | handle_options(argc, argv); |
| 354 | |
| 355 | /* Allocate global gsm_network struct; choose socket/internal MNCC */ |
| 356 | msc_network = msc_network_alloc(tall_msc_ctx, |
| 357 | msc_cmdline_config.mncc_sock_path? |
| 358 | mncc_sock_from_cc |
| 359 | : int_mncc_recv); |
| 360 | if (!msc_network) |
| 361 | return -ENOMEM; |
| 362 | |
| 363 | if (msc_vlr_alloc(msc_network)) { |
| 364 | fprintf(stderr, "Failed to allocate VLR\n"); |
| 365 | exit(1); |
| 366 | } |
| 367 | |
| 368 | ctrl_vty_init(tall_msc_ctx); |
| 369 | logging_vty_add_cmds(&log_info); |
| 370 | msc_vty_init(msc_network); |
| 371 | bsc_vty_init_extra(); |
| 372 | |
| 373 | #ifdef BUILD_SMPP |
| 374 | if (smpp_openbsc_alloc_init(tall_msc_ctx) < 0) |
| 375 | return -1; |
| 376 | #endif |
| 377 | |
| 378 | /* |
| 379 | * For osmo-nitb, skip TCH/F for now, because otherwise dyn TS |
| 380 | * always imply the possibility to have a mix of TCH/F and |
| 381 | * TCH/H channels; if two phones request a TCH/F and a TCH/H, |
| 382 | * respectively, they cannot call each other. If we deny TCH/F, |
| 383 | * they will both fall back to TCH/H, and dynamic channels are |
| 384 | * usable. See OS#1778. |
| 385 | * |
| 386 | * A third-party MSC may well be able to handle a TCH/H TCH/F |
| 387 | * mismatch. Moreover, this option may be overwritten in the |
| 388 | * config file or in VTY. |
| 389 | */ |
| 390 | msc_network->dyn_ts_allow_tch_f = false; |
| 391 | |
| 392 | rc = vty_read_config_file(msc_cmdline_config.config_file, NULL); |
| 393 | if (rc < 0) { |
| 394 | LOGP(DNM, LOGL_FATAL, "Failed to parse the config file: '%s'\n", |
| 395 | msc_cmdline_config.config_file); |
| 396 | return 1; |
| 397 | } |
| 398 | |
| 399 | /* Initialize MNCC socket if appropriate */ |
| 400 | if (msc_cmdline_config.mncc_sock_path) { |
| 401 | rc = mncc_sock_init(msc_network, |
| 402 | msc_cmdline_config.mncc_sock_path); |
| 403 | if (rc) { |
| 404 | fprintf(stderr, "MNCC socket initialization failed. exiting.\n"); |
| 405 | exit(1); |
| 406 | } |
| 407 | } else |
| 408 | DEBUGP(DMNCC, "Using internal MNCC handler.\n"); |
| 409 | |
| 410 | /* start telnet after reading config for vty_get_bind_addr() */ |
| 411 | rc = telnet_init_dynif(tall_msc_ctx, &msc_network, |
| 412 | vty_get_bind_addr(), OSMO_VTY_PORT_MSC); |
| 413 | if (rc < 0) |
| 414 | return 2; |
| 415 | |
| 416 | /* BSC stuff is to be split behind an A-interface to be used with |
| 417 | * OsmoBSC, but there is no need to remove it yet. Most of the |
| 418 | * following code until iu_init() is legacy. */ |
| 419 | |
| 420 | #ifdef BUILD_SMPP |
| 421 | smpp_openbsc_start(msc_network); |
| 422 | #endif |
| 423 | |
| 424 | /* start control interface after reading config for |
| 425 | * ctrl_vty_get_bind_addr() */ |
| 426 | msc_network->ctrl = ctrl_interface_setup_dynip(msc_network, ctrl_vty_get_bind_addr(), |
| 427 | OSMO_CTRL_PORT_MSC, NULL); |
| 428 | if (!msc_network->ctrl) { |
| 429 | printf("Failed to initialize control interface. Exiting.\n"); |
| 430 | return -1; |
| 431 | } |
| 432 | |
| 433 | #if 0 |
| 434 | TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_install(). |
| 435 | if (bsc_base_ctrl_cmds_install() != 0) { |
| 436 | printf("Failed to initialize the BSC control commands.\n"); |
| 437 | return -1; |
| 438 | } |
| 439 | #endif |
| 440 | |
| 441 | if (msc_ctrl_cmds_install(msc_network) != 0) { |
| 442 | printf("Failed to initialize the MSC control commands.\n"); |
| 443 | return -1; |
| 444 | } |
| 445 | |
| 446 | /* seed the PRNG */ |
| 447 | srand(time(NULL)); |
| 448 | /* TODO: is this used for crypto?? Improve randomness, at least we |
| 449 | * should try to use the nanoseconds part of the current time. */ |
| 450 | |
| 451 | if (db_init(msc_cmdline_config.database_name)) { |
| 452 | printf("DB: Failed to init database: %s\n", |
| 453 | msc_cmdline_config.database_name); |
| 454 | return 4; |
| 455 | } |
| 456 | |
| 457 | osmo_fsm_log_addr(true); |
| 458 | if (msc_vlr_start(msc_network)) { |
| 459 | fprintf(stderr, "Failed to start VLR\n"); |
| 460 | exit(1); |
| 461 | } |
| 462 | |
| 463 | msc_subscr_conn_init(); |
| 464 | |
| 465 | if (db_prepare()) { |
| 466 | printf("DB: Failed to prepare database.\n"); |
| 467 | return 5; |
| 468 | } |
| 469 | |
| 470 | /* setup the timer */ |
| 471 | osmo_timer_setup(&db_sync_timer, db_sync_timer_cb, NULL); |
| 472 | if (msc_cmdline_config.use_db_counter) |
| 473 | osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL); |
| 474 | |
| 475 | signal(SIGINT, &signal_handler); |
Harald Welte | 6f750e6 | 2017-08-20 20:50:06 +0200 | [diff] [blame^] | 476 | signal(SIGTERM, &signal_handler); |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 477 | signal(SIGABRT, &signal_handler); |
| 478 | signal(SIGUSR1, &signal_handler); |
| 479 | signal(SIGUSR2, &signal_handler); |
| 480 | osmo_init_ignore_signals(); |
| 481 | |
| 482 | /* start the SMS queue */ |
| 483 | if (sms_queue_start(msc_network, 20) != 0) |
| 484 | return -1; |
| 485 | |
| 486 | msc_network->mgcpgw.client = mgcpgw_client_init( |
| 487 | msc_network, &msc_network->mgcpgw.conf); |
| 488 | |
| 489 | if (mgcpgw_client_connect(msc_network->mgcpgw.client)) { |
| 490 | printf("MGCPGW connect failed\n"); |
| 491 | return 7; |
| 492 | } |
| 493 | |
| 494 | /* Set up A-Interface */ |
| 495 | /* TODO: implement A-Interface and remove above legacy stuff. */ |
| 496 | |
| 497 | #ifdef BUILD_IU |
| 498 | /* Set up IuCS */ |
| 499 | iu_init(tall_msc_ctx, "127.0.0.1", 14001, rcvmsg_iu_cs, rx_iu_event); |
| 500 | #endif |
| 501 | |
| 502 | if (msc_cmdline_config.daemonize) { |
| 503 | rc = osmo_daemonize(); |
| 504 | if (rc < 0) { |
| 505 | perror("Error during daemonize"); |
| 506 | return 6; |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | while (1) { |
| 511 | log_reset_context(); |
| 512 | osmo_select_main(0); |
| 513 | } |
| 514 | } |