pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/31354 )
Change subject: layer23: Fix cmdline args not applied
......................................................................
layer23: Fix cmdline args not applied
A recent commit broke setting values set on the MS object from the
command line. That's due to a chicken-and-egg problem between app hooks and
the layer23 initialization code. It is desirable to initialize memory
before parsing command line and VTY, so that the data model exists
already and cmdline/VTY commands can apply the new settings directly on
the objects.
However, unlike VTY commands, the cmdline commands were not really
applying the settings to the already created objects, but only storing
it in the global variable which is used during object creation (hence
only objects created *after* command like, aka l23_start() or VTY
would have it applied.
In order to fix it, simply iterate over the existing list of MS objects
and update the setting from the command line in there.
Related: OS#5907
Change-Id: I285a4908401659b69dac513dd1a4b07facb88c51
---
M src/host/layer23/src/common/main.c
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/54/31354/1
diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c
index e82457f..58f3ede 100644
--- a/src/host/layer23/src/common/main.c
+++ b/src/host/layer23/src/common/main.c
@@ -137,6 +137,7 @@
{
struct option *long_options;
char *opt;
+ struct osmocom_ms *ms;
build_config(&opt, &long_options);
@@ -156,12 +157,18 @@
break;
case 's':
layer2_socket_path = optarg;
+ llist_for_each_entry(ms, &ms_list, entity)
+ OSMO_STRLCPY_ARRAY(ms->settings.sap_socket_path, layer2_socket_path);
break;
case 'S':
sap_socket_path = talloc_strdup(l23_ctx, optarg);
+ llist_for_each_entry(ms, &ms_list, entity)
+ OSMO_STRLCPY_ARRAY(ms->settings.sap_socket_path, sap_socket_path);
break;
case 'a':
cfg_test_arfcn = atoi(optarg);
+ llist_for_each_entry(ms, &ms_list, entity)
+ ms->test_arfcn = cfg_test_arfcn;
break;
case 'i':
gsmtap_ip = optarg;
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/31354
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I285a4908401659b69dac513dd1a4b07facb88c51
Gerrit-Change-Number: 31354
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange