<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/23048">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  pespin: Looks good to me, approved; Verified
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main: change initialization order<br><br>We must have initialized e.g. the NS protocol stack before calling<br>handle_options(), as that might want to dumpy the VTY XML, and it<br>can obviously only dump those nodes that are registered at that<br>point.<br><br>Change-Id: Icd1b8fb3f466cdace67ff0d4f7c85183d8266c41<br>---<br>M src/sgsn/sgsn_main.c<br>1 file changed, 17 insertions(+), 17 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c</span><br><span>index 6c57071..2cabbf3 100644</span><br><span>--- a/src/sgsn/sgsn_main.c</span><br><span>+++ b/src/sgsn/sgsn_main.c</span><br><span>@@ -407,23 +407,6 @@</span><br><span>     osmo_sccp_vty_init();</span><br><span> #endif</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     handle_options(argc, argv);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-     /* Backwards compatibility: for years, the default config file name was</span><br><span style="color: hsl(0, 100%, 40%);">-  * osmo_sgsn.cfg. All other Osmocom programs use osmo-*.cfg with a</span><br><span style="color: hsl(0, 100%, 40%);">-       * dash. To be able to use the new config file name without breaking</span><br><span style="color: hsl(0, 100%, 40%);">-     * previous setups that might rely on the legacy default config file</span><br><span style="color: hsl(0, 100%, 40%);">-     * name, we need to look for the old config file if no -c option was</span><br><span style="color: hsl(0, 100%, 40%);">-     * passed AND no file exists with the new default file name. */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!sgsn->config_file) {</span><br><span style="color: hsl(0, 100%, 40%);">-            /* No -c option was passed */</span><br><span style="color: hsl(0, 100%, 40%);">-           if (file_exists(CONFIG_FILE_LEGACY)</span><br><span style="color: hsl(0, 100%, 40%);">-                 && !file_exists(CONFIG_FILE_DEFAULT))</span><br><span style="color: hsl(0, 100%, 40%);">-                       osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_LEGACY);</span><br><span style="color: hsl(0, 100%, 40%);">-                else</span><br><span style="color: hsl(0, 100%, 40%);">-                    osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_DEFAULT);</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>    rate_ctr_init(tall_sgsn_ctx);</span><br><span> </span><br><span>    logging_vty_add_deprecated_subsys(tall_sgsn_ctx, "bssgp");</span><br><span>@@ -448,6 +431,23 @@</span><br><span>  sgsn_auth_init(sgsn);</span><br><span>        sgsn_cdr_init(sgsn);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      handle_options(argc, argv);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Backwards compatibility: for years, the default config file name was</span><br><span style="color: hsl(120, 100%, 40%);">+        * osmo_sgsn.cfg. All other Osmocom programs use osmo-*.cfg with a</span><br><span style="color: hsl(120, 100%, 40%);">+     * dash. To be able to use the new config file name without breaking</span><br><span style="color: hsl(120, 100%, 40%);">+   * previous setups that might rely on the legacy default config file</span><br><span style="color: hsl(120, 100%, 40%);">+   * name, we need to look for the old config file if no -c option was</span><br><span style="color: hsl(120, 100%, 40%);">+   * passed AND no file exists with the new default file name. */</span><br><span style="color: hsl(120, 100%, 40%);">+       if (!sgsn->config_file) {</span><br><span style="color: hsl(120, 100%, 40%);">+          /* No -c option was passed */</span><br><span style="color: hsl(120, 100%, 40%);">+         if (file_exists(CONFIG_FILE_LEGACY)</span><br><span style="color: hsl(120, 100%, 40%);">+               && !file_exists(CONFIG_FILE_DEFAULT))</span><br><span style="color: hsl(120, 100%, 40%);">+                     osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_LEGACY);</span><br><span style="color: hsl(120, 100%, 40%);">+              else</span><br><span style="color: hsl(120, 100%, 40%);">+                  osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_DEFAULT);</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  rc = sgsn_parse_config(sgsn->config_file);</span><br><span>        if (rc < 0) {</span><br><span>             LOGP(DGPRS, LOGL_FATAL, "Error in config file\n");</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/23048">change 23048</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-sgsn/+/23048"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sgsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Icd1b8fb3f466cdace67ff0d4f7c85183d8266c41 </div>
<div style="display:none"> Gerrit-Change-Number: 23048 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>