aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-12 03:30:48 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-16 15:32:30 +0100
commit7a4632c67cd6abe114d4c4094272b7493cd3c57a (patch)
tree3b97bf9dedd961abb339d596a3000d16835ece59
parent1802ff99cfa9c085793448cbcf0f760d284cb2a9 (diff)
sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not sgsn_parse_config
It makes sense semantically, and prepares for an upcoming commit that uses the internal global config pointer in sgsn_vty_init(), which would not be defined yet without this. Change-Id: Ie4cf1c0a1c9e6330a134ff4b7b2e6d5699c12bd7
-rw-r--r--openbsc/include/openbsc/sgsn.h4
-rw-r--r--openbsc/src/gprs/sgsn_main.c4
-rw-r--r--openbsc/src/gprs/sgsn_vty.c9
3 files changed, 10 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h
index 1ede2c930..1ed1583ed 100644
--- a/openbsc/include/openbsc/sgsn.h
+++ b/openbsc/include/openbsc/sgsn.h
@@ -140,8 +140,8 @@ extern struct sgsn_instance *sgsn;
/* sgsn_vty.c */
-int sgsn_vty_init(void);
-int sgsn_parse_config(const char *config_file, struct sgsn_config *cfg);
+int sgsn_vty_init(struct sgsn_config *cfg);
+int sgsn_parse_config(const char *config_file);
/* sgsn.c */
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index 04f2825f7..221ee7976 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -347,7 +347,7 @@ int main(int argc, char **argv)
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
osmo_stats_vty_add_cmds(&gprs_log_info);
- sgsn_vty_init();
+ sgsn_vty_init(&sgsn_inst.cfg);
ctrl_vty_init(tall_bsc_ctx);
#ifdef BUILD_IU
iu_vty_init(&asn_debug);
@@ -379,7 +379,7 @@ int main(int argc, char **argv)
sgsn_cdr_init(&sgsn_inst);
/* FIXME: register signal handler for SS_L_NS */
- rc = sgsn_parse_config(sgsn_inst.config_file, &sgsn_inst.cfg);
+ rc = sgsn_parse_config(sgsn_inst.config_file);
if (rc < 0) {
LOGP(DGPRS, LOGL_FATAL, "Error in config file\n");
exit(2);
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index d42a1653a..522533adc 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -1221,8 +1221,10 @@ DEFUN(cfg_comp_v42bisp, cfg_comp_v42bisp_cmd,
return CMD_SUCCESS;
}
-int sgsn_vty_init(void)
+int sgsn_vty_init(struct sgsn_config *cfg)
{
+ g_cfg = cfg;
+
install_element_ve(&show_sgsn_cmd);
//install_element_ve(&show_mmctx_tlli_cmd);
install_element_ve(&show_mmctx_imsi_cmd);
@@ -1284,11 +1286,12 @@ int sgsn_vty_init(void)
return 0;
}
-int sgsn_parse_config(const char *config_file, struct sgsn_config *cfg)
+int sgsn_parse_config(const char *config_file)
{
int rc;
- g_cfg = cfg;
+ /* make sure sgsn_vty_init() was called before this */
+ OSMO_ASSERT(g_cfg);
g_cfg->timers.T3312 = GSM0408_T3312_SECS;
g_cfg->timers.T3322 = GSM0408_T3322_SECS;