[PATCH] osmo-msc[master]: VLR tests: add function to generate ID RESP

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/.

Max gerrit-no-reply at lists.osmocom.org
Thu Feb 15 11:04:17 UTC 2018


Review at  https://gerrit.osmocom.org/6460

VLR tests: add function to generate ID RESP

Generate ID RESP based on IMSI instead of using hardcoded strings.

Change-Id: Ifc43b4b9b1595e14c353771edbcdd1ad46974895
Related: OS#2864
---
M tests/msc_vlr/msc_vlr_test_gsm_ciph.c
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
4 files changed, 29 insertions(+), 3 deletions(-)


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

diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
index 541bac1..407f077 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
@@ -804,7 +804,9 @@
 
 	btw("MS tells us the IMSI, causes a GSUP LU request to HLR");
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("0559089910070000006402");
+
+	tx_identity_resp(imsi, 1);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_rest.c b/tests/msc_vlr/msc_vlr_test_rest.c
index cb5e24f..7945ed2 100644
--- a/tests/msc_vlr/msc_vlr_test_rest.c
+++ b/tests/msc_vlr/msc_vlr_test_rest.c
@@ -165,7 +165,9 @@
 
 	btw("MS tells us the IMSI, causes a GSUP LU request to HLR");
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("0559089910070000006402");
+
+	tx_identity_resp(imsi, 1);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index f514286..6bebcab 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -743,6 +743,28 @@
 	msc_rx_sec_mode_compl(g_conn);
 }
 
+/* Transmit 3GPP TS 24.008 §9.2.11 Identity Response with proper Sequence number */
+void tx_identity_resp(const char *imsi, uint8_t seq)
+{
+	struct msgb *msg = gsm48_msgb_alloc_name("3GPP TS 24.008 ID RESP");
+	struct gsm48_hdr *gh;
+	uint8_t mi[10] = { 0 }, len;
+
+	gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
+	gh->proto_discr = GSM48_PDISC_MM;
+	gh->msg_type = (seq << 6) | GSM48_MT_MM_ID_RESP;
+
+	len = gsm48_generate_mid_from_imsi(mi, imsi) - 1;
+
+	msgb_get_u8(msg);
+
+	memcpy(msgb_put(msg, len), mi + 1, len);
+
+	ms_sends_msg(msgb_hexdump(msg));
+
+	msgb_free(msg);
+}
+
 const struct timeval fake_time_start_time = { 123, 456 };
 
 void fake_time_start()
diff --git a/tests/msc_vlr/msc_vlr_tests.h b/tests/msc_vlr/msc_vlr_tests.h
index d00eb9f..d1b27e7 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -134,7 +134,7 @@
 void dtap_expect_tx_ussd(char *ussd_text);
 void paging_expect_imsi(const char *imsi);
 void paging_expect_tmsi(uint32_t tmsi);
-
+void tx_identity_resp(const char *imsi, uint8_t seq);
 void ms_sends_msg(const char *hex);
 void ms_sends_security_mode_complete();
 void gsup_rx(const char *rx_hex, const char *expect_tx_hex);

-- 
To view, visit https://gerrit.osmocom.org/6460
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc43b4b9b1595e14c353771edbcdd1ad46974895
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list