From b59ebe9f220fed9655059a72832e51f1b04dcbe1 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Mon, 29 Oct 2018 19:25:34 +0100 Subject: skip simple-client default as/asp when saving VTY config When saving the current VTY config to a configuration file, do not write out AS/ASP configuration items which are generated as a fallback by osmo_sccp_simple_client_on_ss7_id(). Since the user did not explicitly configure these configuration items they should not be saved to the user's configuration file. Change-Id: Id8a3afc6dee29ae1ee9c862cbe404a61fe979dba Related: OS#3616 --- include/osmocom/sigtran/osmo_ss7.h | 6 ++++++ src/osmo_ss7_vty.c | 7 +++---- src/sccp_user.c | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 34d5408..414606a 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -298,6 +298,9 @@ struct osmo_ss7_as { /*! Were we dynamically allocated by RKM? */ bool rkm_dyn_allocated; + /*! Were we allocated by "simple client" support? */ + bool simple_client_allocated; + struct { char *name; char *description; @@ -380,6 +383,9 @@ struct osmo_ss7_asp { /*! Were we dynamically allocated */ bool dyn_allocated; + /*! Were we allocated by "simple client" support? */ + bool simple_client_allocated; + /*! Pending message for non-blocking IPA read */ struct msgb *pending_msg; diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 7ef58cf..1b7bcb9 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -679,9 +679,8 @@ DEFUN(show_cs7_asp, show_cs7_asp_cmd, static void write_one_asp(struct vty *vty, struct osmo_ss7_asp *asp) { - /* skip any dynamically created ASPs (auto-created at connect - * time) */ - if (asp->dyn_allocated) + /* skip any dynamically created ASPs (e.g. auto-created at connect time) */ + if (asp->dyn_allocated || asp->simple_client_allocated) return; vty_out(vty, " asp %s %u %u %s%s", @@ -939,7 +938,7 @@ static void write_one_as(struct vty *vty, struct osmo_ss7_as *as) unsigned int i; /* skip any dynamically allocated AS definitions */ - if (as->rkm_dyn_allocated) + if (as->rkm_dyn_allocated || as->simple_client_allocated) return; vty_out(vty, " as %s %s%s", as->cfg.name, diff --git a/src/sccp_user.c b/src/sccp_user.c index 793e08c..8a98e46 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -409,6 +409,7 @@ osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name, goto out_ss7; as_created = true; as->cfg.routing_key.pc = ss7->cfg.primary_pc; + as->simple_client_allocated = true; } LOGP(DLSCCP, LOGL_NOTICE, "%s: Using AS instance %s\n", name, as->cfg.name); @@ -457,6 +458,7 @@ osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name, asp->cfg.remote.host = talloc_strdup(asp, default_remote_ip); } + asp->simple_client_allocated = true; } else talloc_free(asp_name); -- cgit v1.2.3