Change in osmo-msc[master]: a_iface: Centralize/wrap BSSAP / N-DATA transmission

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Feb 18 12:08:13 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/12925


Change subject: a_iface: Centralize/wrap BSSAP / N-DATA transmission
......................................................................

a_iface: Centralize/wrap BSSAP / N-DATA transmission

We don't want multiple callers to osmo_sccp_tx_data_msg() each having
to hex-dump a log message about the to-be-transmitted message, with
half of the caller sitest missing that printing.  Let's centralize
all calls of osmo_sccp_tx_data_msg() in a wrapper function which
takes care of the related OSMO_ASSERT() and the related printing.

Change-Id: I6159ea72cc8e0650eda6c49544acd65e9c15e817
---
M src/libmsc/a_iface.c
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_tests.c
4 files changed, 25 insertions(+), 10 deletions(-)



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

diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 3a7690d..c76e5c5 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -141,6 +141,16 @@
 	return NULL;
 }
 
+/* wrapper around osmo_sccp_tx_data_msg(): Transmit a fully encoded BSSAP (DTAP or BSSMAP) message */
+static int a_iface_tx_bssap(const struct ran_conn *conn, struct msgb *msg)
+{
+	OSMO_ASSERT(conn);
+	OSMO_ASSERT(conn->a.scu);
+
+	LOGPCONN(conn, LOGL_DEBUG, "N-DATA.req(%s)\n", msgb_hexdump_l2(msg));
+	return osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg);
+}
+
 /* Send DTAP message via A-interface, take ownership of msg */
 int a_iface_tx_dtap(struct msgb *msg)
 {
@@ -167,9 +177,8 @@
 		return -EINVAL;
 	}
 
-	LOGPCONN(conn, LOGL_DEBUG, "N-DATA.req(%s)\n", msgb_hexdump_l2(msg_resp));
 	/* osmo_sccp_tx_data_msg() takes ownership of msg_resp */
-	return osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg_resp);
+	return a_iface_tx_bssap(conn, msg_resp);
 }
 
 /* Send Cipher mode command via A-interface */
@@ -186,9 +195,7 @@
 	LOGPC(DBSSAP, LOGL_DEBUG, " key %s\n", osmo_hexdump_nospc(ei->key, ei->key_len));
 
 	msg_resp = gsm0808_create_cipher(ei, include_imeisv ? &crm : NULL);
-	LOGPCONN(conn, LOGL_DEBUG, "N-DATA.req(%s)\n", msgb_hexdump_l2(msg_resp));
-
-	return osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg_resp);
+	return a_iface_tx_bssap(conn, msg_resp);
 }
 
 /* Page a subscriber via A-interface */
@@ -407,9 +414,7 @@
 	memcpy(&rtp_addr, &rtp_addr_in, sizeof(rtp_addr_in));
 
 	msg = gsm0808_create_ass(&ct, NULL, &rtp_addr, &scl, NULL);
-
-	LOGPCONN(conn, LOGL_DEBUG, "N-DATA.req(%s)\n", msgb_hexdump_l2(msg));
-	return osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg);
+	return a_iface_tx_bssap(conn, msg);
 }
 
 /* Send clear command via A-interface */
@@ -425,7 +430,7 @@
 		csfb_ind = true;
 
 	msg = gsm0808_create_clear_command2(GSM0808_CAUSE_CALL_CONTROL, csfb_ind);
-	return osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg);
+	return a_iface_tx_bssap(conn, msg);
 }
 
 int a_iface_tx_classmark_request(const struct ran_conn *conn)
@@ -435,7 +440,7 @@
 	LOGPCONN(conn, LOGL_INFO, "Tx BSSMAP CLASSMARK REQUEST to BSC\n");
 
 	msg = gsm0808_create_classmark_request();
-	return osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg);
+	return a_iface_tx_bssap(conn, msg);
 }
 
 /* Callback function: Close all open connections */
diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.err b/tests/msc_vlr/msc_vlr_test_gsm_ciph.err
index af11385..2fb9bd8 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.err
+++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.err
@@ -2452,6 +2452,7 @@
 DVLR vlr_lu_fsm(IMSI-901700000004620:GERAN-A-0:LU){VLR_ULA_S_WAIT_AUTH}: Set Ciphering Mode
 DMM IMSI-901700000004620: to determine whether A5/3 is supported, first ask for a Classmark Update to obtain Classmark 2
 DBSSAP RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: Tx BSSMAP CLASSMARK REQUEST to BSC
+DBSSAP RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: N-DATA.req([])
   BSC <--BSSAP-BSS-MANAGEMENT-- MSC: CLASSMARK REQ [L3]> 00 01 58 
 DMM RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: state_chg to RAN_CONN_S_WAIT_CLASSMARK_UPDATE
 DVLR vlr_lu_fsm(IMSI-901700000004620:GERAN-A-0:LU){VLR_ULA_S_WAIT_AUTH}: state_chg to VLR_ULA_S_WAIT_CIPH
