Change in osmo-sgsn[master]: main: change initialization order

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/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Feb 23 16:48:55 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/23048 )

Change subject: main: change initialization order
......................................................................

main: change initialization order

We must have initialized e.g. the NS protocol stack before calling
handle_options(), as that might want to dumpy the VTY XML, and it
can obviously only dump those nodes that are registered at that
point.

Change-Id: Icd1b8fb3f466cdace67ff0d4f7c85183d8266c41
---
M src/sgsn/sgsn_main.c
1 file changed, 17 insertions(+), 17 deletions(-)

Approvals:
  pespin: Looks good to me, approved; Verified
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c
index 6c57071..2cabbf3 100644
--- a/src/sgsn/sgsn_main.c
+++ b/src/sgsn/sgsn_main.c
@@ -407,23 +407,6 @@
 	osmo_sccp_vty_init();
 #endif
 
-	handle_options(argc, argv);
-
-	/* Backwards compatibility: for years, the default config file name was
-	 * osmo_sgsn.cfg. All other Osmocom programs use osmo-*.cfg with a
-	 * dash. To be able to use the new config file name without breaking
-	 * previous setups that might rely on the legacy default config file
-	 * name, we need to look for the old config file if no -c option was
-	 * passed AND no file exists with the new default file name. */
-	if (!sgsn->config_file) {
-		/* No -c option was passed */
-		if (file_exists(CONFIG_FILE_LEGACY)
-		    && !file_exists(CONFIG_FILE_DEFAULT))
-			osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_LEGACY);
-		else
-			osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_DEFAULT);
-	}
-
 	rate_ctr_init(tall_sgsn_ctx);
 
 	logging_vty_add_deprecated_subsys(tall_sgsn_ctx, "bssgp");
@@ -448,6 +431,23 @@
 	sgsn_auth_init(sgsn);
 	sgsn_cdr_init(sgsn);
 
+	handle_options(argc, argv);
+
+	/* Backwards compatibility: for years, the default config file name was
+	 * osmo_sgsn.cfg. All other Osmocom programs use osmo-*.cfg with a
+	 * dash. To be able to use the new config file name without breaking
+	 * previous setups that might rely on the legacy default config file
+	 * name, we need to look for the old config file if no -c option was
+	 * passed AND no file exists with the new default file name. */
+	if (!sgsn->config_file) {
+		/* No -c option was passed */
+		if (file_exists(CONFIG_FILE_LEGACY)
+		    && !file_exists(CONFIG_FILE_DEFAULT))
+			osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_LEGACY);
+		else
+			osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_DEFAULT);
+	}
+
 	rc = sgsn_parse_config(sgsn->config_file);
 	if (rc < 0) {
 		LOGP(DGPRS, LOGL_FATAL, "Error in config file\n");

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/23048
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Icd1b8fb3f466cdace67ff0d4f7c85183d8266c41
Gerrit-Change-Number: 23048
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210223/7869aaac/attachment.htm>


More information about the gerrit-log mailing list