[M] Change in libosmo-sccp[master]: osmo_sccp_simple_client_on_ss7_id(): Support ASP explicitly configure...
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/33216 ) Change subject: osmo_sccp_simple_client_on_ss7_id(): Support ASP explicitly configured as sctp server ...................................................................... osmo_sccp_simple_client_on_ss7_id(): Support ASP explicitly configured as sctp server Right now, if a user configures an cs7 instance, as and asp (with sctp-role server) in the VTY, then the function osmo_sccp_simple_client_on_ss7_id() (used by osmo-bsc, osmo-msc, osmo-hnbgw, etc.) will silently change the config to be SCTP client. This is really confusing, since the user configured explicitly the ASP as server but ends up running as client. Instead, if the user explicitly configured the ASP as SCTP server, allow it (after validating the user also properly configured a xUA server through VTY). Change-Id: I20de33edb8751a515d6719c49efadfc387dd85f8 --- M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7_vty.c M src/sccp_user.c 3 files changed, 47 insertions(+), 4 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index e025709..f413983 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -431,6 +431,7 @@ bool is_server; enum osmo_ss7_asp_role role; bool role_set_by_vty; + bool sctp_role_set_by_vty; struct osmo_ss7_asp_peer local; struct osmo_ss7_asp_peer remote; diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 541d197..2418428 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -736,6 +736,7 @@ else OSMO_ASSERT(0); + asp->cfg.sctp_role_set_by_vty = true; return CMD_SUCCESS; } @@ -854,8 +855,8 @@ vty_out(vty, " role %s%s", osmo_str_tolower(get_value_string(osmo_ss7_asp_role_names, asp->cfg.role)), VTY_NEWLINE); } - if (!asp->cfg.is_server) - vty_out(vty, " sctp-role client%s", VTY_NEWLINE); + if (asp->cfg.sctp_role_set_by_vty || !asp->cfg.is_server) + vty_out(vty, " sctp-role %s%s", asp->cfg.is_server ? "server" : "client", VTY_NEWLINE); for (i = 0; i < sizeof(uint32_t) * 8; i++) { if (!(asp->cfg.quirks & ((uint32_t) 1 << i))) continue; diff --git a/src/sccp_user.c b/src/sccp_user.c index 2be9cd4..f1a4203 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -642,8 +642,30 @@ 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; + /* Make sure that the sctp-role of this ASP is set to "client" unless the user + * made a conscious decision about the role via the VTY */ + if (!asp->cfg.sctp_role_set_by_vty) + asp->cfg.is_server = false; + + /* If ASP was configured through VTY it may be explicitly configured as + * SCTP server. It may be a bit confusing since this function is to create + * a "SCCP simple client", but this allows users of this API such as + * osmo-hnbgw to support SCTP-role server if properly configured through VTY. + */ + if (asp->cfg.is_server) { + struct osmo_xua_server *xs; + LOGP(DLSCCP, LOGL_NOTICE, + "%s: Requesting an SCCP simple client on ASP %s configured with 'sctp-role server'\n", + name, asp->cfg.name); + xs = osmo_ss7_xua_server_find(ss7, prot, asp->cfg.local.port); + if (!xs) { + LOGP(DLSCCP, LOGL_ERROR, + "%s: Requesting an SCCP simple client on ASP %s configured with 'sctp-role server' " + "but no matching xUA server was configured!\n", + name, asp->cfg.name); + goto out_asp; + } + } /* Make sure that the role of this ASP is set to ASP unless the user * made a conscious decision about the role via the VTY */ -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/33216 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I20de33edb8751a515d6719c49efadfc387dd85f8 Gerrit-Change-Number: 33216 Gerrit-PatchSet: 8 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged
participants (1)
-
pespin