Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1 | /* A hackish minimal BSC (+MSC +HLR) implementation */ |
| 2 | |
Harald Welte | 1c36947 | 2010-01-12 10:46:27 +0100 | [diff] [blame] | 3 | /* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 4 | * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 5 | * 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 | |
| 23 | #include <unistd.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 24 | #include <time.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 25 | #include <errno.h> |
| 26 | #include <signal.h> |
| 27 | #include <fcntl.h> |
| 28 | #include <sys/stat.h> |
| 29 | |
| 30 | #define _GNU_SOURCE |
| 31 | #include <getopt.h> |
| 32 | |
| 33 | #include <openbsc/db.h> |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 34 | #include <osmocore/select.h> |
Harald Welte | c4ae176 | 2010-08-25 19:43:54 +0200 | [diff] [blame] | 35 | #include <osmocore/process.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 36 | #include <openbsc/debug.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 37 | #include <openbsc/e1_input.h> |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 38 | #include <osmocore/talloc.h> |
Harald Welte | d21adfe | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 39 | #include <openbsc/signal.h> |
Holger Hans Peter Freyther | c7efbe4 | 2010-06-30 14:30:35 +0800 | [diff] [blame] | 40 | #include <openbsc/osmo_msc.h> |
Holger Hans Peter Freyther | 19ce77c | 2010-08-26 15:38:42 +0800 | [diff] [blame] | 41 | #include <openbsc/vty.h> |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 42 | |
| 43 | #include "../bscconfig.h" |
| 44 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 45 | /* MCC and MNC for the Location Area Identifier */ |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 46 | static struct log_target *stderr_target; |
Holger Hans Peter Freyther | cad370f | 2009-08-17 06:55:10 +0200 | [diff] [blame] | 47 | struct gsm_network *bsc_gsmnet = 0; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 48 | static const char *database_name = "hlr.sqlite3"; |
Holger Hans Peter Freyther | 4fa91d0 | 2009-08-10 08:39:27 +0200 | [diff] [blame] | 49 | static const char *config_file = "openbsc.cfg"; |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 50 | extern const char *openbsc_copyright; |
Harald Welte | c4ae176 | 2010-08-25 19:43:54 +0200 | [diff] [blame] | 51 | static int daemonize = 0; |
Holger Hans Peter Freyther | 76037f0 | 2009-12-23 05:29:04 +0100 | [diff] [blame] | 52 | |
| 53 | /* timer to store statistics */ |
| 54 | #define DB_SYNC_INTERVAL 60, 0 |
| 55 | static struct timer_list db_sync_timer; |
| 56 | |
Holger Hans Peter Freyther | cad370f | 2009-08-17 06:55:10 +0200 | [diff] [blame] | 57 | extern int bsc_bootstrap_network(int (*mmc_rev)(struct gsm_network *, int, void *), |
| 58 | const char *cfg_file); |
| 59 | extern int bsc_shutdown_net(struct gsm_network *net); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 60 | |
| 61 | static void create_pcap_file(char *file) |
| 62 | { |
| 63 | mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; |
| 64 | int fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, mode); |
| 65 | |
| 66 | if (fd < 0) { |
| 67 | perror("Failed to open file for pcap"); |
| 68 | return; |
| 69 | } |
| 70 | |
| 71 | e1_set_pcap_fd(fd); |
| 72 | } |
| 73 | |
| 74 | static void print_usage() |
| 75 | { |
| 76 | printf("Usage: bsc_hack\n"); |
| 77 | } |
| 78 | |
| 79 | static void print_help() |
| 80 | { |
| 81 | printf(" Some useful help...\n"); |
Harald Welte | 6286888 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 82 | printf(" -h --help this text\n"); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 83 | printf(" -d option --debug=DRLL:DCC:DMM:DRR:DRSL:DNM enable debugging\n"); |
Harald Welte | c4ae176 | 2010-08-25 19:43:54 +0200 | [diff] [blame] | 84 | printf(" -D --daemonize Fork the process into a background daemon\n"); |
Holger Hans Peter Freyther | 4fa91d0 | 2009-08-10 08:39:27 +0200 | [diff] [blame] | 85 | printf(" -c --config-file filename The config file to use.\n"); |
Holger Hans Peter Freyther | b913c4d | 2010-03-25 02:41:38 +0100 | [diff] [blame] | 86 | printf(" -s --disable-color\n"); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 87 | printf(" -l --database db-name The database to use\n"); |
Holger Hans Peter Freyther | b913c4d | 2010-03-25 02:41:38 +0100 | [diff] [blame] | 88 | printf(" -a --authorize-everyone. Authorize every new subscriber. Dangerous!.\n"); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 89 | printf(" -p --pcap file The filename of the pcap file\n"); |
Harald Welte | bea12fe | 2009-08-12 21:52:11 +0200 | [diff] [blame] | 90 | printf(" -T --timestamp Prefix every log line with a timestamp\n"); |
Holger Hans Peter Freyther | b913c4d | 2010-03-25 02:41:38 +0100 | [diff] [blame] | 91 | printf(" -V --version. Print the version of OpenBSC.\n"); |
Harald Welte | dae9a01 | 2009-12-18 15:05:02 +0100 | [diff] [blame] | 92 | printf(" -P --rtp-proxy Enable the RTP Proxy code inside OpenBSC\n"); |
Holger Hans Peter Freyther | 38e15c0 | 2010-03-25 02:39:15 +0100 | [diff] [blame] | 93 | printf(" -e --log-level number. Set a global loglevel.\n"); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | static void handle_options(int argc, char** argv) |
| 97 | { |
| 98 | while (1) { |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 99 | int option_index = 0, c; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 100 | static struct option long_options[] = { |
| 101 | {"help", 0, 0, 'h'}, |
| 102 | {"debug", 1, 0, 'd'}, |
Harald Welte | c4ae176 | 2010-08-25 19:43:54 +0200 | [diff] [blame] | 103 | {"daemonize", 0, 0, 'D'}, |
Holger Hans Peter Freyther | 4fa91d0 | 2009-08-10 08:39:27 +0200 | [diff] [blame] | 104 | {"config-file", 1, 0, 'c'}, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 105 | {"disable-color", 0, 0, 's'}, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 106 | {"database", 1, 0, 'l'}, |
| 107 | {"authorize-everyone", 0, 0, 'a'}, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 108 | {"pcap", 1, 0, 'p'}, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 109 | {"timestamp", 0, 0, 'T'}, |
Harald Welte | fa13cad | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 110 | {"version", 0, 0, 'V' }, |
Harald Welte | 3c06207 | 2009-07-28 18:25:29 +0200 | [diff] [blame] | 111 | {"rtp-proxy", 0, 0, 'P'}, |
Holger Hans Peter Freyther | 38e15c0 | 2010-03-25 02:39:15 +0100 | [diff] [blame] | 112 | {"log-level", 1, 0, 'e'}, |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 113 | {0, 0, 0, 0} |
| 114 | }; |
| 115 | |
Harald Welte | c4ae176 | 2010-08-25 19:43:54 +0200 | [diff] [blame] | 116 | c = getopt_long(argc, argv, "hd:Dsl:ar:p:TPVc:e:", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 117 | long_options, &option_index); |
| 118 | if (c == -1) |
| 119 | break; |
| 120 | |
| 121 | switch (c) { |
| 122 | case 'h': |
| 123 | print_usage(); |
| 124 | print_help(); |
| 125 | exit(0); |
| 126 | case 's': |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 127 | log_set_use_color(stderr_target, 0); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 128 | break; |
| 129 | case 'd': |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 130 | log_parse_category_mask(stderr_target, optarg); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 131 | break; |
Harald Welte | c4ae176 | 2010-08-25 19:43:54 +0200 | [diff] [blame] | 132 | case 'D': |
| 133 | daemonize = 1; |
| 134 | break; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 135 | case 'l': |
| 136 | database_name = strdup(optarg); |
| 137 | break; |
Holger Hans Peter Freyther | 4fa91d0 | 2009-08-10 08:39:27 +0200 | [diff] [blame] | 138 | case 'c': |
| 139 | config_file = strdup(optarg); |
| 140 | break; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 141 | case 'p': |
| 142 | create_pcap_file(optarg); |
| 143 | break; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 144 | case 'T': |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 145 | log_set_print_timestamp(stderr_target, 1); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 146 | break; |
Harald Welte | 3c06207 | 2009-07-28 18:25:29 +0200 | [diff] [blame] | 147 | case 'P': |
| 148 | ipacc_rtp_direct = 0; |
| 149 | break; |
Holger Hans Peter Freyther | 38e15c0 | 2010-03-25 02:39:15 +0100 | [diff] [blame] | 150 | case 'e': |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 151 | log_set_log_level(stderr_target, atoi(optarg)); |
Holger Hans Peter Freyther | 38e15c0 | 2010-03-25 02:39:15 +0100 | [diff] [blame] | 152 | break; |
Harald Welte | fa13cad | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 153 | case 'V': |
Harald Welte | 10c29f6 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 154 | print_version(1); |
Harald Welte | fa13cad | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 155 | exit(0); |
| 156 | break; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 157 | default: |
| 158 | /* ignore */ |
| 159 | break; |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
Harald Welte | 0c83660 | 2009-12-24 10:51:56 +0100 | [diff] [blame] | 164 | extern void *tall_vty_ctx; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 165 | static void signal_handler(int signal) |
| 166 | { |
| 167 | fprintf(stdout, "signal %u received\n", signal); |
| 168 | |
| 169 | switch (signal) { |
Harald Welte | 3b71450 | 2009-08-06 17:43:50 +0200 | [diff] [blame] | 170 | case SIGINT: |
Holger Hans Peter Freyther | cad370f | 2009-08-17 06:55:10 +0200 | [diff] [blame] | 171 | bsc_shutdown_net(bsc_gsmnet); |
Harald Welte | d21adfe | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 172 | dispatch_signal(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL); |
Harald Welte | 3b71450 | 2009-08-06 17:43:50 +0200 | [diff] [blame] | 173 | sleep(3); |
| 174 | exit(0); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 175 | break; |
Harald Welte | 4d5e6d5 | 2009-08-07 00:29:44 +0200 | [diff] [blame] | 176 | case SIGABRT: |
| 177 | /* in case of abort, we want to obtain a talloc report |
| 178 | * and then return to the caller, who will abort the process */ |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 179 | case SIGUSR1: |
Harald Welte | 0c83660 | 2009-12-24 10:51:56 +0100 | [diff] [blame] | 180 | talloc_report(tall_vty_ctx, stderr); |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 181 | talloc_report_full(tall_bsc_ctx, stderr); |
| 182 | break; |
Harald Welte | 0c83660 | 2009-12-24 10:51:56 +0100 | [diff] [blame] | 183 | case SIGUSR2: |
| 184 | talloc_report_full(tall_vty_ctx, stderr); |
| 185 | break; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 186 | default: |
| 187 | break; |
| 188 | } |
| 189 | } |
| 190 | |
Holger Hans Peter Freyther | 76037f0 | 2009-12-23 05:29:04 +0100 | [diff] [blame] | 191 | /* timer handling */ |
| 192 | static int _db_store_counter(struct counter *counter, void *data) |
| 193 | { |
| 194 | return db_store_counter(counter); |
| 195 | } |
| 196 | |
| 197 | static void db_sync_timer_cb(void *data) |
| 198 | { |
| 199 | /* store counters to database and re-schedule */ |
| 200 | counters_for_each(_db_store_counter, NULL); |
| 201 | bsc_schedule_timer(&db_sync_timer, DB_SYNC_INTERVAL); |
| 202 | } |
| 203 | |
Daniel Willmann | 2ac4edf | 2010-01-11 13:50:44 +0100 | [diff] [blame] | 204 | extern int bts_model_unknown_init(void); |
Harald Welte | 59698fb | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 205 | extern int bts_model_bs11_init(void); |
| 206 | extern int bts_model_nanobts_init(void); |
| 207 | |
Holger Hans Peter Freyther | 3538c77 | 2010-06-08 16:11:06 +0800 | [diff] [blame] | 208 | extern enum node_type bsc_vty_go_parent(struct vty *vty); |
Harald Welte | 778c4b9 | 2010-05-25 23:31:39 +0200 | [diff] [blame] | 209 | |
| 210 | static struct vty_app_info vty_info = { |
| 211 | .name = "OpenBSC", |
| 212 | .version = PACKAGE_VERSION, |
| 213 | .go_parent_cb = bsc_vty_go_parent, |
Holger Hans Peter Freyther | 19ce77c | 2010-08-26 15:38:42 +0800 | [diff] [blame] | 214 | .is_config_node = bsc_vty_is_config_node, |
Harald Welte | 778c4b9 | 2010-05-25 23:31:39 +0200 | [diff] [blame] | 215 | }; |
| 216 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 217 | int main(int argc, char **argv) |
| 218 | { |
| 219 | int rc; |
| 220 | |
Harald Welte | 778c4b9 | 2010-05-25 23:31:39 +0200 | [diff] [blame] | 221 | vty_info.copyright = openbsc_copyright; |
| 222 | |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 223 | log_init(&log_info); |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 224 | tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc"); |
Harald Welte (local) | 8751ee9 | 2009-08-15 02:30:58 +0200 | [diff] [blame] | 225 | talloc_ctx_init(); |
Harald Welte (local) | bd931f1 | 2009-08-13 13:52:14 +0200 | [diff] [blame] | 226 | on_dso_load_token(); |
Harald Welte (local) | 9571378 | 2009-08-16 13:18:51 +0200 | [diff] [blame] | 227 | on_dso_load_rrlp(); |
Harald Welte | b90d7bd | 2009-12-17 00:31:10 +0100 | [diff] [blame] | 228 | on_dso_load_ho_dec(); |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 229 | stderr_target = log_target_create_stderr(); |
| 230 | log_add_target(stderr_target); |
Holger Hans Peter Freyther | c8d862e | 2009-12-22 22:32:51 +0100 | [diff] [blame] | 231 | |
Daniel Willmann | 2ac4edf | 2010-01-11 13:50:44 +0100 | [diff] [blame] | 232 | bts_model_unknown_init(); |
Harald Welte | 59698fb | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 233 | bts_model_bs11_init(); |
| 234 | bts_model_nanobts_init(); |
| 235 | |
Holger Hans Peter Freyther | c8d862e | 2009-12-22 22:32:51 +0100 | [diff] [blame] | 236 | /* enable filters */ |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 237 | log_set_all_filter(stderr_target, 1); |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 238 | |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 239 | /* This needs to precede handle_options() */ |
Harald Welte | 778c4b9 | 2010-05-25 23:31:39 +0200 | [diff] [blame] | 240 | vty_init(&vty_info); |
Harald Welte | 4015287 | 2010-05-16 20:52:23 +0200 | [diff] [blame] | 241 | bsc_vty_init(); |
| 242 | |
Holger Hans Peter Freyther | 4f8b9eb | 2010-05-31 21:42:53 +0800 | [diff] [blame] | 243 | /* parse options */ |
| 244 | handle_options(argc, argv); |
| 245 | |
Harald Welte | 10c29f6 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 246 | rc = bsc_bootstrap_network(mncc_recv, config_file); |
| 247 | if (rc < 0) |
| 248 | exit(1); |
Holger Hans Peter Freyther | c7efbe4 | 2010-06-30 14:30:35 +0800 | [diff] [blame] | 249 | bsc_api_init(bsc_gsmnet, msc_bsc_api()); |
Harald Welte | 10c29f6 | 2010-05-16 19:20:24 +0200 | [diff] [blame] | 250 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 251 | /* seed the PRNG */ |
| 252 | srand(time(NULL)); |
| 253 | |
Holger Hans Peter Freyther | cad370f | 2009-08-17 06:55:10 +0200 | [diff] [blame] | 254 | if (db_init(database_name)) { |
| 255 | printf("DB: Failed to init database. Please check the option settings.\n"); |
| 256 | return -1; |
| 257 | } |
| 258 | printf("DB: Database initialized.\n"); |
| 259 | |
| 260 | if (db_prepare()) { |
| 261 | printf("DB: Failed to prepare database.\n"); |
| 262 | return -1; |
| 263 | } |
| 264 | printf("DB: Database prepared.\n"); |
| 265 | |
Holger Hans Peter Freyther | 76037f0 | 2009-12-23 05:29:04 +0100 | [diff] [blame] | 266 | /* setup the timer */ |
| 267 | db_sync_timer.cb = db_sync_timer_cb; |
| 268 | db_sync_timer.data = NULL; |
| 269 | bsc_schedule_timer(&db_sync_timer, DB_SYNC_INTERVAL); |
| 270 | |
Harald Welte | 3b71450 | 2009-08-06 17:43:50 +0200 | [diff] [blame] | 271 | signal(SIGINT, &signal_handler); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 272 | signal(SIGABRT, &signal_handler); |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 273 | signal(SIGUSR1, &signal_handler); |
Harald Welte | 0c83660 | 2009-12-24 10:51:56 +0100 | [diff] [blame] | 274 | signal(SIGUSR2, &signal_handler); |
Holger Hans Peter Freyther | 49b05d3 | 2009-11-24 20:06:41 +0100 | [diff] [blame] | 275 | signal(SIGPIPE, SIG_IGN); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 276 | |
Harald Welte | c4ae176 | 2010-08-25 19:43:54 +0200 | [diff] [blame] | 277 | if (daemonize) { |
| 278 | rc = osmo_daemonize(); |
| 279 | if (rc < 0) { |
| 280 | perror("Error during daemonize"); |
| 281 | exit(1); |
| 282 | } |
| 283 | } |
| 284 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 285 | while (1) { |
Holger Hans Peter Freyther | cad370f | 2009-08-17 06:55:10 +0200 | [diff] [blame] | 286 | bsc_upqueue(bsc_gsmnet); |
Harald Welte | 51d2a59 | 2010-03-26 21:28:59 +0800 | [diff] [blame] | 287 | log_reset_context(); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 288 | bsc_select_main(0); |
| 289 | } |
| 290 | } |