Harald Welte has submitted this change and it was merged.

Change subject: vty: hide SG commands when running as ASP
......................................................................


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
---
M src/osmo_ss7_vty.c
1 file changed, 13 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
        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 @@
 
 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);

-- 
To view, visit https://gerrit.osmocom.org/3453
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I707bcd790f4c6d0f618e41163b51d2179ea3aeaf
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to