osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/38733?usp=email )

Change subject: Make compatible with private sigtran structs
......................................................................

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
---
M configure.ac
M src/libmsc/transaction.c
M src/osmo-msc/msc_main.c
3 files changed, 41 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved




diff --git a/configure.ac b/configure.ac
index 05bea8a..ba8b198 100644
--- a/configure.ac
+++ b/configure.ac
@@ -226,6 +226,18 @@
 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)

diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 7ae4c7d..000fe1c 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -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_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 @@
        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);
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index a4b2ded..65629ca 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -803,10 +803,21 @@
                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 @@
        /* 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();

--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38733?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: osmith/1.12.2
Gerrit-Change-Id: I6c7d5119174de8d37d1ebe2b47793f9b89cc903c
Gerrit-Change-Number: 38733
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to