pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/39637?usp=email )
Change subject: Use default_layer_manager for all ASPs in SCTP-mode=client &
m3ua-mode=ASP
......................................................................
Use default_layer_manager for all ASPs in SCTP-mode=client & m3ua-mode=ASP
With previous behavior, only first ASP configured as SCTPmode=client and
m3ua-mode=ASP in osmo_sccp_simple_client_on_ss7_id() would be applied
the default_layer_manager.
AS a result, if a client app (eg. osmo-bsc) would manually configure 1 ASP
with 2 ASPs (and leave it to dynamic RKM to setup everything at osmo-stp),
it would fail, since the default LM FSM (in charge of waiting for NTFY and
then sending REQ_REG) would only be
applied to the first ASP.
So one would see 1st ASP doing ASPUP+REG_REQ+ASPAC correctly, but the
second one would do ASPUP+ASPAC directly, which would be refused by
osmo-stp since it had no routing context configured for that ASP/AS.
Change-Id: I50f9a088c55ad103cc23758192773fc855747e12
---
M src/osmo_ss7_asp.c
M src/osmo_ss7_vty.c
M src/sccp_user.c
M src/ss7_asp.h
M src/xua_default_lm_fsm.c
5 files changed, 37 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/37/39637/1
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index faf4a0a..e3a6843 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -1291,3 +1291,22 @@
}
return -1;
}
+
+/* Apply sane configs for unconfigured options and restart the ASP. */
+void ss7_asp_restart_after_reconfigure(struct osmo_ss7_asp *asp)
+{
+ /* Make sure proper defaults values are applied if user didn't provide
+ * specific default values */
+ ss7_asp_set_default_peer_hosts(asp);
+
+ /* Apply default LM FSM for client ASP */
+ if (asp->cfg.proto != OSMO_SS7_ASP_PROT_IPA &&
+ asp->cfg.role == OSMO_SS7_ASP_ROLE_ASP &&
+ !asp->cfg.is_server) {
+ osmo_ss7_asp_use_default_lm(asp, LOGL_DEBUG);
+ } else {
+ osmo_ss7_asp_remove_default_lm(asp);
+ }
+
+ osmo_ss7_asp_restart(asp);
+}
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 576ad7c..8365db2 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -3001,9 +3001,7 @@
switch (vty->node) {
case L_CS7_ASP_NODE:
asp = vty->index;
- /* Make sure proper defaults values are set */
- ss7_asp_set_default_peer_hosts(asp);
- osmo_ss7_asp_restart(asp);
+ ss7_asp_restart_after_reconfigure(asp);
vty->node = L_CS7_NODE;
vty->index = asp->inst;
break;
diff --git a/src/sccp_user.c b/src/sccp_user.c
index d27d4bb..b5b6b4b 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -628,6 +628,7 @@
asp = asp_i;
LOGP(DLSCCP, LOGL_NOTICE, "%s: ASP %s for %s is not associated with any AS, using
it\n",
name, asp->cfg.name, osmo_ss7_asp_protocol_name(prot));
+ osmo_ss7_as_add_asp(as, asp->cfg.name);
break;
}
if (!asp) {
@@ -642,6 +643,7 @@
if (!asp)
goto out_rt;
asp_created = true;
+ asp->simple_client_allocated = true;
/* Ensure that the ASP we use is set to operate as a client. */
asp->cfg.is_server = false;
/* Ensure that the ASP we use is set to role ASP. */
@@ -650,12 +652,10 @@
ss7_asp_peer_set_hosts(&asp->cfg.local, asp, &default_local_ip, 1);
if (default_remote_ip)
ss7_asp_peer_set_hosts(&asp->cfg.remote, asp, &default_remote_ip, 1);
- /* Make sure proper defaults are applied if app didn't provide specific default
values */
- ss7_asp_set_default_peer_hosts(asp);
- asp->simple_client_allocated = true;
+ /* Make sure proper defaults are applied if app didn't
+ provide specific default values, then restart the ASP: */
+ ss7_asp_restart_after_reconfigure(asp);
}
-
- osmo_ss7_as_add_asp(as, asp->cfg.name);
}
/* Extra sanity checks if the ASP asp-clnt-* was pre-configured over VTY: */
@@ -696,12 +696,9 @@
goto out_asp;
}
}
+ /* ASP was already started here previously by VTY go_parent. */
}
- /* 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);
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
index 377274a..a05d870 100644
--- a/src/ss7_asp.h
+++ b/src/ss7_asp.h
@@ -110,5 +110,8 @@
int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int
loc_idx);
int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int
loc_idx);
+void ss7_asp_restart_after_reconfigure(struct osmo_ss7_asp *asp);
+void osmo_ss7_asp_remove_default_lm(struct osmo_ss7_asp *asp);
+
#define LOGPASP(asp, subsys, level, fmt, args ...) \
_LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ##
args)
diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c
index fc01605..0952c9e 100644
--- a/src/xua_default_lm_fsm.c
+++ b/src/xua_default_lm_fsm.c
@@ -413,6 +413,14 @@
.prim_cb = default_lm_prim_cb,
};
+void osmo_ss7_asp_remove_default_lm(struct osmo_ss7_asp *asp)
+{
+ if (!asp->lm_priv)
+ return;
+ osmo_fsm_inst_term(asp->lm_priv, OSMO_FSM_TERM_ERROR, NULL);
+ asp->lm_priv = NULL;
+}
+
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level)
{
struct lm_fsm_priv *lmp;
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/39637?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I50f9a088c55ad103cc23758192773fc855747e12
Gerrit-Change-Number: 39637
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>