This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3884 to look at the new patch set (#2). Add arbitrary config file location support All other Osmocom projects use '-c' command line option to specify the location of config file. Let's do the same with fallback to existing implicit config file name logic. Also print config file path and vty host on startup. Change-Id: Idaac3ff8d1f8541e00c45290db948a67bb899311 --- M src/host/layer23/src/mobile/app_mobile.c M src/host/layer23/src/mobile/main.c 2 files changed, 16 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/84/3884/2 diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 7dc7208..fd2c94f 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -409,12 +409,13 @@ " using: 'touch %s'\n", config_file); return rc; } + printf("Using configuration from %s\n", config_file); } vty_reading = 0; rc = telnet_init_dynif(l23_ctx, NULL, vty_ip, vty_port); if (rc < 0) return rc; - printf("VTY available on port %u.\n", vty_port); + printf("VTY available on %s %u\n", vty_ip, vty_port); osmo_signal_register_handler(SS_GLOBAL, &global_signal_cb, NULL); osmo_signal_register_handler(SS_L1CTL, &mobile_signal_cb, NULL); diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c index 630bc53..4a2e4ec 100644 --- a/src/host/layer23/src/mobile/main.c +++ b/src/host/layer23/src/mobile/main.c @@ -38,6 +38,7 @@ #include <getopt.h> #include <stdlib.h> #include <stdio.h> +#include <stdbool.h> #include <unistd.h> #include <string.h> #include <errno.h> @@ -51,6 +52,8 @@ void *l23_ctx = NULL; struct llist_head ms_list; static char *gsmtap_ip = 0; +static const char *config_file = ".osmocom/bb/mobile.cfg"; +bool use_default_cfg = true; struct gsmtap_inst *gsmtap_inst = NULL; static char *vty_ip = "127.0.0.1"; unsigned short vty_port = 4247; @@ -96,6 +99,7 @@ printf(" -d --debug Change debug flags. default: %s\n", debug_default); printf(" -D --daemonize Run as daemon\n"); + printf(" -c --config-file filename The config file to use.\n"); printf(" -m --mncc-sock Disable built-in MNCC handler and " "offer socket\n"); } @@ -111,11 +115,12 @@ {"vty-port", 1, 0, 'v'}, {"debug", 1, 0, 'd'}, {"daemonize", 0, 0, 'D'}, + {"config-file", 1, 0, 'c'}, {"mncc-sock", 0, 0, 'm'}, {0, 0, 0, 0}, }; - c = getopt_long(argc, argv, "hi:u:v:d:Dm", + c = getopt_long(argc, argv, "hi:u:c:v:d:Dm", long_options, &option_index); if (c == -1) break; @@ -131,6 +136,10 @@ break; case 'u': vty_ip = optarg; + break; + case 'c': + config_file = optarg; + use_default_cfg = false; break; case 'v': vty_port = atoi(optarg); @@ -202,9 +211,6 @@ int quit = 0; int rc; char const * home; - size_t len; - const char osmocomcfg[] = ".osmocom/bb/mobile.cfg"; - char *config_file = NULL; printf("%s\n", openbsc_copyright); @@ -234,13 +240,11 @@ gsmtap_source_add_sink(gsmtap_inst); } - home = getenv("HOME"); - if (home != NULL) { - len = strlen(home) + 1 + sizeof(osmocomcfg); - config_file = talloc_size(l23_ctx, len); - if (config_file != NULL) - snprintf(config_file, len, "%s/%s", home, osmocomcfg); + if (use_default_cfg) { + home = talloc_strdup(l23_ctx, getenv("HOME")); + config_file = talloc_asprintf_append(home, "/%s", config_file); } + /* save the config file directory name */ config_dir = talloc_strdup(l23_ctx, config_file); config_dir = dirname(config_dir); -- To view, visit https://gerrit.osmocom.org/3884 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Idaac3ff8d1f8541e00c45290db948a67bb899311 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder