Make compatible with private sigtran structs

Adjust OsmoMSC to build with newer versions of libosmo-sigtran, where
several structs were made private. This based on Pau's patch
9faff776 ("Use new libosmo-sigtran API osmo_ss7_as_select_asp()").

Related: OS#6617
Change-Id: I6c7d5119174de8d37d1ebe2b47793f9b89cc903c
This commit is contained in:
Oliver Smith
2024-11-12 14:06:43 +01:00
parent 00cb24d73e
commit c21aedfcfc
3 changed files with 41 additions and 0 deletions

View File

@@ -226,6 +226,18 @@ AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
AC_MSG_RESULT([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
# OS#6617: check if libosmo-sigtran has private structs
# We need to use grep here, can't set the includedir with AC_CHECK_DECL.
m="OS#6617: checking whether libosmo-sigtran has private structs..."
h="$($PKG_CONFIG --variable=includedir libosmo-sigtran)/osmocom/sigtran/osmo_ss7.h"
f=osmo_ss7_instance_get_primary_pc
if grep -q "$f" "$h"; then
echo "$m yes ($f in $h)"
AC_DEFINE(SIGTRAN_PRIVATE_STRUCTS, [1], ["OS#6617"])
else
echo "$m no ($f not in $h)"
fi
dnl Generate the output
AM_CONFIG_HEADER(config.h)

View File

@@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include <osmocom/msc/transaction.h>
#include <osmocom/msc/gsm_data.h>
@@ -124,7 +125,12 @@ struct osmo_lcls *trans_lcls_compose(const struct gsm_trans *trans, bool use_lac
struct osmo_ss7_instance *ss7 = osmo_sccp_get_ss7(trans->net->a.sri->sccp);
struct osmo_lcls *lcls;
#ifdef SIGTRAN_PRIVATE_STRUCTS
const struct osmo_ss7_pc_fmt *pc_fmt = osmo_ss7_instance_get_pc_fmt(ss7);
uint8_t w = osmo_ss7_pc_width(pc_fmt);
#else
uint8_t w = osmo_ss7_pc_width(&ss7->cfg.pc_fmt);
#endif
if (!trans->net->lcls_permitted) {
LOGP(DCC, LOGL_NOTICE, "LCLS disabled globally\n");
@@ -150,7 +156,12 @@ struct osmo_lcls *trans_lcls_compose(const struct gsm_trans *trans, bool use_lac
LOGP(DCC, LOGL_INFO, "LCLS: using %u bits (%u bytes) for node ID\n", w, w / 8);
lcls->gcr.net_len = 3;
#ifdef SIGTRAN_PRIVATE_STRUCTS
lcls->gcr.node = osmo_ss7_instance_get_primary_pc(ss7);
#else
lcls->gcr.node = ss7->cfg.primary_pc;
#endif
/* net id from Q.1902.3 3-5 bytes, this function gives 3 bytes exactly */
osmo_plmn_to_bcd(lcls->gcr.net, &trans->msc_a->via_cell.lai.plmn);

View File

@@ -803,10 +803,21 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
ret = 10;
goto error;
}
#ifdef SIGTRAN_PRIVATE_STRUCTS
const struct osmo_ss7_instance *ss7;
ss7 = osmo_sccp_get_ss7(msc_network->a.sri->sccp);
OSMO_ASSERT(ss7);
LOGP(DMSC, LOGL_NOTICE, "A-interface: SCCP user %s, cs7-instance %u (%s)\n",
osmo_sccp_user_name(msc_network->a.sri->scu),
osmo_ss7_instance_get_id(ss7),
osmo_ss7_instance_get_name(ss7));
#else
LOGP(DMSC, LOGL_NOTICE, "A-interface: SCCP user %s, cs7-instance %u (%s)\n",
osmo_sccp_user_name(msc_network->a.sri->scu),
osmo_sccp_get_ss7(msc_network->a.sri->sccp)->cfg.id,
osmo_sccp_get_ss7(msc_network->a.sri->sccp)->cfg.name);
#endif
#ifdef BUILD_IU
talloc_asn1_ctx = talloc_named_const(tall_msc_ctx, 0, "asn1");
@@ -823,11 +834,18 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
/* Compatibility with legacy osmo-hnbgw that was unable to properly handle RESET messages. */
msc_network->iu.sri->ignore_missing_reset = true;
#ifdef SIGTRAN_PRIVATE_STRUCTS
LOGP(DMSC, LOGL_NOTICE, "Iu-interface: SCCP user %s, cs7-instance %u (%s)\n",
osmo_sccp_user_name(msc_network->iu.sri->scu),
osmo_ss7_instance_get_id(ss7),
osmo_ss7_instance_get_name(ss7));
#else
LOGP(DMSC, LOGL_NOTICE, "Iu-interface: SCCP user %s, cs7-instance %u (%s)\n",
osmo_sccp_user_name(msc_network->iu.sri->scu),
osmo_sccp_get_ss7(msc_network->iu.sri->sccp)->cfg.id,
osmo_sccp_get_ss7(msc_network->iu.sri->sccp)->cfg.name);
#endif
#endif /* BUILD_IU */
/* Init RRLP handlers */
msc_rrlp_init();