aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-24 01:53:38 +0200
committerHarald Welte <laforge@gnumonks.org>2016-12-02 12:09:15 +0000
commit2c05f75bbf3d9a69eee1fe78eb5552acf1d7671d (patch)
tree843251c808341cd27e448b7f9abc0af327451934 /openbsc/src/osmo-bsc
parente235441f73a6baf1b43da9dde3cb6828ced9d1fe (diff)
global gsm_network: move allocation further up
Now that bsc_network_alloc() is separate, move it to before the VTY init (a subsequent patch will pass the gsm_network instance as a parameter to vty_init()). bsc_hack.c: drop the comment that says about the VTY init: "This needs to precede handle_options()" -- it is not accurate. Actually move the handle_options() above both vty_init() and the bsc_network_alloc() calls, to be able to decide which mncc callback to pass to bsc_network_alloc. It would make sense to set this later on, but that would require further refactoring of the bsc_network_init() and gsm_network_init() signatures, so not in this patch. Change-Id: Ie6a7037e703b5a2d08ceeb20d35f197aaddc9d1b
Diffstat (limited to 'openbsc/src/osmo-bsc')
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c
index b6b1ae16e..1d96bb414 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_main.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c
@@ -194,6 +194,13 @@ int main(int argc, char **argv)
tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
+ /* Allocate global gsm_network struct */
+ rc = bsc_network_alloc(NULL);
+ if (rc) {
+ fprintf(stderr, "Allocation failed. exiting.\n");
+ exit(1);
+ }
+
osmo_init_logging(&log_info);
osmo_stats_init(tall_bsc_ctx);
@@ -220,11 +227,7 @@ int main(int argc, char **argv)
/* initialize SCCP */
sccp_set_log_area(DSCCP);
- rc = bsc_network_alloc(NULL);
- if (rc) {
- fprintf(stderr, "Allocation failed. exiting.\n");
- exit(1);
- }
+ /* Read the config */
rc = bsc_network_configure(config_file);
if (rc < 0) {
fprintf(stderr, "Bootstrapping the network failed. exiting.\n");