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/.
keith gerrit-no-reply at lists.osmocom.orgkeith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/19875 ) Change subject: vty: allow configuring db path from cfg file ...................................................................... vty: allow configuring db path from cfg file So far, the cmdline argument was the only way to set a database file. Add a similar config to VTY as 'msc' / 'sms-database'. The cmdline arg is stronger than the 'database' cfg item. DB is not reloaded from VTY command. Change-Id: I18d954c30fcceb0b36a620b927fd3a93dcc79f49 --- M include/osmocom/msc/gsm_data.h M src/libmsc/msc_net_init.c M src/libmsc/msc_vty.c M src/osmo-msc/msc_main.c M tests/test_nodes.vty 5 files changed, 22 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/75/19875/1 diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index 2122d4b..61fbc26 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -30,6 +30,7 @@ struct vlr_subscr; struct gsup_client_mux; +#define SMS_DEFAULT_DB_FILE_PATH "sms.db" #define tmsi_from_string(str) strtoul(str, NULL, 10) enum { @@ -259,6 +260,7 @@ /* Whether to use call waiting on the network */ bool call_waiting; + char *sms_db_file_path; }; struct osmo_esme; diff --git a/src/libmsc/msc_net_init.c b/src/libmsc/msc_net_init.c index adb9ca7..774c767 100644 --- a/src/libmsc/msc_net_init.c +++ b/src/libmsc/msc_net_init.c @@ -61,6 +61,8 @@ if (!net) return NULL; + net->sms_db_file_path = talloc_strdup(net, SMS_DEFAULT_DB_FILE_PATH); + net->plmn = (struct osmo_plmn_id){ .mcc=1, .mnc=1 }; /* Permit a compile-time default of A5/3 and A5/1 */ diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c index 07a88c2..46d3cf9 100644 --- a/src/libmsc/msc_vty.c +++ b/src/libmsc/msc_vty.c @@ -426,6 +426,15 @@ #define MNCC_GUARD_TIMEOUT_STR "Set global guard timer for mncc interface activity\n" #define MNCC_GUARD_TIMEOUT_VALUE_STR "guard timer value (sec.)\n" +DEFUN(cfg_sms_database, cfg_sms_database_cmd, + "sms-database PATH", + "Set the path to the MSC-SMS database file\n" + "Relative or absolute file system path to the database file (default is '" SMS_DEFAULT_DB_FILE_PATH "')\n") +{ + osmo_talloc_replace_string(gsmnet, &gsmnet->sms_db_file_path, argv[0]); + return CMD_SUCCESS; +} + DEFUN(cfg_msc_mncc_internal, cfg_msc_mncc_internal_cmd, "mncc internal", @@ -731,6 +740,8 @@ static int config_write_msc(struct vty *vty) { vty_out(vty, "msc%s", VTY_NEWLINE); + if (gsmnet->sms_db_file_path && strcmp(gsmnet->sms_db_file_path, SMS_DEFAULT_DB_FILE_PATH)) + vty_out(vty, " sms-database %s%s", gsmnet->sms_db_file_path, VTY_NEWLINE); if (gsmnet->mncc_sock_path) vty_out(vty, " mncc external %s%s", gsmnet->mncc_sock_path, VTY_NEWLINE); vty_out(vty, " mncc guard-timeout %i%s", @@ -2059,6 +2070,7 @@ install_element(CONFIG_NODE, &cfg_msc_cmd); install_node(&msc_node, config_write_msc); + install_element(MSC_NODE, &cfg_sms_database_cmd); install_element(MSC_NODE, &cfg_msc_assign_tmsi_cmd); install_element(MSC_NODE, &cfg_msc_mncc_internal_cmd); install_element(MSC_NODE, &cfg_msc_mncc_external_cmd); diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c index 4cda395..4f614db 100644 --- a/src/osmo-msc/msc_main.c +++ b/src/osmo-msc/msc_main.c @@ -105,7 +105,7 @@ int daemonize; const char *mncc_sock_path; } msc_cmdline_config = { - .database_name = "sms.db", + .database_name = NULL, .config_file = "osmo-msc.cfg", }; @@ -647,9 +647,11 @@ /* TODO: is this used for crypto?? Improve randomness, at least we * should try to use the nanoseconds part of the current time. */ - if (db_init(msc_cmdline_config.database_name)) { + if (msc_cmdline_config.database_name) + osmo_talloc_replace_string(msc_network, &msc_network->sms_db_file_path, msc_cmdline_config.database_name); + if (db_init(msc_network->sms_db_file_path)) { fprintf(stderr, "DB: Failed to init database: %s\n", - msc_cmdline_config.database_name); + osmo_quote_str((char*)msc_network->sms_db_file_path, -1)); return 4; } diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty index 520f07c..d389675 100644 --- a/tests/test_nodes.vty +++ b/tests/test_nodes.vty @@ -46,6 +46,7 @@ OsmoMSC(config)# msc OsmoMSC(config-msc)# list ... + sms-database PATH assign-tmsi mncc internal mncc external MNCC_SOCKET_PATH -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/19875 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I18d954c30fcceb0b36a620b927fd3a93dcc79f49 Gerrit-Change-Number: 19875 Gerrit-PatchSet: 1 Gerrit-Owner: keith <keith at rhizomatica.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200828/34dc8e39/attachment.htm>