Change in osmo-msc[master]: bssap: Detect BSC Osmux support on RESET (ACK) recv

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon May 13 18:03:08 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/14039


Change subject: bssap: Detect BSC Osmux support on RESET (ACK) recv
......................................................................

bssap: Detect BSC Osmux support on RESET (ACK) recv

Related: OS#2551
Depends: libosmocore.git I28f83e2e32b9533c99e65ccc1562900ac2aec74e
Change-Id: If4f33da9b414ab194098755d2c5be85e1fce5d31
---
M include/osmocom/msc/ran_peer.h
M src/libmsc/ran_peer.c
2 files changed, 44 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/39/14039/1

diff --git a/include/osmocom/msc/ran_peer.h b/include/osmocom/msc/ran_peer.h
index e3ff59d..06ab500 100644
--- a/include/osmocom/msc/ran_peer.h
+++ b/include/osmocom/msc/ran_peer.h
@@ -51,6 +51,9 @@
 
 	/* See cell_id_list.h */
 	struct llist_head cells_seen;
+
+	/* Whether we detected the BSC supports Osmux (during BSSMAP_RESET) */
+	bool remote_supports_osmux;
 };
 
 #define ran_peer_for_each_ran_conn(RAN_CONN, RAN_PEER) \
diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c
index 9ec157e..6ee7b47 100644
--- a/src/libmsc/ran_peer.c
+++ b/src/libmsc/ran_peer.c
@@ -122,13 +122,40 @@
 	}
 }
 
+/* TODO: create an sccp_ran_ops.rx_reset(_ack) to handle this differently on 2g and 3G */
+/* We expect RAN peer to provide use with an Osmocom extension TLV in BSSMAP_RESET to
+ * announce Osmux support */
+static void ran_peer_update_osmux_support(struct ran_peer *rp, struct msgb *msg)
+{
+	struct tlv_parsed tp;
+	int rc;
+	bool old_value = rp->remote_supports_osmux;
+
+	msg->l3h = msg->l2h + sizeof(struct bssmap_header);
+	rc = tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
+	if (rc < 0)
+		LOG_RAN_PEER(rp, LOGL_NOTICE, "Failed parsing TLV looking for Osmux support\n");
+
+	if (TLVP_PRESENT(&tp, GSM0808_IE_OSMO_OSMUX_SUPPORT)) {
+		rp->remote_supports_osmux = true;
+	} else {
+		rp->remote_supports_osmux = false;
+	}
+
+	if (old_value != rp->remote_supports_osmux)
+		LOG_RAN_PEER(rp, LOGL_INFO, "BSC detected AoIP Osmux support changed: %d->%d\n",
+		     old_value, rp->remote_supports_osmux);
+}
+
 /* Drop all SCCP connections for this ran_peer, respond with RESET ACKNOWLEDGE and move to READY state. */
-static void ran_peer_rx_reset(struct ran_peer *rp)
+static void ran_peer_rx_reset(struct ran_peer *rp, struct msgb* msg)
 {
 	struct msgb *reset_ack;
 
 	ran_peer_discard_all_conns(rp);
 
+	ran_peer_update_osmux_support(rp, msg);
+
 	reset_ack = rp->sri->ran->sccp_ran_ops.make_reset_msg(rp->sri, SCCP_RAN_MSG_RESET_ACK);
 
 	if (!reset_ack) {
@@ -152,9 +179,10 @@
 	ran_peer_state_chg(rp, RAN_PEER_ST_READY);
 }
 
-static void ran_peer_rx_reset_ack(struct ran_peer *rp)
+static void ran_peer_rx_reset_ack(struct ran_peer *rp, struct msgb* msg)
 {
 	ran_peer_state_chg(rp, RAN_PEER_ST_READY);
+	ran_peer_update_osmux_support(rp, msg);
 }
 
 void ran_peer_reset(struct ran_peer *rp)
@@ -228,6 +256,7 @@
 {
 	struct ran_peer *rp = fi->priv;
 	struct ran_peer_ev_ctx *ctx;
+	struct msgb *msg;
 
 	switch (event) {
 
@@ -257,7 +286,8 @@
 		return;
 
 	case RAN_PEER_EV_RX_RESET:
-		ran_peer_rx_reset(rp);
+		msg = (struct msgb*)data;
+		ran_peer_rx_reset(rp, msg);
 		return;
 
 	default:
@@ -270,11 +300,13 @@
 {
 	struct ran_peer *rp = fi->priv;
 	struct ran_peer_ev_ctx *ctx;
+	struct msgb *msg;
 
 	switch (event) {
 
 	case RAN_PEER_EV_RX_RESET_ACK:
-		ran_peer_rx_reset_ack(rp);
+		msg = (struct msgb*)data;
+		ran_peer_rx_reset_ack(rp, msg);
 		return;
 
 	case RAN_PEER_EV_MSG_UP_CO:
@@ -289,7 +321,8 @@
 		return;
 
 	case RAN_PEER_EV_RX_RESET:
-		ran_peer_rx_reset(rp);
+		msg = (struct msgb*)data;
+		ran_peer_rx_reset(rp, msg);
 		return;
 
 	default:
@@ -330,6 +363,7 @@
 	struct ran_peer_ev_ctx *ctx;
 	struct ran_conn *conn;
 	struct an_apdu an_apdu;
+	struct msgb *msg;
 
 	switch (event) {
 
@@ -397,7 +431,8 @@
 		return;
 
 	case RAN_PEER_EV_RX_RESET:
-		ran_peer_rx_reset(rp);
+		msg = (struct msgb*)data;
+		ran_peer_rx_reset(rp, msg);
 		return;
 
 	default:

-- 
To view, visit https://gerrit.osmocom.org/14039
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4f33da9b414ab194098755d2c5be85e1fce5d31
Gerrit-Change-Number: 14039
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190513/48c5e6d2/attachment.html>


More information about the gerrit-log mailing list