@@ -2987,6 +2988,7 @@
 DVLR vlr_lu_fsm(IMSI-901700000004620:GERAN-A-0:LU){VLR_ULA_S_WAIT_AUTH}: Set Ciphering Mode
 DMM IMSI-901700000004620: to determine whether A5/3 is supported, first ask for a Classmark Update to obtain Classmark 2
 DBSSAP RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: Tx BSSMAP CLASSMARK REQUEST to BSC
+DBSSAP RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: N-DATA.req([])
   BSC <--BSSAP-BSS-MANAGEMENT-- MSC: CLASSMARK REQ [L3]> 00 01 58 
 DMM RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: state_chg to RAN_CONN_S_WAIT_CLASSMARK_UPDATE
 DVLR vlr_lu_fsm(IMSI-901700000004620:GERAN-A-0:LU){VLR_ULA_S_WAIT_AUTH}: state_chg to VLR_ULA_S_WAIT_CIPH
@@ -3295,6 +3297,7 @@
 DVLR Process_Access_Request_VLR(IMSI-901700000004620:MSISDN-42342:GERAN-A-0:PAGING_RESP){PR_ARQ_S_WAIT_AUTH}: Set Ciphering Mode
 DMM IMSI-901700000004620:MSISDN-42342: to determine whether A5/3 is supported, first ask for a Classmark Update to obtain Classmark 2
 DBSSAP RAN_conn(IMSI-901700000004620:MSISDN-42342:GERAN-A-0:PAGING_RESP){RAN_CONN_S_AUTH_CIPH}: Tx BSSMAP CLASSMARK REQUEST to BSC
+DBSSAP RAN_conn(IMSI-901700000004620:MSISDN-42342:GERAN-A-0:PAGING_RESP){RAN_CONN_S_AUTH_CIPH}: N-DATA.req([])
   BSC <--BSSAP-BSS-MANAGEMENT-- MSC: CLASSMARK REQ [L3]> 00 01 58 
 DMM RAN_conn(IMSI-901700000004620:MSISDN-42342:GERAN-A-0:PAGING_RESP){RAN_CONN_S_AUTH_CIPH}: state_chg to RAN_CONN_S_WAIT_CLASSMARK_UPDATE
 DVLR Process_Access_Request_VLR(IMSI-901700000004620:MSISDN-42342:GERAN-A-0:PAGING_RESP){PR_ARQ_S_WAIT_AUTH}: state_chg to PR_ARQ_S_WAIT_CIPH
diff --git a/tests/msc_vlr/msc_vlr_test_ms_timeout.err b/tests/msc_vlr/msc_vlr_test_ms_timeout.err
index e09389c..72d116a 100644
--- a/tests/msc_vlr/msc_vlr_test_ms_timeout.err
+++ b/tests/msc_vlr/msc_vlr_test_ms_timeout.err
@@ -686,6 +686,7 @@
 DVLR vlr_lu_fsm(IMSI-901700000004620:GERAN-A-0:LU){VLR_ULA_S_WAIT_AUTH}: Set Ciphering Mode
 DMM IMSI-901700000004620: to determine whether A5/3 is supported, first ask for a Classmark Update to obtain Classmark 2
 DBSSAP RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: Tx BSSMAP CLASSMARK REQUEST to BSC
+DBSSAP RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: N-DATA.req([])
   BSC <--BSSAP-BSS-MANAGEMENT-- MSC: CLASSMARK REQ [L3]> 00 01 58 
 DMM RAN_conn(IMSI-901700000004620:GERAN-A-0:LU){RAN_CONN_S_AUTH_CIPH}: state_chg to RAN_CONN_S_WAIT_CLASSMARK_UPDATE
 DVLR vlr_lu_fsm(IMSI-901700000004620:GERAN-A-0:LU){VLR_ULA_S_WAIT_AUTH}: state_chg to VLR_ULA_S_WAIT_CIPH
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index eb6df09..217c647 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -192,6 +192,10 @@
 }
 
 enum osmo_rat_type rx_from_ran = OSMO_RAT_GERAN_A;
+struct osmo_sccp_user {
+	uint8_t foo;
+};
+static struct osmo_sccp_user g_scu;
 
 struct ran_conn *conn_new(void)
 {
@@ -203,6 +207,8 @@
 			.conn_id = 42,
 		};
 		conn->iu.ue_ctx = ue_ctx;
+	} else {
+		conn->a.scu = &g_scu;
 	}
 	return conn;
 }

-- 
To view, visit https://gerrit.osmocom.org/12925
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: I6159ea72cc8e0650eda6c49544acd65e9c15e817
Gerrit-Change-Number: 12925
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190218/4ef055d7/attachment.htm>


More information about the gerrit-log mailing list