From 50a40f921863500d583eafcf0c4ca5552cb3dc1e Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 9 Aug 2017 18:46:58 +0200 Subject: vty: hide SG commands when running as ASP The SG (signal gateway) requires an extra set of VTY commands in order to be fully configurable. These VTY commands do not make sense in a situation where libosmo-sccp is used to implement an ASP (application server process). Detect in which role libosmo-sccp is used by which of the VTY initalization functions are called: osmo_ss7_vty_init_asp() ==> ASP osmo_ss7_vty_init_sg() ==> SG Prevent writing back of SG specific configuration when in running as ASP. Only write back the full parameter set when running as SG. Change-Id: I707bcd790f4c6d0f618e41163b51d2179ea3aeaf --- src/osmo_ss7_vty.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 21efcae..9343edd 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -50,6 +50,8 @@ * Core CS7 Configuration ***********************************************************************/ +enum cs7_role_t {CS7_ROLE_SG, CS7_ROLE_ASP}; +static enum cs7_role_t cs7_role; static void *g_ctx; static struct cmd_node cs7_node = { @@ -1559,12 +1561,16 @@ static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst) llist_for_each_entry(as, &inst->as_list, list) write_one_as(vty, as); - /* now dump routes, as their target ASs exist */ - llist_for_each_entry(rtable, &inst->rtable_list, list) - write_one_rtable(vty, rtable); + /* now dump everything that is relevent for the SG role */ + if (cs7_role == CS7_ROLE_SG) { - llist_for_each_entry(oxs, &inst->xua_servers, list) - write_one_xua(vty, oxs); + /* dump routes, as their target ASs exist */ + llist_for_each_entry(rtable, &inst->rtable_list, list) + write_one_rtable(vty, rtable); + + llist_for_each_entry(oxs, &inst->xua_servers, list) + write_one_xua(vty, oxs); + } /* Append SCCP Addressbook */ write_sccp_addressbook(vty, inst); @@ -1717,11 +1723,13 @@ static void vty_init_shared(void *ctx) void osmo_ss7_vty_init_asp(void *ctx) { + cs7_role = CS7_ROLE_ASP; vty_init_shared(ctx); } void osmo_ss7_vty_init_sg(void *ctx) { + cs7_role = CS7_ROLE_SG; vty_init_shared(ctx); install_node(&rtable_node, NULL); -- cgit v1.2.3