From a94907ec062067845797775172ad7a973e93c7a0 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 16 Apr 2019 20:03:15 +0200 Subject: bssap: Detect MSC Osmux support on RESET (ACK) recv Related: OS#2551 Depends on: libosmocore I28f83e2e32b9533c99e65ccc1562900ac2aec74e Change-Id: I830e38cc1ffb8b6ebbe299567507160f19beb528 --- include/osmocom/bsc/bsc_msc_data.h | 2 ++ src/osmo-bsc/osmo_bsc_bssap.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h index 271bdd4b7..472084579 100644 --- a/include/osmocom/bsc/bsc_msc_data.h +++ b/include/osmocom/bsc/bsc_msc_data.h @@ -133,6 +133,8 @@ struct bsc_msc_data { /* Whether we want to use Osmux against this MSC. Controlled via VTY */ enum osmux_usage use_osmux; + /* Whether we detected the MSC supports Osmux (during BSSMAP_RESET) */ + bool remote_supports_osmux; }; /* diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index e79a34469..9dee2658a 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -51,6 +51,25 @@ * helpers for the assignment command */ +/* We expect MSC to provide use with an Osmocom extension TLV in BSSMAP_RESET to + * announce Osmux support */ +static void update_msc_osmux_support(struct bsc_msc_data *msc, + struct msgb *msg, unsigned int length) +{ + struct tlv_parsed tp; + int rc; + bool old_value = msc->remote_supports_osmux; + + rc = tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l4h + 1, length - 1, 0, 0); + if (rc < 0) + LOGP(DMSC, LOGL_NOTICE, "Failed parsing TLV looking for Osmux support\n"); + + msc->remote_supports_osmux = !!TLVP_PRESENT(&tp, GSM0808_IE_OSMO_OSMUX_SUPPORT); + + if (old_value != msc->remote_supports_osmux) + LOGP(DMSC, LOGL_INFO, "MSC detected AoIP Osmux support changed: %d->%d\n", + old_value, msc->remote_supports_osmux); +} static int bssmap_handle_reset_ack(struct bsc_msc_data *msc, struct msgb *msg, unsigned int length) @@ -63,6 +82,8 @@ static int bssmap_handle_reset_ack(struct bsc_msc_data *msc, * that we have successfully received the reset-ack message */ a_reset_ack_confirm(msc); + update_msc_osmux_support(msc, msg, length); + return 0; } @@ -81,6 +102,8 @@ static int bssmap_handle_reset(struct bsc_msc_data *msc, /* Drop all ongoing paging requests that this MSC has created on any BTS */ paging_flush_network(msc->network, msc); + update_msc_osmux_support(msc, msg, length); + /* Inform the MSC that we have received the reset request and * that we acted accordingly */ osmo_bsc_sigtran_tx_reset_ack(msc); -- cgit v1.2.3