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/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/1150 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 --- M openbsc/src/osmo-bsc/osmo_bsc_main.c M openbsc/src/osmo-nitb/bsc_hack.c 2 files changed, 25 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/50/1150/1 diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index b6b1ae1..1d96bb4 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -194,6 +194,13 @@ 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 @@ /* 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"); diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index 4e15b2d..a664cdb 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -269,7 +269,18 @@ osmo_stats_init(tall_bsc_ctx); bts_init(); - /* This needs to precede handle_options() */ + /* Parse options */ + handle_options(argc, argv); + + /* Allocate global gsm_network struct; choose socket/internal MNCC */ + rc = bsc_network_alloc(mncc_sock_path? + mncc_sock_from_cc : int_mncc_recv); + if (rc) { + fprintf(stderr, "Allocation failed. Exiting.\n"); + exit(1); + } + + /* Initialize VTY */ vty_init(&vty_info); bsc_vty_init(&log_info, bsc_gsmnet); ctrl_vty_init(tall_bsc_ctx); @@ -279,25 +290,13 @@ return -1; #endif - /* parse options */ - handle_options(argc, argv); - - /* internal MNCC handler or MNCC socket? */ - if (mncc_sock_path) { - rc = bsc_network_alloc(mncc_sock_from_cc); - if (rc) { - fprintf(stderr, "Allocation failed. Exiting.\n"); - exit(1); - } + /* Initialize MNCC socket if appropriate */ + if (mncc_sock_path) mncc_sock_init(bsc_gsmnet, mncc_sock_path); - } else { + else DEBUGP(DMNCC, "Using internal MNCC handler.\n"); - rc = bsc_network_alloc(int_mncc_recv); - if (rc) { - fprintf(stderr, "Allocation failed. Exiting.\n"); - exit(1); - } - } + + /* Read the config */ rc = bsc_network_configure(config_file); if (rc < 0) { fprintf(stderr, "Reading config failed. Exiting.\n"); -- To view, visit https://gerrit.osmocom.org/1150 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie6a7037e703b5a2d08ceeb20d35f197aaddc9d1b Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>