From c27bc90ae6191cd13a8575ef31763f60045895bd Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 19 Dec 2022 19:54:04 +0100 Subject: [PATCH] Vty: Fixup config shown/written from vty This commit fixes the following errors: Missing timeout param for mslookup. Fails to start reading a written config if an msc node is configured in the mslookup server. Places the individual msc node services in the top-level wildcard node due to incorrect indentation. * Add missing timeout param. * Add missing "ipa-name" part to mslookup-server-msc section. * Add one extra space indentation for msc services. This commit also adds a DEFINE for the default timeout value. Change-Id: Ibb60e74a0803f05f37ac13ca529d77b4cb736025 --- include/osmocom/hlr/dgsm.h | 1 + src/dgsm.c | 2 +- src/dgsm_vty.c | 8 ++++++-- tests/test_nodes.vty | 42 +++++++++++++++++++------------------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/include/osmocom/hlr/dgsm.h b/include/osmocom/hlr/dgsm.h index cc8f3d29..1114fbe5 100644 --- a/include/osmocom/hlr/dgsm.h +++ b/include/osmocom/hlr/dgsm.h @@ -25,6 +25,7 @@ #include #include +#define OSMO_DGSM_DEFAULT_RESULT_TIMEOUT_MS 2000 #define LOG_DGSM(imsi, level, fmt, args...) \ LOGP(DDGSM, level, "(IMSI-%s) " fmt, imsi, ##args) diff --git a/src/dgsm.c b/src/dgsm.c index cdd82a23..f96bca6e 100644 --- a/src/dgsm.c +++ b/src/dgsm.c @@ -170,7 +170,7 @@ void dgsm_init(void *ctx) g_hlr->mslookup.server.local_attach_max_age = 60 * 60; - g_hlr->mslookup.client.result_timeout_milliseconds = 2000; + g_hlr->mslookup.client.result_timeout_milliseconds = OSMO_DGSM_DEFAULT_RESULT_TIMEOUT_MS; g_hlr->gsup_unit_name.unit_name = "HLR"; g_hlr->gsup_unit_name.serno = "unnamed-HLR"; diff --git a/src/dgsm_vty.c b/src/dgsm_vty.c index 00a60ea4..925545e9 100644 --- a/src/dgsm_vty.c +++ b/src/dgsm_vty.c @@ -447,8 +447,8 @@ int config_write_mslookup(struct vty *vty) llist_for_each_entry(msc, &g_hlr->mslookup.server.local_site_services, entry) { if (!osmo_ipa_name_cmp(&mslookup_server_msc_wildcard, &msc->name)) continue; - vty_out(vty, " msc %s%s", osmo_ipa_name_to_str(&msc->name), VTY_NEWLINE); - config_write_msc_services(vty, " ", msc); + vty_out(vty, " msc ipa-name %s%s", osmo_ipa_name_to_str(&msc->name), VTY_NEWLINE); + config_write_msc_services(vty, " ", msc); } /* If the server is disabled, still output the above to not lose the service config. */ @@ -475,6 +475,10 @@ int config_write_mslookup(struct vty *vty) vty_out(vty, " mdns domain-suffix %s%s", g_hlr->mslookup.client.mdns.domain_suffix, VTY_NEWLINE); + if (g_hlr->mslookup.client.result_timeout_milliseconds != OSMO_DGSM_DEFAULT_RESULT_TIMEOUT_MS) + vty_out(vty, " timeout %u%s", + g_hlr->mslookup.client.result_timeout_milliseconds, + VTY_NEWLINE); } return CMD_SUCCESS; diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty index bebe9a0a..0f02f226 100644 --- a/tests/test_nodes.vty +++ b/tests/test_nodes.vty @@ -349,15 +349,15 @@ mslookup service foo.bar at 123.45.67.89 1011 service baz.bar at 121.31.41.5 1617 service baz.bar at a:b:c::d 1819 - msc MSC-1 - msc msc-901-70-23 - service foo.bar at 76.54.32.10 1234 - service baz.bar at 12.11.10.98 7654 - service baz.bar at dd:cc:bb::a 3210 - msc msc-901-70-42 - service foo.bar at 1.1.1.1 1111 - service baz.bar at 2.2.2.2 2222 - service baz.bar at 2222:2222:2222::2 2222 + msc ipa-name MSC-1 + msc ipa-name msc-901-70-23 + service foo.bar at 76.54.32.10 1234 + service baz.bar at 12.11.10.98 7654 + service baz.bar at dd:cc:bb::a 3210 + msc ipa-name msc-901-70-42 + service foo.bar at 1.1.1.1 1111 + service baz.bar at 2.2.2.2 2222 + service baz.bar at 2222:2222:2222::2 2222 client gateway-proxy 1.2.3.4 4222 mdns bind 239.192.23.42 4266 @@ -404,12 +404,12 @@ mslookup mdns bind 239.192.23.42 4266 service foo.bar at 123.45.67.89 1011 service baz.bar at 121.31.41.5 1617 - msc MSC-1 - msc msc-901-70-23 - service foo.bar at 76.54.32.10 1234 - service baz.bar at 12.11.10.98 7654 - msc msc-901-70-42 - service foo.bar at 1.1.1.1 1111 + msc ipa-name MSC-1 + msc ipa-name msc-901-70-23 + service foo.bar at 76.54.32.10 1234 + service baz.bar at 12.11.10.98 7654 + msc ipa-name msc-901-70-42 + service foo.bar at 1.1.1.1 1111 client mdns bind 239.192.23.42 4266 ... @@ -437,12 +437,12 @@ mslookup service foo.bar at 123.45.67.89 1011 service baz.bar at 121.31.41.5 1617 service gsup.hlr at 23.42.17.11 4223 - msc MSC-1 - msc msc-901-70-23 - service foo.bar at 76.54.32.10 1234 - service baz.bar at 12.11.10.98 7654 - msc msc-901-70-42 - service foo.bar at 1.1.1.1 1111 + msc ipa-name MSC-1 + msc ipa-name msc-901-70-23 + service foo.bar at 76.54.32.10 1234 + service baz.bar at 12.11.10.98 7654 + msc ipa-name msc-901-70-42 + service foo.bar at 1.1.1.1 1111 client mdns bind 239.192.23.42 4266 ...