aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-20 21:59:55 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-18 17:49:00 +0200
commit61692adb2b0cd090c8fb8c81376a28bca099d079 (patch)
treebee3b3fde06ec8dc2a4cb9208ceae3465cea25a5 /openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c
parent58774cba12ec4675e32fa524cfa631bdc690a9da (diff)
Implement IuCS (large refactoring and addition)
osmo-nitb becomes osmo-msc add DIUCS debug log constant add iucs.[hc] add msc vty, remove nitb vty add libiudummy, to avoid linking Iu deps in tests Use new msc_tx_dtap() instead of gsm0808_submit_dtap() libmgcp: add mgcpgw client API bridge calls via mgcpgw mgcp: hack RAB success from nano3G: patch first RTP payload The ip.access nano3G needs the first RTP payload's first two bytes to read hex 'e400', or it will reject the RAB assignment. Add flag patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on a stream, and overwrite its first bytes with e400. This should probably be configurable, but seems to not harm other femto cells (as long as we patch only the first RTP payload in each stream). Only do this when sending to the BTS side. Change-Id: Ie13ff348117e892d41b8355ab6c24915301eaeaf
Diffstat (limited to 'openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c')
-rw-r--r--openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c178
1 files changed, 139 insertions, 39 deletions
diff --git a/openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c b/openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c
index 219be3ab7..d026f0229 100644
--- a/openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c
+++ b/openbsc/tests/msc_vlr/msc_vlr_test_umts_authen.c
@@ -27,8 +27,31 @@ void _test_umts_authen(enum ran_type via_ran)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000010650";
+ const char *sms =
+ "09" /* SMS messages */
+ "01" /* CP-DATA */
+ "58" /* length */
+ "01" /* Network to MS */
+ "00" /* reference */
+ /* originator (gsm411_send_sms() hardcodes this weird nr) */
+ "0791" "447758100650" /* 447785016005 */
+ "00" /* dest */
+ /* SMS TPDU */
+ "4c" /* len */
+ "00" /* SMS deliver */
+ "05802443f2" /* originating address 42342 */
+ "00" /* TP-PID */
+ "00" /* GSM default alphabet */
+ "071010" /* Y-M-D (from wrapped gsm340_gen_scts())*/
+ "000000" /* H-M-S */
+ "00" /* GMT+0 */
+ "44" /* data length */
+ "5079da1e1ee7416937485e9ea7c965373d1d6683c270383b3d0e"
+ "d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb"
+ "0c7ac3e9e9b7db05";
net->authentication_required = true;
+ net->vlr->cfg.assign_tmsi = true;
rx_from_ran = via_ran;
btw("Location Update request causes a GSUP Send Auth Info request to HLR");
@@ -99,10 +122,26 @@ void _test_umts_authen(enum ran_type via_ran)
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
- btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
- gsup_expect_tx("04010809710000000156f0");
- ms_sends_msg("0554" "e229c19e" "2104" "791f2e41");
- VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+ if (via_ran == RAN_GERAN_A) {
+ btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
+ gsup_expect_tx("04010809710000000156f0");
+ ms_sends_msg("0554" "e229c19e" "2104" "791f2e41");
+ VERBOSE_ASSERT(gsup_tx_confirmed, == true, "%d");
+ VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+ } else {
+ /* On UTRAN */
+ btw("MS sends Authen Response, VLR accepts and sends SecurityModeControl");
+ cipher_mode_cmd_sent = false;
+ ms_sends_msg("0554" "e229c19e" "2104" "791f2e41");
+ VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
+ VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+
+ btw("MS sends SecurityModeControl acceptance, VLR accepts and sends GSUP LU Req to HLR");
+ gsup_expect_tx("04010809710000000156f0");
+ ms_sends_security_mode_complete();
+ VERBOSE_ASSERT(gsup_tx_confirmed, == true, "%d");
+ VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+ }
btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
gsup_rx("10010809710000000156f00804032443f2",
@@ -112,8 +151,25 @@ void _test_umts_authen(enum ran_type via_ran)
btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
gsup_rx("06010809710000000156f0", NULL);
- btw("LU was successful, and the conn has already been closed");
VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
+
+ btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
+ EXPECT_CONN_COUNT(1);
+ EXPECT_ACCEPTED(false);
+ thwart_rx_non_initial_requests();
+
+ btw("even though the TMSI is not acked, we can already find the subscr with it");
+ vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100);
+ VERBOSE_ASSERT(vsub != NULL, == true, "%d");
+ VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
+ VERBOSE_ASSERT(vsub->tmsi_new, == 0x03020100, "0x%08x");
+ VERBOSE_ASSERT(vsub->tmsi, == GSM_RESERVED_TMSI, "0x%08x");
+ vlr_subscr_put(vsub);
+
+ btw("MS sends TMSI Realloc Complete");
+ ms_sends_msg("055b");
+
+ btw("LU was successful, and the conn has already been closed");
EXPECT_CONN_COUNT(0);
BTW("after a while, a new conn sends a CM Service Request. VLR responds with Auth Req, 2nd auth vector");
@@ -134,10 +190,23 @@ void _test_umts_authen(enum ran_type via_ran)
EXPECT_ACCEPTED(false);
thwart_rx_non_initial_requests();
- btw("MS sends Authen Response, VLR accepts with a CM Service Accept");
- gsup_expect_tx(NULL);
- ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, s.a. */
- VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
+ if (via_ran == RAN_GERAN_A) {
+ btw("MS sends Authen Response, VLR accepts with a CM Service Accept");
+ gsup_expect_tx(NULL);
+ ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, s.a. */
+ VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
+ } else {
+ /* On UTRAN */
+ btw("MS sends Authen Response, VLR accepts and sends SecurityModeControl");
+ cipher_mode_cmd_sent = false;
+ ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, s.a. */
+ VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
+ VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
+
+ btw("MS sends SecurityModeControl acceptance, VLR accepts; above Ciphering is an implicit CM Service Accept");
+ ms_sends_security_mode_complete();
+ VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
+ }
btw("a USSD request is serviced");
dtap_expect_tx_ussd("Your extension is 42342\r");
@@ -183,31 +252,25 @@ void _test_umts_authen(enum ran_type via_ran)
EXPECT_ACCEPTED(false);
thwart_rx_non_initial_requests();
- btw("MS sends Authen Response, VLR accepts and sends pending SMS");
- dtap_expect_tx("09" /* SMS messages */
- "01" /* CP-DATA */
- "58" /* length */
- "01" /* Network to MS */
- "00" /* reference */
- /* originator (gsm411_send_sms() hardcodes this weird nr) */
- "0791" "447758100650" /* 447785016005 */
- "00" /* dest */
- /* SMS TPDU */
- "4c" /* len */
- "00" /* SMS deliver */
- "05802443f2" /* originating address 42342 */
- "00" /* TP-PID */
- "00" /* GSM default alphabet */
- "071010" /* Y-M-D (from wrapped gsm340_gen_scts())*/
- "000000" /* H-M-S */
- "00" /* GMT+0 */
- "44" /* data length */
- "5079da1e1ee7416937485e9ea7c965373d1d6683c270383b3d0e"
- "d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb"
- "0c7ac3e9e9b7db05");
- ms_sends_msg("0554" "706f9967" "2104" "19ba609c"); /* 3nd vector's res, s.a. */
- VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d");
- VERBOSE_ASSERT(paging_stopped, == true, "%d");
+ if (via_ran == RAN_GERAN_A) {
+ btw("MS sends Authen Response, VLR accepts and sends pending SMS");
+ dtap_expect_tx(sms);
+ ms_sends_msg("0554" "706f9967" "2104" "19ba609c"); /* 3nd vector's res, s.a. */
+ VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d");
+ VERBOSE_ASSERT(paging_stopped, == true, "%d");
+ } else {
+ /* On UTRAN */
+ btw("MS sends Authen Response, VLR accepts and sends SecurityModeControl");
+ cipher_mode_cmd_sent = false;
+ ms_sends_msg("0554" "706f9967" "2104" "19ba609c"); /* 3nd vector's res, s.a. */
+ VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
+ VERBOSE_ASSERT(paging_stopped, == false, "%d");
+
+ btw("MS sends SecurityModeControl acceptance, VLR accepts and sends SMS");
+ dtap_expect_tx(sms);
+ ms_sends_security_mode_complete();
+ VERBOSE_ASSERT(paging_stopped, == true, "%d");
+ }
btw("SMS was delivered, no requests pending for subscr");
vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
@@ -264,7 +327,11 @@ extern int milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand,
void _test_umts_authen_resync(enum ran_type via_ran)
{
+ struct vlr_subscr *vsub;
+ const char *imsi = "901700000010650";
+
net->authentication_required = true;
+ net->vlr->cfg.assign_tmsi = true;
rx_from_ran = via_ran;
btw("Location Update request causes a GSUP Send Auth Info request to HLR");
@@ -415,10 +482,26 @@ void _test_umts_authen_resync(enum ran_type via_ran)
VERBOSE_ASSERT(auth_request_sent, == true, "%d");
VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
- btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
- gsup_expect_tx("04010809710000000156f0");
- ms_sends_msg("0554" "1df5f0b4" "2104" "f22b696e");
- VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+ if (via_ran == RAN_GERAN_A) {
+ btw("MS sends Authen Response, VLR accepts and sends GSUP LU Req to HLR");
+ gsup_expect_tx("04010809710000000156f0");
+ ms_sends_msg("0554" "1df5f0b4" "2104" "f22b696e");
+ VERBOSE_ASSERT(gsup_tx_confirmed, == true, "%d");
+ VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+ } else {
+ /* On UTRAN */
+ btw("MS sends Authen Response, VLR accepts and sends SecurityModeControl");
+ cipher_mode_cmd_sent = false;
+ ms_sends_msg("0554" "1df5f0b4" "2104" "f22b696e");
+ VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
+ VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+
+ btw("MS sends SecurityModeControl acceptance, VLR accepts and sends GSUP LU Req to HLR");
+ gsup_expect_tx("04010809710000000156f0");
+ ms_sends_security_mode_complete();
+ VERBOSE_ASSERT(gsup_tx_confirmed, == true, "%d");
+ VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
+ }
btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
gsup_rx("10010809710000000156f00804032443f2",
@@ -428,8 +511,25 @@ void _test_umts_authen_resync(enum ran_type via_ran)
btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
gsup_rx("06010809710000000156f0", NULL);
- btw("LU was successful, and the conn has already been closed");
VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
+
+ btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
+ EXPECT_CONN_COUNT(1);
+ EXPECT_ACCEPTED(false);
+ thwart_rx_non_initial_requests();
+
+ btw("even though the TMSI is not acked, we can already find the subscr with it");
+ vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100);
+ VERBOSE_ASSERT(vsub != NULL, == true, "%d");
+ VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d");
+ VERBOSE_ASSERT(vsub->tmsi_new, == 0x03020100, "0x%08x");
+ VERBOSE_ASSERT(vsub->tmsi, == GSM_RESERVED_TMSI, "0x%08x");
+ vlr_subscr_put(vsub);
+
+ btw("MS sends TMSI Realloc Complete");
+ ms_sends_msg("055b");
+
+ btw("LU was successful, and the conn has already been closed");
EXPECT_CONN_COUNT(0);
clear_vlr();