Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 1 | /* GTP Hub main program */ |
| 2 | |
| 3 | /* (C) 2015 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> |
| 4 | * All Rights Reserved |
| 5 | * |
| 6 | * Author: Neels Hofmeyr |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU Affero General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 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 Affero General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Affero General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #include <unistd.h> |
| 23 | #include <signal.h> |
| 24 | #include <string.h> |
| 25 | #include <errno.h> |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 26 | #include <inttypes.h> |
| 27 | #include <sys/stat.h> |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 28 | |
| 29 | #define _GNU_SOURCE |
| 30 | #include <getopt.h> |
| 31 | |
| 32 | #include <osmocom/core/signal.h> |
| 33 | #include <osmocom/core/application.h> |
| 34 | #include <osmocom/core/logging.h> |
| 35 | #include <osmocom/core/utils.h> |
| 36 | #include <osmocom/core/rate_ctr.h> |
| 37 | |
| 38 | #include <osmocom/vty/logging.h> |
| 39 | #include <osmocom/vty/telnet_interface.h> |
Neels Hofmeyr | 03933a4 | 2016-02-23 13:26:02 +0100 | [diff] [blame] | 40 | #include <osmocom/vty/ports.h> |
Harald Welte | 731930b | 2018-02-14 01:02:22 +0100 | [diff] [blame] | 41 | #include <osmocom/vty/misc.h> |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 42 | |
Neels Hofmeyr | 396f2e6 | 2017-09-04 15:13:25 +0200 | [diff] [blame] | 43 | #include <osmocom/sgsn/debug.h> |
| 44 | #include <osmocom/sgsn/gtphub.h> |
| 45 | #include <osmocom/sgsn/vty.h> |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 46 | |
| 47 | #include "../../bscconfig.h" |
| 48 | |
Max | 095de01 | 2017-10-26 15:27:12 +0200 | [diff] [blame] | 49 | #if BUILD_IU |
| 50 | #include <osmocom/sigtran/osmo_ss7.h> |
| 51 | #endif |
| 52 | |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 53 | extern void *osmo_gtphub_ctx; |
Pau Espin Pedrol | b1d1c24 | 2018-10-30 17:27:59 +0100 | [diff] [blame] | 54 | void *tall_sgsn_ctx; |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 55 | |
| 56 | const char *gtphub_copyright = |
| 57 | "Copyright (C) 2015 sysmocom s.f.m.c GmbH <info@sysmocom.de>\r\n" |
| 58 | "License AGPLv3+: GNU AGPL version 2 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n" |
| 59 | "This is free software: you are free to change and redistribute it.\r\n" |
| 60 | "There is NO WARRANTY, to the extent permitted by law.\r\n"; |
| 61 | |
| 62 | static struct log_info_cat gtphub_categories[] = { |
| 63 | [DGTPHUB] = { |
| 64 | .name = "DGTPHUB", |
| 65 | .description = "GTP Hub", |
| 66 | .color = "\033[1;33m", |
Neels Hofmeyr | d9b1d49 | 2015-11-18 18:11:09 +0100 | [diff] [blame] | 67 | .enabled = 1, |
Neels Hofmeyr | 69da1d4 | 2016-02-23 13:28:04 +0100 | [diff] [blame] | 68 | .loglevel = LOGL_INFO, |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 69 | }, |
| 70 | }; |
| 71 | |
| 72 | int gtphub_log_filter_fn(const struct log_context *ctx, |
| 73 | struct log_target *tar) |
| 74 | { |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | static const struct log_info gtphub_log_info = { |
| 79 | .filter_fn = gtphub_log_filter_fn, |
| 80 | .cat = gtphub_categories, |
| 81 | .num_cat = ARRAY_SIZE(gtphub_categories), |
| 82 | }; |
| 83 | |
| 84 | void log_cfg(struct gtphub_cfg *cfg) |
| 85 | { |
Neels Hofmeyr | a9905a5 | 2015-11-29 23:49:48 +0100 | [diff] [blame] | 86 | int side_idx, plane_idx; |
| 87 | for_each_side_and_plane(side_idx, plane_idx) { |
Neels Hofmeyr | 0855008 | 2015-11-30 12:19:50 +0100 | [diff] [blame] | 88 | struct gtphub_cfg_addr *a; |
Neels Hofmeyr | a9905a5 | 2015-11-29 23:49:48 +0100 | [diff] [blame] | 89 | a = &cfg->to_gsns[side_idx][plane_idx].bind; |
| 90 | LOGP(DGTPHUB, LOGL_NOTICE, |
| 91 | "to-%ss bind, %s: %s port %d\n", |
| 92 | gtphub_side_idx_names[side_idx], |
| 93 | gtphub_plane_idx_names[plane_idx], |
| 94 | a->addr_str, a->port); |
| 95 | } |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | static void signal_handler(int signal) |
| 99 | { |
Neels Hofmeyr | 0855008 | 2015-11-30 12:19:50 +0100 | [diff] [blame] | 100 | fprintf(stdout, "signal %d received\n", signal); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 101 | |
| 102 | switch (signal) { |
| 103 | case SIGINT: |
Harald Welte | 6f750e6 | 2017-08-20 20:50:06 +0200 | [diff] [blame] | 104 | case SIGTERM: |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 105 | osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL); |
| 106 | sleep(1); |
| 107 | exit(0); |
| 108 | break; |
| 109 | case SIGABRT: |
| 110 | /* in case of abort, we want to obtain a talloc report |
| 111 | * and then return to the caller, who will abort the process */ |
| 112 | case SIGUSR1: |
| 113 | case SIGUSR2: |
| 114 | talloc_report_full(osmo_gtphub_ctx, stderr); |
| 115 | break; |
| 116 | default: |
| 117 | break; |
| 118 | } |
| 119 | } |
| 120 | |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 121 | static struct vty_app_info vty_info = { |
| 122 | .name = "OsmoGTPhub", |
| 123 | .version = PACKAGE_VERSION, |
Philipp Maier | 4a547a1 | 2017-10-20 11:27:26 +0200 | [diff] [blame] | 124 | #if BUILD_IU |
Daniel Willmann | 62fa619 | 2020-11-03 09:07:45 +0100 | [diff] [blame] | 125 | .go_parent_cb = osmo_ss7_vty_go_parent, |
Philipp Maier | 4a547a1 | 2017-10-20 11:27:26 +0200 | [diff] [blame] | 126 | #endif |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | struct cmdline_cfg { |
| 130 | const char *config_file; |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 131 | const char *restart_counter_file; |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 132 | int daemonize; |
| 133 | }; |
| 134 | |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 135 | static uint8_t next_restart_count(const char *path) |
| 136 | { |
| 137 | int umask_was = umask(022); |
| 138 | |
| 139 | uint8_t counter = 0; |
| 140 | |
| 141 | FILE *f = fopen(path, "r"); |
| 142 | if (f) { |
| 143 | int rc = fscanf(f, "%hhu", &counter); |
| 144 | |
| 145 | if (rc != 1) |
| 146 | goto failed_to_read; |
| 147 | |
| 148 | char c; |
| 149 | while (fread(&c, 1, 1, f) > 0) { |
| 150 | switch (c) { |
| 151 | case ' ': |
| 152 | case '\t': |
| 153 | case '\n': |
| 154 | case '\r': |
| 155 | break; |
| 156 | default: |
| 157 | goto failed_to_read; |
| 158 | } |
| 159 | } |
| 160 | fclose(f); |
| 161 | } |
| 162 | |
| 163 | counter ++; |
| 164 | |
| 165 | f = fopen(path, "w"); |
| 166 | if (!f) |
| 167 | goto failed_to_write; |
| 168 | if (fprintf(f, "%" PRIu8 "\n", counter) < 2) |
| 169 | goto failed_to_write; |
Holger Hans Peter Freyther | de76661 | 2016-01-23 10:28:09 +0100 | [diff] [blame] | 170 | if (fclose(f)) { |
| 171 | f = NULL; |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 172 | goto failed_to_write; |
Holger Hans Peter Freyther | de76661 | 2016-01-23 10:28:09 +0100 | [diff] [blame] | 173 | } |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 174 | |
| 175 | umask(umask_was); |
| 176 | |
| 177 | LOGP(DGTPHUB, LOGL_NOTICE, "Restarted with counter %hhu\n", counter); |
| 178 | return counter; |
| 179 | |
| 180 | failed_to_read: |
| 181 | fclose(f); |
| 182 | umask(umask_was); |
| 183 | LOGP(DGTPHUB, LOGL_FATAL, "Restart counter file cannot be parsed:" |
| 184 | " %s\n", path); |
| 185 | exit(1); |
| 186 | |
| 187 | failed_to_write: |
| 188 | if (f) |
| 189 | fclose(f); |
| 190 | umask(umask_was); |
| 191 | LOGP(DGTPHUB, LOGL_FATAL, "Restart counter file cannot be written:" |
| 192 | " %s\n", path); |
| 193 | exit(1); |
| 194 | } |
| 195 | |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 196 | static void print_help(struct cmdline_cfg *ccfg) |
| 197 | { |
| 198 | printf("gtphub commandline options\n"); |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 199 | printf(" -h,--help This text.\n"); |
| 200 | printf(" -D,--daemonize Fork the process into a background daemon.\n"); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 201 | printf(" -d,--debug <cat> Enable Debugging for this category.\n"); |
| 202 | printf(" Pass '-d list' to get a category listing.\n"); |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 203 | printf(" -s,--disable-color\n"); |
| 204 | printf(" -c,--config-file <path> The config file to use [%s].\n", |
| 205 | ccfg->config_file); |
| 206 | printf(" -e,--log-level <nr> Set a global log level.\n"); |
| 207 | printf(" -r,--restart-file <path> File for counting restarts [%s].\n", |
| 208 | ccfg->restart_counter_file); |
Daniel Willmann | 03a2ed5 | 2019-07-26 11:56:31 +0200 | [diff] [blame] | 209 | printf(" -V,--version Print the version.\n"); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | static void list_categories(void) |
| 213 | { |
Ruben Undheim | 55fcf11 | 2018-09-25 22:59:34 +0200 | [diff] [blame] | 214 | printf("Available debug categories:\n"); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 215 | int i; |
| 216 | for (i = 0; i < gtphub_log_info.num_cat; ++i) { |
| 217 | if (!gtphub_log_info.cat[i].name) |
| 218 | continue; |
| 219 | |
| 220 | printf("%s\n", gtphub_log_info.cat[i].name); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | static void handle_options(struct cmdline_cfg *ccfg, int argc, char **argv) |
| 225 | { |
| 226 | while (1) { |
| 227 | int option_index = 0, c; |
| 228 | static struct option long_options[] = { |
| 229 | {"help", 0, 0, 'h'}, |
| 230 | {"debug", 1, 0, 'd'}, |
| 231 | {"daemonize", 0, 0, 'D'}, |
| 232 | {"config-file", 1, 0, 'c'}, |
| 233 | {"disable-color", 0, 0, 's'}, |
| 234 | {"timestamp", 0, 0, 'T'}, |
| 235 | {"log-level", 1, 0, 'e'}, |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 236 | {"restart-file", 1, 0, 'r'}, |
Oliver Smith | e64f0ef | 2018-10-16 17:09:18 +0200 | [diff] [blame] | 237 | { "version", 0, 0, 'V' }, |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 238 | {NULL, 0, 0, 0} |
| 239 | }; |
| 240 | |
Oliver Smith | e64f0ef | 2018-10-16 17:09:18 +0200 | [diff] [blame] | 241 | c = getopt_long(argc, argv, "hd:Dc:sTe:r:V", |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 242 | long_options, &option_index); |
Neels Hofmeyr | 8d1ffbd | 2015-11-26 05:20:18 +0100 | [diff] [blame] | 243 | if (c == -1) { |
| 244 | if (optind < argc) { |
| 245 | LOGP(DGTPHUB, LOGL_FATAL, |
| 246 | "Excess commandline arguments ('%s').\n", |
| 247 | argv[optind]); |
| 248 | exit(2); |
| 249 | } |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 250 | break; |
Neels Hofmeyr | 8d1ffbd | 2015-11-26 05:20:18 +0100 | [diff] [blame] | 251 | } |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 252 | |
| 253 | switch (c) { |
| 254 | case 'h': |
| 255 | //print_usage(); |
| 256 | print_help(ccfg); |
| 257 | exit(0); |
| 258 | case 's': |
| 259 | log_set_use_color(osmo_stderr_target, 0); |
| 260 | break; |
| 261 | case 'd': |
| 262 | if (strcmp("list", optarg) == 0) { |
| 263 | list_categories(); |
| 264 | exit(0); |
| 265 | } else |
| 266 | log_parse_category_mask(osmo_stderr_target, optarg); |
| 267 | break; |
| 268 | case 'D': |
| 269 | ccfg->daemonize = 1; |
| 270 | break; |
| 271 | case 'c': |
| 272 | ccfg->config_file = optarg; |
| 273 | break; |
| 274 | case 'T': |
| 275 | log_set_print_timestamp(osmo_stderr_target, 1); |
| 276 | break; |
| 277 | case 'e': |
| 278 | log_set_log_level(osmo_stderr_target, atoi(optarg)); |
| 279 | break; |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 280 | case 'r': |
| 281 | ccfg->restart_counter_file = optarg; |
| 282 | break; |
Oliver Smith | e64f0ef | 2018-10-16 17:09:18 +0200 | [diff] [blame] | 283 | case 'V': |
| 284 | print_version(1); |
| 285 | exit(EXIT_SUCCESS); |
| 286 | break; |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 287 | default: |
Neels Hofmeyr | 956d856 | 2015-12-06 16:40:24 +0100 | [diff] [blame] | 288 | LOGP(DGTPHUB, LOGL_FATAL, "Invalid command line argument, abort.\n"); |
| 289 | exit(1); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 290 | break; |
| 291 | } |
| 292 | } |
Harald Welte | de67c00 | 2019-12-03 22:28:19 +0100 | [diff] [blame] | 293 | |
| 294 | if (argc > optind) { |
| 295 | fprintf(stderr, "Unsupported positional arguments on command line\n"); |
| 296 | exit(2); |
| 297 | } |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | int main(int argc, char **argv) |
| 301 | { |
| 302 | int rc; |
| 303 | |
Neels Hofmeyr | 4b2cbda | 2015-11-20 03:16:19 +0100 | [diff] [blame] | 304 | struct cmdline_cfg _ccfg; |
| 305 | struct cmdline_cfg *ccfg = &_ccfg; |
| 306 | memset(ccfg, '\0', sizeof(*ccfg)); |
| 307 | ccfg->config_file = "./gtphub.conf"; |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 308 | ccfg->restart_counter_file = "./gtphub_restart_count"; |
Neels Hofmeyr | 4b2cbda | 2015-11-20 03:16:19 +0100 | [diff] [blame] | 309 | |
| 310 | struct gtphub_cfg _cfg; |
| 311 | struct gtphub_cfg *cfg = &_cfg; |
| 312 | memset(cfg, '\0', sizeof(*cfg)); |
| 313 | |
| 314 | struct gtphub _hub; |
| 315 | struct gtphub *hub = &_hub; |
| 316 | |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 317 | osmo_gtphub_ctx = talloc_named_const(NULL, 0, "osmo_gtphub"); |
Neels Hofmeyr | 4c2d4ab | 2016-09-16 02:31:17 +0200 | [diff] [blame] | 318 | msgb_talloc_ctx_init(osmo_gtphub_ctx, 0); |
Harald Welte | 731930b | 2018-02-14 01:02:22 +0100 | [diff] [blame] | 319 | vty_info.tall_ctx = osmo_gtphub_ctx; |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 320 | |
| 321 | signal(SIGINT, &signal_handler); |
Harald Welte | 6f750e6 | 2017-08-20 20:50:06 +0200 | [diff] [blame] | 322 | signal(SIGTERM, &signal_handler); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 323 | signal(SIGABRT, &signal_handler); |
| 324 | signal(SIGUSR1, &signal_handler); |
| 325 | signal(SIGUSR2, &signal_handler); |
| 326 | osmo_init_ignore_signals(); |
| 327 | |
Neels Hofmeyr | 5bd340e | 2018-04-16 00:57:10 +0200 | [diff] [blame] | 328 | osmo_init_logging2(osmo_gtphub_ctx, >phub_log_info); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 329 | |
| 330 | vty_info.copyright = gtphub_copyright; |
| 331 | vty_init(&vty_info); |
Pau Espin Pedrol | e456e32 | 2019-08-05 16:03:39 +0200 | [diff] [blame] | 332 | logging_vty_add_cmds(); |
Harald Welte | 731930b | 2018-02-14 01:02:22 +0100 | [diff] [blame] | 333 | osmo_talloc_vty_add_cmds(); |
Neels Hofmeyr | 4b2cbda | 2015-11-20 03:16:19 +0100 | [diff] [blame] | 334 | gtphub_vty_init(hub, cfg); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 335 | |
| 336 | rate_ctr_init(osmo_gtphub_ctx); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 337 | |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 338 | handle_options(ccfg, argc, argv); |
| 339 | |
| 340 | rc = gtphub_cfg_read(cfg, ccfg->config_file); |
| 341 | if (rc < 0) { |
Neels Hofmeyr | d9b1d49 | 2015-11-18 18:11:09 +0100 | [diff] [blame] | 342 | LOGP(DGTPHUB, LOGL_FATAL, "Cannot parse config file '%s'\n", |
| 343 | ccfg->config_file); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 344 | exit(2); |
| 345 | } |
| 346 | |
Neels Hofmeyr | fa0f715 | 2016-02-23 14:09:38 +0100 | [diff] [blame] | 347 | /* start telnet after reading config for vty_get_bind_addr() */ |
Neels Hofmeyr | fa0f715 | 2016-02-23 14:09:38 +0100 | [diff] [blame] | 348 | rc = telnet_init_dynif(osmo_gtphub_ctx, 0, vty_get_bind_addr(), |
| 349 | OSMO_VTY_PORT_GTPHUB); |
| 350 | if (rc < 0) |
| 351 | exit(1); |
| 352 | |
Neels Hofmeyr | ba9e9f6 | 2015-11-26 22:19:22 +0100 | [diff] [blame] | 353 | if (gtphub_start(hub, cfg, |
| 354 | next_restart_count(ccfg->restart_counter_file)) |
| 355 | != 0) |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 356 | return -1; |
| 357 | |
| 358 | log_cfg(cfg); |
| 359 | |
| 360 | if (ccfg->daemonize) { |
| 361 | rc = osmo_daemonize(); |
| 362 | if (rc < 0) { |
Neels Hofmeyr | d9b1d49 | 2015-11-18 18:11:09 +0100 | [diff] [blame] | 363 | LOGP(DGTPHUB, LOGL_FATAL, "Error during daemonize"); |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 364 | exit(1); |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | while (1) { |
| 369 | rc = osmo_select_main(0); |
| 370 | if (rc < 0) |
| 371 | exit(3); |
| 372 | } |
| 373 | |
| 374 | /* not reached */ |
| 375 | exit(0); |
| 376 | } |