[MERGED] osmo-msc[master]: sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not ...

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.org
Tue Aug 22 12:32:35 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not sgsn_parse_config
......................................................................


sgsn init: pass sgsn_config pointer to sgsn_vty_init(), not sgsn_parse_config

In an upcoming commit, sgsn_vty_init() will require access to the global sgsn
config struct to initialize a generic VTY command with the proper config
destination address, see Change-Id I5b5b6a9678b458affa86800afb1ec726e66eed88.

Change-Id: Ie6b6e5422987586531a898e0c5b867623dbecb0f
---
M include/openbsc/sgsn.h
M src/gprs/sgsn_main.c
M src/gprs/sgsn_vty.c
3 files changed, 10 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/openbsc/sgsn.h b/include/openbsc/sgsn.h
index 1ede2c9..1ed1583 100644
--- a/include/openbsc/sgsn.h
+++ b/include/openbsc/sgsn.h
@@ -140,8 +140,8 @@
 
 /* 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/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index 41cebef..d871939 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -350,7 +350,7 @@
 	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);
@@ -382,7 +382,7 @@
 	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/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index e09a029..1cefe37 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -1222,8 +1222,10 @@
 	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);
@@ -1285,11 +1287,12 @@
 	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;

-- 
To view, visit https://gerrit.osmocom.org/3346
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie6b6e5422987586531a898e0c5b867623dbecb0f
Gerrit-PatchSet: 4
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list