From 10db2817e5ce76eebd61dd6b607a6dfad57fa417 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 14 Dec 2018 16:14:34 +0100 Subject: GSUP: add CHECK-IMEI message Implement necessary messages for Procedure Check_IMEI_VLR (TS 23.018 Chapter 7.1.2.9). This lets the VLR ask the EIR to check if an IMEI is valid. In the Osmocom stack, we don't have an EIR and this request will be handled by the HLR. We will be able to store the IMEI in the HLR as side-effect (OS#2541). This is roughly based on TS 29.002 8.7.1 MAP_CHECK_IMEI service, but only implements the bare minimum required IEs (imei and imei_result). Related: OS#3733 Change-Id: I085819df0ea7f3bfeb0cabebb5fd1942a23c6155 --- tests/gsup/gsup_test.c | 33 +++++++++++++++++++++++++++++++++ tests/gsup/gsup_test.err | 15 +++++++++++++++ tests/gsup/gsup_test.ok | 6 ++++++ 3 files changed, 54 insertions(+) (limited to 'tests') diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index 079a7031..f1945735 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -289,6 +289,33 @@ static void test_gsup_messages_dec_enc(void) 0x02, /* Memory Available (SMMA) */ }; + static const uint8_t send_check_imei_req[] = { + 0x30, /* OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST */ + TEST_IMSI_IE, + + /* imei */ + 0x50, 0x09, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + }; + + static const uint8_t send_check_imei_err[] = { + 0x31, /* OSMO_GSUP_MSGT_CHECK_IMEI_ERROR */ + TEST_IMSI_IE, + + /* cause */ + 0x02, 0x01, + 0x60, /* GMM_CAUSE_INV_MAND_INFO */ + }; + + static const uint8_t send_check_imei_res[] = { + 0x32, /* OSMO_GSUP_MSGT_CHECK_IMEI_RESULT */ + TEST_IMSI_IE, + + /* imei_result */ + 0x51, 0x01, + 0x00, /* OSMO_GSUP_IMEI_RESULT_ACK */ + }; + static const struct test { char *name; const uint8_t *data; @@ -338,6 +365,12 @@ static void test_gsup_messages_dec_enc(void) send_mo_mt_forward_sm_err, sizeof(send_mo_mt_forward_sm_err)}, {"ReadyForSM (MSC -> SMSC) Indication", send_ready_for_sm_ind, sizeof(send_ready_for_sm_ind)}, + {"Check IMEI Request", + send_check_imei_req, sizeof(send_check_imei_req)}, + {"Check IMEI Error", + send_check_imei_err, sizeof(send_check_imei_err)}, + {"Check IMEI Result", + send_check_imei_res, sizeof(send_check_imei_res)}, }; printf("Test GSUP message decoding/encoding\n"); diff --git a/tests/gsup/gsup_test.err b/tests/gsup/gsup_test.err index 236c38a9..73b35fc5 100644 --- a/tests/gsup/gsup_test.err +++ b/tests/gsup/gsup_test.err @@ -64,6 +64,15 @@ generated message: 2c 01 08 21 43 65 87 09 21 43 f5 46 01 02 original message: 2c 01 08 21 43 65 87 09 21 43 f5 46 01 02 IMSI: 123456789012345 + generated message: 30 01 08 21 43 65 87 09 21 43 f5 50 09 42 42 42 42 42 42 42 42 42 + original message: 30 01 08 21 43 65 87 09 21 43 f5 50 09 42 42 42 42 42 42 42 42 42 + IMSI: 123456789012345 + generated message: 31 01 08 21 43 65 87 09 21 43 f5 02 01 60 + original message: 31 01 08 21 43 65 87 09 21 43 f5 02 01 60 + IMSI: 123456789012345 + generated message: 32 01 08 21 43 65 87 09 21 43 f5 51 01 00 + original message: 32 01 08 21 43 65 87 09 21 43 f5 51 01 00 + IMSI: 123456789012345 message 0: tested 11 truncations, 11 parse failures message 1: tested 14 truncations, 13 parse failures message 2: tested 83 truncations, 81 parse failures @@ -86,6 +95,9 @@ message 19: tested 20 truncations, 18 parse failures message 20: tested 26 truncations, 22 parse failures message 21: tested 14 truncations, 13 parse failures + message 22: tested 22 truncations, 21 parse failures + message 23: tested 14 truncations, 13 parse failures + message 24: tested 14 truncations, 13 parse failures DLGSUP Stopping DLGSUP logging message 0: tested 2816 modifications, 510 parse failures message 1: tested 3584 modifications, 770 parse failures @@ -109,3 +121,6 @@ DLGSUP Stopping DLGSUP logging message 19: tested 5120 modifications, 1031 parse failures message 20: tested 6656 modifications, 1546 parse failures message 21: tested 3584 modifications, 771 parse failures + message 22: tested 5632 modifications, 771 parse failures + message 23: tested 3584 modifications, 770 parse failures + message 24: tested 3584 modifications, 771 parse failures diff --git a/tests/gsup/gsup_test.ok b/tests/gsup/gsup_test.ok index 36e35c8b..70f723c0 100644 --- a/tests/gsup/gsup_test.ok +++ b/tests/gsup/gsup_test.ok @@ -43,4 +43,10 @@ Test GSUP message decoding/encoding MO-/MT-ForwardSM Error OK Testing ReadyForSM (MSC -> SMSC) Indication ReadyForSM (MSC -> SMSC) Indication OK + Testing Check IMEI Request + Check IMEI Request OK + Testing Check IMEI Error + Check IMEI Error OK + Testing Check IMEI Result + Check IMEI Result OK Done. -- cgit v1.2.3