From ec20a6164b046f9b6190dc886c3cc8a8e1445739 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 23 Jun 2020 18:14:51 +0200 Subject: sccp_simple_client: only restart ASP if it was created In osmo_sccp_simple_client_on_ss7_id(), only call osmo_ss7_asp_restart() if the ASP was created by that function. If a previously existing ASP was re-used, do not restart it. Background: Recently, osmo-bsc started calling osmo_sccp_simple_client_on_ss7_id() multiple times, once for each configured MSC in an MSC pool. Normally, that ends up re-using the same ASP and SCCP client, so should not change anything. Still, it turns out that the SCTP association was re-launched for every configured MSC, which is obviously not necessary when using the same SCCP connection and SCCP user for multiple MSCs. That happened because osmo_sccp_simple_client_on_ss7_id() calls osmo_ss7_asp_restart() even if a pre-existing ASP is re-used. The rapid restarts also uncovered a problem in osmo-stp, causing it to crash -- that is a separate issue. Independently from an osmo-stp fix, this change should in fact avoid the osmo-stp crash and fix the sporadic massive ttcn3-bsc-test fallout we're seeing since merging the MSC pooling feature to osmo-bsc. Related: OS#4625 Change-Id: I62443edd681a2ec1b38f958520e907f9a7ef285e --- src/sccp_user.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sccp_user.c b/src/sccp_user.c index d8a7357..1278fae 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -597,16 +597,16 @@ osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name, talloc_free(asp_name); osmo_ss7_as_add_asp(as, asp->cfg.name); - } - /* Ensure that the ASP we use is set to client mode. */ - asp->cfg.is_server = false; - asp->cfg.role = OSMO_SS7_ASP_ROLE_ASP; + /* Ensure that the ASP we use is set to client mode. */ + asp->cfg.is_server = false; + asp->cfg.role = OSMO_SS7_ASP_ROLE_ASP; - /* Restart ASP */ - if (prot != OSMO_SS7_ASP_PROT_IPA) - osmo_ss7_asp_use_default_lm(asp, LOGL_DEBUG); - osmo_ss7_asp_restart(asp); + /* Restart ASP */ + if (prot != OSMO_SS7_ASP_PROT_IPA) + osmo_ss7_asp_use_default_lm(asp, LOGL_DEBUG); + osmo_ss7_asp_restart(asp); + } LOGP(DLSCCP, LOGL_NOTICE, "%s: Using ASP instance %s\n", name, asp->cfg.name); -- cgit v1.2.3