Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 1 | /* Osmocom MSC+VLR end-to-end tests */ |
| 2 | |
| 3 | /* (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> |
| 4 | * |
| 5 | * All Rights Reserved |
| 6 | * |
| 7 | * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU Affero General Public License as published by |
| 11 | * the Free Software Foundation; either version 3 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU Affero General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Affero General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include "msc_vlr_tests.h" |
| 25 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 26 | static void test_no_authen() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 27 | { |
| 28 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 29 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 30 | /* No auth only works on GERAN */ |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 31 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 32 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 33 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 34 | |
| 35 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 36 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 37 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 38 | ms_sends_msg("050802008168000130089910070000006402"); |
| 39 | OSMO_ASSERT(gsup_tx_confirmed); |
| 40 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 41 | |
| 42 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 43 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 44 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 45 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 46 | |
| 47 | btw("having received subscriber data does not mean acceptance"); |
| 48 | EXPECT_ACCEPTED(false); |
| 49 | |
| 50 | thwart_rx_non_initial_requests(); |
| 51 | |
| 52 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 53 | |
| 54 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 55 | expect_bssap_clear(); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 56 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 57 | |
| 58 | btw("LU was successful, and the conn has already been closed"); |
| 59 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 60 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 4068ab2 | 2018-04-01 20:55:54 +0200 | [diff] [blame] | 61 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 62 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 63 | EXPECT_CONN_COUNT(0); |
| 64 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 65 | BTW("after a while, a new conn sends a CM Service Request (MO SMS)"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 66 | cm_service_result_sent = RES_NONE; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 67 | ms_sends_msg("05 24 74 03 30 58 86 08 99 10 07 00 00 00 64 02"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 68 | VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d"); |
| 69 | EXPECT_ACCEPTED(true); |
| 70 | |
Vadim Yanitskiy | 2760585 | 2018-06-15 23:57:30 +0700 | [diff] [blame] | 71 | /* Release connection */ |
Vadim Yanitskiy | 188dd5f | 2019-06-19 02:05:08 +0700 | [diff] [blame] | 72 | expect_bssap_clear(); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 73 | conn_conclude_cm_service_req(g_msub, MSC_A_USE_CM_SERVICE_SMS); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 74 | |
| 75 | btw("all requests serviced, conn has been released"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 76 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 77 | EXPECT_CONN_COUNT(0); |
| 78 | |
| 79 | BTW("an SMS is sent, MS is paged"); |
| 80 | paging_expect_imsi(imsi); |
| 81 | paging_sent = false; |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 82 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 83 | OSMO_ASSERT(vsub); |
| 84 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d"); |
| 85 | |
| 86 | send_sms(vsub, vsub, |
| 87 | "Privacy in residential applications is a desirable" |
| 88 | " marketing option."); |
| 89 | |
| 90 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 91 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 92 | vsub = NULL; |
| 93 | VERBOSE_ASSERT(paging_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 94 | |
| 95 | btw("the subscriber and its pending request should remain"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 96 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 97 | OSMO_ASSERT(vsub); |
| 98 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 99 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 100 | |
| 101 | btw("MS replies with Paging Response, we deliver the SMS"); |
| 102 | dtap_expect_tx("09" /* SMS messages */ |
| 103 | "01" /* CP-DATA */ |
| 104 | "58" /* length */ |
| 105 | "01" /* Network to MS */ |
| 106 | "00" /* reference */ |
| 107 | /* originator (gsm411_send_sms() hardcodes this weird nr) */ |
| 108 | "0791" "447758100650" /* 447785016005 */ |
| 109 | "00" /* dest */ |
| 110 | /* SMS TPDU */ |
| 111 | "4c" /* len */ |
| 112 | "00" /* SMS deliver */ |
| 113 | "05806470f1" /* originating address 46071 */ |
| 114 | "00" /* TP-PID */ |
| 115 | "00" /* GSM default alphabet */ |
| 116 | "071010" /* Y-M-D (from wrapped gsm340_gen_scts())*/ |
| 117 | "000000" /* H-M-S */ |
| 118 | "00" /* GMT+0 */ |
| 119 | "44" /* data length */ |
| 120 | "5079da1e1ee7416937485e9ea7c965373d1d6683c270383b3d0e" |
| 121 | "d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb" |
| 122 | "0c7ac3e9e9b7db05"); |
| 123 | ms_sends_msg("06270703305882089910070000006402"); |
| 124 | VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 125 | |
| 126 | btw("SMS was delivered, no requests pending for subscr"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 127 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 128 | OSMO_ASSERT(vsub); |
| 129 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 130 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 131 | |
| 132 | btw("conn is still open to wait for SMS ack dance"); |
| 133 | EXPECT_CONN_COUNT(1); |
| 134 | |
| 135 | btw("MS replies with CP-ACK for received SMS"); |
| 136 | ms_sends_msg("8904"); |
| 137 | EXPECT_CONN_COUNT(1); |
| 138 | |
| 139 | btw("MS also sends RP-ACK, MSC in turn sends CP-ACK for that"); |
| 140 | dtap_expect_tx("0904"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 141 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 142 | ms_sends_msg("890106020041020000"); |
| 143 | VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 144 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 145 | |
| 146 | btw("SMS is done, conn is gone"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 147 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 148 | EXPECT_CONN_COUNT(0); |
| 149 | |
| 150 | BTW("subscriber detaches"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 151 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 152 | ms_sends_msg("050130089910070000006402"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 153 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 154 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 155 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 156 | EXPECT_CONN_COUNT(0); |
| 157 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 158 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 159 | } |
| 160 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 161 | static void test_no_authen_tmsi() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 162 | { |
| 163 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 164 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 165 | |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 166 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 167 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 168 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 169 | |
| 170 | net->vlr->cfg.assign_tmsi = true; |
| 171 | |
| 172 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 173 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 174 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 175 | ms_sends_msg("050802008168000130089910070000006402"); |
| 176 | OSMO_ASSERT(gsup_tx_confirmed); |
| 177 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 178 | |
| 179 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 180 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 181 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 182 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 183 | |
| 184 | btw("having received subscriber data does not mean acceptance"); |
| 185 | EXPECT_ACCEPTED(false); |
| 186 | thwart_rx_non_initial_requests(); |
| 187 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 188 | |
| 189 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 190 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 191 | |
| 192 | btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl"); |
| 193 | EXPECT_CONN_COUNT(1); |
| 194 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 195 | EXPECT_ACCEPTED(false); |
| 196 | thwart_rx_non_initial_requests(); |
| 197 | |
| 198 | btw("even though the TMSI is not acked, we can already find the subscr with it"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 199 | vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 200 | VERBOSE_ASSERT(vsub != NULL, == true, "%d"); |
| 201 | VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d"); |
| 202 | VERBOSE_ASSERT(vsub->tmsi_new, == 0x03020100, "0x%08x"); |
| 203 | VERBOSE_ASSERT(vsub->tmsi, == GSM_RESERVED_TMSI, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 204 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 205 | |
| 206 | btw("MS sends TMSI Realloc Complete"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 207 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 208 | ms_sends_msg("055b"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 209 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 210 | |
| 211 | btw("LU was successful, and the conn has already been closed"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 212 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 213 | EXPECT_CONN_COUNT(0); |
| 214 | |
| 215 | btw("Subscriber has the new TMSI"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 216 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 217 | VERBOSE_ASSERT(vsub != NULL, == true, "%d"); |
| 218 | VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d"); |
| 219 | VERBOSE_ASSERT(vsub->tmsi_new, == GSM_RESERVED_TMSI, "0x%08x"); |
| 220 | VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 221 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 222 | |
| 223 | BTW("after a while, a new conn sends a CM Service Request using above TMSI"); |
| 224 | cm_service_result_sent = RES_NONE; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 225 | ms_sends_msg("05247403305886" "05f4" "03020100"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 226 | VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d"); |
| 227 | EXPECT_ACCEPTED(true); |
| 228 | |
Vadim Yanitskiy | 2760585 | 2018-06-15 23:57:30 +0700 | [diff] [blame] | 229 | /* Release connection */ |
Vadim Yanitskiy | 188dd5f | 2019-06-19 02:05:08 +0700 | [diff] [blame] | 230 | expect_bssap_clear(); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 231 | conn_conclude_cm_service_req(g_msub, MSC_A_USE_CM_SERVICE_SMS); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 232 | |
| 233 | btw("all requests serviced, conn has been released"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 234 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 235 | EXPECT_CONN_COUNT(0); |
| 236 | |
| 237 | BTW("an SMS is sent, MS is paged using above TMSI"); |
| 238 | paging_expect_tmsi(0x03020100); |
| 239 | paging_sent = false; |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 240 | vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 241 | OSMO_ASSERT(vsub); |
| 242 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d"); |
| 243 | |
| 244 | send_sms(vsub, vsub, |
| 245 | "Privacy in residential applications is a desirable" |
| 246 | " marketing option."); |
| 247 | |
| 248 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 249 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 250 | vsub = NULL; |
| 251 | VERBOSE_ASSERT(paging_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 252 | |
| 253 | btw("the subscriber and its pending request should remain"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 254 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 255 | OSMO_ASSERT(vsub); |
| 256 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 257 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 258 | |
| 259 | btw("MS replies with Paging Response using TMSI, we deliver the SMS"); |
| 260 | dtap_expect_tx("09" /* SMS messages */ |
| 261 | "01" /* CP-DATA */ |
| 262 | "58" /* length */ |
| 263 | "01" /* Network to MS */ |
| 264 | "00" /* reference */ |
| 265 | /* originator (gsm411_send_sms() hardcodes this weird nr) */ |
| 266 | "0791" "447758100650" /* 447785016005 */ |
| 267 | "00" /* dest */ |
| 268 | /* SMS TPDU */ |
| 269 | "4c" /* len */ |
| 270 | "00" /* SMS deliver */ |
| 271 | "05806470f1" /* originating address 46071 */ |
| 272 | "00" /* TP-PID */ |
| 273 | "00" /* GSM default alphabet */ |
| 274 | "071010" /* Y-M-D (from wrapped gsm340_gen_scts())*/ |
| 275 | "000000" /* H-M-S */ |
| 276 | "00" /* GMT+0 */ |
| 277 | "44" /* data length */ |
| 278 | "5079da1e1ee7416937485e9ea7c965373d1d6683c270383b3d0e" |
| 279 | "d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb" |
| 280 | "0c7ac3e9e9b7db05"); |
| 281 | ms_sends_msg("06270703305882" "05f4" "03020100"); |
| 282 | VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 283 | |
| 284 | btw("SMS was delivered, no requests pending for subscr"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 285 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 286 | OSMO_ASSERT(vsub); |
| 287 | VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 288 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 289 | |
| 290 | btw("conn is still open to wait for SMS ack dance"); |
| 291 | EXPECT_CONN_COUNT(1); |
| 292 | |
| 293 | btw("MS replies with CP-ACK for received SMS"); |
| 294 | ms_sends_msg("8904"); |
| 295 | EXPECT_CONN_COUNT(1); |
| 296 | |
| 297 | btw("MS also sends RP-ACK, MSC in turn sends CP-ACK for that"); |
| 298 | dtap_expect_tx("0904"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 299 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 300 | ms_sends_msg("890106020041020000"); |
| 301 | VERBOSE_ASSERT(dtap_tx_confirmed, == true, "%d"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 302 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 303 | |
| 304 | btw("SMS is done, conn is gone"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 305 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 306 | EXPECT_CONN_COUNT(0); |
| 307 | |
| 308 | /* TODO: when the subscriber detaches, the vlr_subscr gets |
| 309 | * deallocated and we no longer know the TMSI. This case is covered by |
| 310 | * test_lu_unknown_tmsi(), so here I'd like to still have the TMSI. |
| 311 | BTW("subscriber detaches, using TMSI"); |
| 312 | ms_sends_msg("050130" "05f4" "03020100"); |
| 313 | EXPECT_CONN_COUNT(0); |
| 314 | */ |
| 315 | |
| 316 | BTW("subscriber sends LU Request, this time with the TMSI"); |
| 317 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 318 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 319 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 320 | ms_sends_msg("050802008168000130" "05f4" "03020100"); |
| 321 | OSMO_ASSERT(gsup_tx_confirmed); |
| 322 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 323 | |
| 324 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 325 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 326 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 327 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 328 | |
| 329 | btw("having received subscriber data does not mean acceptance"); |
| 330 | EXPECT_ACCEPTED(false); |
| 331 | thwart_rx_non_initial_requests(); |
| 332 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 333 | |
| 334 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 335 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 336 | |
| 337 | btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl"); |
| 338 | EXPECT_CONN_COUNT(1); |
| 339 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 340 | EXPECT_ACCEPTED(false); |
| 341 | thwart_rx_non_initial_requests(); |
| 342 | |
| 343 | btw("even though the TMSI is not acked, we can already find the subscr with it"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 344 | vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 345 | VERBOSE_ASSERT(vsub != NULL, == true, "%d"); |
| 346 | VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d"); |
| 347 | VERBOSE_ASSERT(vsub->tmsi_new, == 0x07060504, "0x%08x"); |
| 348 | VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 349 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 350 | |
| 351 | btw("MS sends TMSI Realloc Complete"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 352 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 353 | ms_sends_msg("055b"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 354 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 355 | |
| 356 | btw("LU was successful, and the conn has already been closed"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 357 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 358 | EXPECT_CONN_COUNT(0); |
| 359 | |
| 360 | btw("subscriber has the new TMSI"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 361 | vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 362 | VERBOSE_ASSERT(vsub != NULL, == true, "%d"); |
| 363 | VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d"); |
| 364 | VERBOSE_ASSERT(vsub->tmsi_new, == GSM_RESERVED_TMSI, "0x%08x"); |
| 365 | VERBOSE_ASSERT(vsub->tmsi, == 0x07060504, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 366 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 367 | |
| 368 | BTW("subscriber detaches, using new TMSI"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 369 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 370 | ms_sends_msg("050130" "05f4" "07060504"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 371 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 372 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 373 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 374 | EXPECT_CONN_COUNT(0); |
| 375 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 376 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 377 | } |
| 378 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 379 | static void test_no_authen_imei() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 380 | { |
| 381 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 382 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 383 | |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 384 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 385 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 386 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 387 | |
| 388 | net->vlr->cfg.check_imei_rqd = true; |
| 389 | |
| 390 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 391 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 392 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 393 | ms_sends_msg("050802008168000130089910070000006402"); |
| 394 | OSMO_ASSERT(gsup_tx_confirmed); |
| 395 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 396 | |
| 397 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 398 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 399 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 400 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 401 | |
| 402 | btw("having received subscriber data does not mean acceptance"); |
| 403 | EXPECT_ACCEPTED(false); |
| 404 | thwart_rx_non_initial_requests(); |
| 405 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 406 | |
| 407 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT, and we send an ID Request for the IMEI to the MS"); |
| 408 | dtap_expect_tx("051802"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 409 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 410 | |
| 411 | btw("We will only do business when the IMEI is known"); |
| 412 | EXPECT_CONN_COUNT(1); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 413 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 414 | OSMO_ASSERT(vsub); |
| 415 | VERBOSE_ASSERT(vsub->imei[0], == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 416 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 417 | EXPECT_ACCEPTED(false); |
| 418 | thwart_rx_non_initial_requests(); |
| 419 | |
Oliver Smith | 7d05309 | 2018-12-14 17:37:38 +0100 | [diff] [blame] | 420 | btw("MS replies with an Identity Response, VLR sends the IMEI to HLR"); |
Oliver Smith | d103705 | 2019-05-02 13:39:26 +0200 | [diff] [blame] | 421 | gsup_expect_tx("30010809710000004026f050080724433224433224" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 422 | /* 3GPP TS 23.003: 6.2.1 Composition of IMEI: the IMEI ends with a |
| 423 | * spare digit that shall be sent as zero by the MS. */ |
| 424 | ms_sends_msg("0559084a32244332244302"); |
Oliver Smith | 7d05309 | 2018-12-14 17:37:38 +0100 | [diff] [blame] | 425 | |
| 426 | btw("HLR accepts the IMEI"); |
| 427 | expect_bssap_clear(); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 428 | gsup_rx("32010809710000004026f0510100" HLR_TO_VLR, NULL); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 429 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 430 | |
| 431 | btw("LU was successful, and the conn has already been closed"); |
| 432 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 433 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 434 | EXPECT_CONN_COUNT(0); |
| 435 | |
| 436 | btw("Subscriber has the IMEI"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 437 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 438 | OSMO_ASSERT(vsub); |
Oliver Smith | d103705 | 2019-05-02 13:39:26 +0200 | [diff] [blame] | 439 | VERBOSE_ASSERT(strcmp(vsub->imei, "42342342342342"), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 440 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 441 | |
| 442 | BTW("subscriber detaches"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 443 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 444 | ms_sends_msg("050130089910070000006402"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 445 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 446 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 447 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 448 | EXPECT_CONN_COUNT(0); |
| 449 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 450 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 451 | } |
| 452 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 453 | static void test_no_authen_tmsi_imei() |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 454 | { |
| 455 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 456 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 457 | |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 458 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 459 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 460 | comment_start(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 461 | |
| 462 | net->vlr->cfg.assign_tmsi = true; |
| 463 | net->vlr->cfg.check_imei_rqd = true; |
| 464 | |
| 465 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 466 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 467 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 468 | ms_sends_msg("050802008168000130089910070000006402"); |
| 469 | OSMO_ASSERT(gsup_tx_confirmed); |
| 470 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 471 | |
| 472 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 473 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 474 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 475 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 476 | |
| 477 | btw("having received subscriber data does not mean acceptance"); |
| 478 | EXPECT_ACCEPTED(false); |
| 479 | thwart_rx_non_initial_requests(); |
| 480 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 481 | |
| 482 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT, and we send an ID Request for the IMEI to the MS"); |
| 483 | dtap_expect_tx("051802"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 484 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 485 | |
| 486 | btw("We will only do business when the IMEI is known"); |
| 487 | EXPECT_CONN_COUNT(1); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 488 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 489 | OSMO_ASSERT(vsub); |
| 490 | VERBOSE_ASSERT(vsub->imei[0], == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 491 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 492 | EXPECT_ACCEPTED(false); |
| 493 | thwart_rx_non_initial_requests(); |
| 494 | |
Oliver Smith | 7d05309 | 2018-12-14 17:37:38 +0100 | [diff] [blame] | 495 | btw("MS replies with an Identity Response, VLR sends the IMEI to HLR"); |
Oliver Smith | d103705 | 2019-05-02 13:39:26 +0200 | [diff] [blame] | 496 | gsup_expect_tx("30010809710000004026f050080724433224433224" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 497 | ms_sends_msg("0559084a32244332244302"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 498 | |
Oliver Smith | 7d05309 | 2018-12-14 17:37:38 +0100 | [diff] [blame] | 499 | btw("HLR accepts the IMEI"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 500 | gsup_rx("32010809710000004026f0510100" HLR_TO_VLR, NULL); |
Oliver Smith | 7d05309 | 2018-12-14 17:37:38 +0100 | [diff] [blame] | 501 | |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 502 | btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl"); |
| 503 | EXPECT_CONN_COUNT(1); |
| 504 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 505 | EXPECT_ACCEPTED(false); |
| 506 | thwart_rx_non_initial_requests(); |
| 507 | |
| 508 | btw("MS sends TMSI Realloc Complete"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 509 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 510 | ms_sends_msg("055b"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 511 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 512 | |
| 513 | btw("LU was successful, and the conn has already been closed"); |
| 514 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 515 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 516 | EXPECT_CONN_COUNT(0); |
| 517 | |
| 518 | btw("Subscriber has the IMEI and TMSI"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 519 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 520 | OSMO_ASSERT(vsub); |
Oliver Smith | d103705 | 2019-05-02 13:39:26 +0200 | [diff] [blame] | 521 | VERBOSE_ASSERT(strcmp(vsub->imei, "42342342342342"), == 0, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 522 | VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 523 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 524 | |
| 525 | BTW("subscriber detaches"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 526 | expect_bssap_clear(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 527 | ms_sends_msg("050130089910070000006402"); |
Philipp Maier | fbf6610 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 528 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 529 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 530 | ran_sends_clear_complete(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 531 | EXPECT_CONN_COUNT(0); |
| 532 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 533 | comment_end(); |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 534 | } |
| 535 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 536 | static void test_no_authen_imeisv() |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 537 | { |
| 538 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 539 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 540 | |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 541 | /* No auth only works on GERAN */ |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 542 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 543 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 544 | comment_start(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 545 | |
| 546 | net->vlr->cfg.retrieve_imeisv_early = true; |
| 547 | |
| 548 | btw("Location Update request causes an IMEISV ID request back to the MS"); |
| 549 | lu_result_sent = RES_NONE; |
| 550 | dtap_expect_tx("051803"); |
| 551 | ms_sends_msg("050802008168000130089910070000006402"); |
| 552 | OSMO_ASSERT(dtap_tx_confirmed); |
| 553 | |
| 554 | btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR"); |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 555 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 556 | ms_sends_msg("0559094332244332244372f5"); |
| 557 | OSMO_ASSERT(gsup_tx_confirmed); |
| 558 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 559 | |
| 560 | btw("Subscriber has the IMEISV from the ID Response"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 561 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 562 | OSMO_ASSERT(vsub); |
| 563 | VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 564 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 565 | |
| 566 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 567 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 568 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 569 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 570 | |
| 571 | btw("having received subscriber data does not mean acceptance"); |
| 572 | EXPECT_ACCEPTED(false); |
| 573 | |
| 574 | thwart_rx_non_initial_requests(); |
| 575 | |
| 576 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 577 | |
| 578 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
| 579 | expect_bssap_clear(); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 580 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 581 | |
| 582 | btw("LU was successful, and the conn has already been closed"); |
| 583 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 584 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 585 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 586 | EXPECT_CONN_COUNT(0); |
| 587 | |
| 588 | BTW("subscriber detaches"); |
| 589 | expect_bssap_clear(); |
| 590 | ms_sends_msg("050130089910070000006402"); |
| 591 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 592 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 593 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 594 | EXPECT_CONN_COUNT(0); |
| 595 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 596 | comment_end(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 597 | } |
| 598 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 599 | static void test_no_authen_imeisv_imei() |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 600 | { |
| 601 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 602 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 603 | |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 604 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 605 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 606 | comment_start(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 607 | |
| 608 | net->vlr->cfg.retrieve_imeisv_early = true; |
| 609 | net->vlr->cfg.check_imei_rqd = true; |
| 610 | |
| 611 | btw("Location Update request causes an IMEISV ID request back to the MS"); |
| 612 | lu_result_sent = RES_NONE; |
| 613 | dtap_expect_tx("051803"); |
| 614 | ms_sends_msg("050802008168000130089910070000006402"); |
| 615 | OSMO_ASSERT(dtap_tx_confirmed); |
| 616 | |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 617 | btw("MS replies with an Identity Response, causes an early GSUP Check IMEI request to HLR"); |
| 618 | gsup_expect_tx("30010809710000004026f050080724433224433224" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 619 | ms_sends_msg("0559094332244332244372f5"); |
| 620 | OSMO_ASSERT(gsup_tx_confirmed); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 621 | |
| 622 | btw("Subscriber has the IMEISV from the ID Response"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 623 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 624 | OSMO_ASSERT(vsub); |
| 625 | VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 626 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 627 | |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 628 | btw("HLR accepts the IMEI, VLR responds with LU Request"); |
| 629 | expect_bssap_clear(); |
| 630 | gsup_rx("32010809710000004026f0510100" HLR_TO_VLR, |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 631 | "04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 632 | OSMO_ASSERT(gsup_tx_confirmed); |
| 633 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 634 | |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 635 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 636 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 637 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 638 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 639 | |
| 640 | btw("having received subscriber data does not mean acceptance"); |
| 641 | EXPECT_ACCEPTED(false); |
| 642 | thwart_rx_non_initial_requests(); |
| 643 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 644 | |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 645 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 646 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 647 | |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 648 | btw("LU was successful, and the conn has already been closed"); |
| 649 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 650 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 651 | EXPECT_CONN_COUNT(0); |
| 652 | |
| 653 | btw("Subscriber has the IMEI"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 654 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 655 | OSMO_ASSERT(vsub); |
Oliver Smith | d103705 | 2019-05-02 13:39:26 +0200 | [diff] [blame] | 656 | VERBOSE_ASSERT(strcmp(vsub->imei, "42342342342342"), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 657 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 658 | |
| 659 | BTW("subscriber detaches"); |
| 660 | expect_bssap_clear(); |
| 661 | ms_sends_msg("050130089910070000006402"); |
| 662 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 663 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 664 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 665 | EXPECT_CONN_COUNT(0); |
| 666 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 667 | comment_end(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 668 | } |
| 669 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 670 | static void test_no_authen_imeisv_tmsi() |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 671 | { |
| 672 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 673 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 674 | |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 675 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 676 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 677 | comment_start(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 678 | |
| 679 | net->vlr->cfg.retrieve_imeisv_early = true; |
| 680 | net->vlr->cfg.assign_tmsi = true; |
| 681 | |
| 682 | btw("Location Update request causes an IMEISV ID request back to the MS"); |
| 683 | lu_result_sent = RES_NONE; |
| 684 | dtap_expect_tx("051803"); |
| 685 | ms_sends_msg("050802008168000130089910070000006402"); |
| 686 | OSMO_ASSERT(dtap_tx_confirmed); |
| 687 | |
| 688 | btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR"); |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 689 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 690 | ms_sends_msg("0559094332244332244372f5"); |
| 691 | OSMO_ASSERT(gsup_tx_confirmed); |
| 692 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 693 | |
| 694 | btw("Subscriber has the IMEISV from the ID Response"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 695 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 696 | OSMO_ASSERT(vsub); |
| 697 | VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 698 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 699 | |
| 700 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 701 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 702 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 703 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 704 | |
| 705 | btw("having received subscriber data does not mean acceptance"); |
| 706 | EXPECT_ACCEPTED(false); |
| 707 | thwart_rx_non_initial_requests(); |
| 708 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 709 | |
| 710 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 711 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 712 | |
| 713 | btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl"); |
| 714 | EXPECT_CONN_COUNT(1); |
| 715 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 716 | EXPECT_ACCEPTED(false); |
| 717 | thwart_rx_non_initial_requests(); |
| 718 | |
| 719 | btw("even though the TMSI is not acked, we can already find the subscr with it"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 720 | vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x03020100, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 721 | VERBOSE_ASSERT(vsub != NULL, == true, "%d"); |
| 722 | VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d"); |
| 723 | VERBOSE_ASSERT(vsub->tmsi_new, == 0x03020100, "0x%08x"); |
| 724 | VERBOSE_ASSERT(vsub->tmsi, == GSM_RESERVED_TMSI, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 725 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 726 | |
| 727 | btw("MS sends TMSI Realloc Complete"); |
| 728 | expect_bssap_clear(); |
| 729 | ms_sends_msg("055b"); |
| 730 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 731 | |
| 732 | btw("LU was successful, and the conn has already been closed"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 733 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 734 | EXPECT_CONN_COUNT(0); |
| 735 | |
| 736 | |
| 737 | BTW("subscriber sends LU Request, this time with the TMSI"); |
| 738 | btw("Location Update request causes an IMEISV ID request back to the MS"); |
| 739 | lu_result_sent = RES_NONE; |
| 740 | dtap_expect_tx("051803"); |
| 741 | ms_sends_msg("050802008168000130089910070000006402"); |
| 742 | OSMO_ASSERT(dtap_tx_confirmed); |
| 743 | |
| 744 | btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR"); |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 745 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 746 | ms_sends_msg("0559095332244332244372f6"); |
| 747 | OSMO_ASSERT(gsup_tx_confirmed); |
| 748 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 749 | |
| 750 | btw("Subscriber has the IMEISV from the ID Response"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 751 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 752 | OSMO_ASSERT(vsub); |
| 753 | VERBOSE_ASSERT(strcmp(vsub->imeisv, "5234234234234276"), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 754 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 755 | |
| 756 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 757 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 758 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 759 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 760 | |
| 761 | btw("having received subscriber data does not mean acceptance"); |
| 762 | EXPECT_ACCEPTED(false); |
| 763 | thwart_rx_non_initial_requests(); |
| 764 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 765 | |
| 766 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 767 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 768 | |
| 769 | btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl"); |
| 770 | EXPECT_CONN_COUNT(1); |
| 771 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 772 | EXPECT_ACCEPTED(false); |
| 773 | thwart_rx_non_initial_requests(); |
| 774 | |
| 775 | btw("even though the TMSI is not acked, we can already find the subscr with it"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 776 | vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 777 | VERBOSE_ASSERT(vsub != NULL, == true, "%d"); |
| 778 | VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d"); |
| 779 | VERBOSE_ASSERT(vsub->tmsi_new, == 0x07060504, "0x%08x"); |
| 780 | VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 781 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 782 | |
| 783 | btw("MS sends TMSI Realloc Complete"); |
| 784 | expect_bssap_clear(); |
| 785 | ms_sends_msg("055b"); |
| 786 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 787 | |
| 788 | btw("LU was successful, and the conn has already been closed"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 789 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 790 | EXPECT_CONN_COUNT(0); |
| 791 | |
| 792 | btw("subscriber has the new TMSI"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 793 | vsub = vlr_subscr_find_by_tmsi(net->vlr, 0x07060504, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 794 | VERBOSE_ASSERT(vsub != NULL, == true, "%d"); |
| 795 | VERBOSE_ASSERT(strcmp(vsub->imsi, imsi), == 0, "%d"); |
| 796 | VERBOSE_ASSERT(vsub->tmsi_new, == GSM_RESERVED_TMSI, "0x%08x"); |
| 797 | VERBOSE_ASSERT(vsub->tmsi, == 0x07060504, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 798 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 799 | |
| 800 | BTW("subscriber detaches, using new TMSI"); |
| 801 | expect_bssap_clear(); |
| 802 | ms_sends_msg("050130" "05f4" "07060504"); |
| 803 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 804 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 805 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 806 | EXPECT_CONN_COUNT(0); |
| 807 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 808 | comment_end(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 809 | } |
| 810 | |
Neels Hofmeyr | f3d81f6 | 2018-03-02 01:05:38 +0100 | [diff] [blame] | 811 | static void test_no_authen_imeisv_tmsi_imei() |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 812 | { |
| 813 | struct vlr_subscr *vsub; |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 814 | const char *imsi = "901700000004620"; |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 815 | |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 816 | rx_from_ran = OSMO_RAT_GERAN_A; |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 817 | |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 818 | comment_start(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 819 | |
| 820 | net->vlr->cfg.retrieve_imeisv_early = true; |
| 821 | net->vlr->cfg.assign_tmsi = true; |
| 822 | net->vlr->cfg.check_imei_rqd = true; |
| 823 | |
| 824 | btw("Location Update request causes an IMEISV ID request back to the MS"); |
| 825 | lu_result_sent = RES_NONE; |
| 826 | dtap_expect_tx("051803"); |
| 827 | ms_sends_msg("050802008168000130089910070000006402"); |
| 828 | OSMO_ASSERT(dtap_tx_confirmed); |
| 829 | |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 830 | btw("MS replies with an Identity Response, causes an early GSUP Check IMEI request to HLR"); |
| 831 | gsup_expect_tx("30010809710000004026f050080724433224433224" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 832 | ms_sends_msg("0559094332244332244372f5"); |
| 833 | OSMO_ASSERT(gsup_tx_confirmed); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 834 | |
| 835 | btw("Subscriber has the IMEISV from the ID Response"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 836 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 837 | OSMO_ASSERT(vsub); |
| 838 | VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 839 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 840 | |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 841 | btw("HLR accepts the IMEI, VLR responds with LU Request"); |
| 842 | expect_bssap_clear(); |
| 843 | gsup_rx("32010809710000004026f0510100" HLR_TO_VLR, |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 844 | "04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 845 | OSMO_ASSERT(gsup_tx_confirmed); |
| 846 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 847 | |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 848 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 849 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 850 | "12010809710000004026f0" VLR_TO_HLR); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 851 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 852 | |
| 853 | btw("having received subscriber data does not mean acceptance"); |
| 854 | EXPECT_ACCEPTED(false); |
| 855 | thwart_rx_non_initial_requests(); |
| 856 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 857 | |
Oliver Smith | cbf2c93 | 2019-05-06 13:09:55 +0200 | [diff] [blame] | 858 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 859 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 860 | |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 861 | btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl"); |
| 862 | EXPECT_CONN_COUNT(1); |
| 863 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 864 | EXPECT_ACCEPTED(false); |
| 865 | thwart_rx_non_initial_requests(); |
| 866 | |
| 867 | btw("MS sends TMSI Realloc Complete"); |
| 868 | expect_bssap_clear(); |
| 869 | ms_sends_msg("055b"); |
| 870 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 871 | |
| 872 | btw("LU was successful, and the conn has already been closed"); |
| 873 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 874 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 875 | EXPECT_CONN_COUNT(0); |
| 876 | |
| 877 | btw("Subscriber has the IMEISV, IMEI and TMSI"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 878 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 879 | OSMO_ASSERT(vsub); |
| 880 | VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d"); |
Oliver Smith | d103705 | 2019-05-02 13:39:26 +0200 | [diff] [blame] | 881 | VERBOSE_ASSERT(strcmp(vsub->imei, "42342342342342"), == 0, "%d"); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 882 | VERBOSE_ASSERT(vsub->tmsi, == 0x03020100, "0x%08x"); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 883 | vlr_subscr_put(vsub, __func__); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 884 | |
| 885 | BTW("subscriber detaches"); |
| 886 | expect_bssap_clear(); |
| 887 | ms_sends_msg("050130089910070000006402"); |
| 888 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 889 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 890 | ran_sends_clear_complete(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 891 | EXPECT_CONN_COUNT(0); |
| 892 | clear_vlr(); |
Neels Hofmeyr | dfdc61d | 2018-03-02 00:40:58 +0100 | [diff] [blame] | 893 | comment_end(); |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 894 | } |
| 895 | |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 896 | static void test_no_authen_subscr_expire() |
| 897 | { |
| 898 | struct vlr_subscr *vsub; |
| 899 | const char *imsi = "901700000004620"; |
| 900 | |
| 901 | /* No auth only works on GERAN */ |
Neels Hofmeyr | 7814a83 | 2018-12-26 00:40:18 +0100 | [diff] [blame] | 902 | rx_from_ran = OSMO_RAT_GERAN_A; |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 903 | |
| 904 | comment_start(); |
| 905 | |
| 906 | fake_time_start(); |
| 907 | |
| 908 | /* The test framework has already started the VLR before fake time was active. |
| 909 | * Manually schedule this timeout in fake time. */ |
| 910 | osmo_timer_del(&net->vlr->lu_expire_timer); |
| 911 | osmo_timer_schedule(&net->vlr->lu_expire_timer, VLR_SUBSCRIBER_LU_EXPIRATION_INTERVAL, 0); |
| 912 | |
| 913 | /* Let the LU expiration timer tick once */ |
| 914 | fake_time_passes(VLR_SUBSCRIBER_LU_EXPIRATION_INTERVAL + 1, 0); |
| 915 | |
| 916 | btw("Location Update request causes a GSUP LU request to HLR"); |
| 917 | lu_result_sent = RES_NONE; |
Neels Hofmeyr | 63b2464 | 2019-12-12 01:31:04 +0100 | [diff] [blame] | 918 | gsup_expect_tx("04010809710000004026f0" CN_DOMAIN VLR_TO_HLR); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 919 | ms_sends_msg("050802008168000130089910070000006402"); |
| 920 | OSMO_ASSERT(gsup_tx_confirmed); |
| 921 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 922 | |
| 923 | btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT"); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 924 | gsup_rx("10010809710000004026f00804036470f1" HLR_TO_VLR, |
| 925 | "12010809710000004026f0" VLR_TO_HLR); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 926 | VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); |
| 927 | |
| 928 | btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT"); |
| 929 | expect_bssap_clear(); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 930 | gsup_rx("06010809710000004026f0" HLR_TO_VLR, NULL); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 931 | |
| 932 | btw("LU was successful, and the conn has already been closed"); |
| 933 | VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d"); |
| 934 | VERBOSE_ASSERT(bssap_clear_sent, == true, "%d"); |
| 935 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 936 | ran_sends_clear_complete(); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 937 | EXPECT_CONN_COUNT(0); |
| 938 | |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 939 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 940 | OSMO_ASSERT(vsub); |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 941 | vlr_subscr_put(vsub, __func__); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 942 | |
| 943 | /* Let T3212 (periodic Location update timer) expire */ |
Vadim Yanitskiy | fc2b019 | 2020-01-18 07:20:14 +0700 | [diff] [blame] | 944 | fake_time_passes(vlr_timer(net->vlr, 3212) + 60 * 4, 0); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 945 | |
| 946 | /* The subscriber should now be gone. */ |
Neels Hofmeyr | 7c5346c | 2019-02-19 02:36:35 +0100 | [diff] [blame] | 947 | vsub = vlr_subscr_find_by_imsi(net->vlr, imsi, __func__); |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 948 | OSMO_ASSERT(vsub == NULL); |
| 949 | |
| 950 | EXPECT_CONN_COUNT(0); |
| 951 | clear_vlr(); |
| 952 | comment_end(); |
| 953 | } |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 954 | |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 955 | msc_vlr_test_func_t msc_vlr_tests[] = { |
| 956 | test_no_authen, |
| 957 | test_no_authen_tmsi, |
| 958 | test_no_authen_imei, |
| 959 | test_no_authen_tmsi_imei, |
Neels Hofmeyr | 34d33bd | 2017-07-20 02:56:21 +0200 | [diff] [blame] | 960 | test_no_authen_imeisv, |
| 961 | test_no_authen_imeisv_imei, |
| 962 | test_no_authen_imeisv_tmsi, |
| 963 | test_no_authen_imeisv_tmsi_imei, |
Stefan Sperling | defc3c8 | 2018-05-15 14:48:04 +0200 | [diff] [blame] | 964 | test_no_authen_subscr_expire, |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 965 | NULL |
| 966 | }; |