Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 1 | /* MS subscriber data handling */ |
| 2 | |
| 3 | /* (C) 2014 by sysmocom s.f.m.c. GmbH |
Holger Hans Peter Freyther | 9ba273d | 2015-04-23 09:53:53 -0400 | [diff] [blame] | 4 | * (C) 2015 by Holger Hans Peter Freyther |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU Affero General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU Affero General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Affero General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | * |
| 21 | */ |
| 22 | |
Harald Welte | 53373bc | 2016-04-20 17:11:43 +0200 | [diff] [blame] | 23 | #include <osmocom/gsm/protocol/gsm_04_08_gprs.h> |
Harald Welte | 23d77d5 | 2016-04-25 19:07:34 +0200 | [diff] [blame] | 24 | #include <osmocom/gsm/gsup.h> |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 25 | #include <openbsc/gsm_subscriber.h> |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 26 | #include <openbsc/gprs_gsup_client.h> |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 27 | |
| 28 | #include <openbsc/sgsn.h> |
| 29 | #include <openbsc/gprs_sgsn.h> |
| 30 | #include <openbsc/gprs_gmm.h> |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 31 | #include <openbsc/gprs_utils.h> |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 32 | |
| 33 | #include <openbsc/debug.h> |
| 34 | |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 35 | #include <netinet/in.h> |
| 36 | #include <arpa/inet.h> |
| 37 | |
Jacob Erlbeck | 743dec4 | 2015-01-08 15:18:39 +0100 | [diff] [blame] | 38 | #define SGSN_SUBSCR_MAX_RETRIES 3 |
| 39 | #define SGSN_SUBSCR_RETRY_INTERVAL 10 |
| 40 | |
Jacob Erlbeck | 929acdf | 2015-01-27 13:47:24 +0100 | [diff] [blame] | 41 | #define LOGGSUPP(level, gsup, fmt, args...) \ |
| 42 | LOGP(DGPRS, level, "GSUP(%s) " fmt, \ |
| 43 | (gsup)->imsi, \ |
| 44 | ## args) |
| 45 | |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 46 | extern void *tall_bsc_ctx; |
| 47 | |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 48 | static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg); |
| 49 | |
| 50 | /* TODO: Some functions are specific to the SGSN, but this file is more general |
| 51 | * (it has gprs_* name). Either move these functions elsewhere, split them and |
| 52 | * move a part, or replace the gprs_ prefix by sgsn_. The applies to |
| 53 | * gprs_subscr_init, gsup_read_cb, and gprs_subscr_tx_gsup_message. |
| 54 | */ |
| 55 | |
| 56 | int gprs_subscr_init(struct sgsn_instance *sgi) |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 57 | { |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 58 | const char *addr_str; |
| 59 | |
| 60 | if (!sgi->cfg.gsup_server_addr.sin_addr.s_addr) |
| 61 | return 0; |
| 62 | |
| 63 | addr_str = inet_ntoa(sgi->cfg.gsup_server_addr.sin_addr); |
| 64 | |
| 65 | sgi->gsup_client = gprs_gsup_client_create( |
| 66 | addr_str, sgi->cfg.gsup_server_port, |
Neels Hofmeyr | 9c534fd | 2015-10-12 11:57:37 +0200 | [diff] [blame] | 67 | &gsup_read_cb, |
| 68 | &sgi->cfg.oap); |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 69 | |
| 70 | if (!sgi->gsup_client) |
| 71 | return -1; |
| 72 | |
| 73 | return 1; |
| 74 | } |
| 75 | |
| 76 | static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg) |
| 77 | { |
| 78 | int rc; |
| 79 | |
| 80 | rc = gprs_subscr_rx_gsup_message(msg); |
Jacob Erlbeck | e154d8b | 2014-12-19 19:15:55 +0100 | [diff] [blame] | 81 | msgb_free(msg); |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 82 | if (rc < 0) |
| 83 | return -1; |
| 84 | |
| 85 | return rc; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 86 | } |
| 87 | |
Jacob Erlbeck | 0f47b8f | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 88 | int gprs_subscr_purge(struct gsm_subscriber *subscr); |
| 89 | |
Jacob Erlbeck | a1e0373 | 2014-12-02 11:28:38 +0100 | [diff] [blame] | 90 | static struct sgsn_subscriber_data *sgsn_subscriber_data_alloc(void *ctx) |
| 91 | { |
| 92 | struct sgsn_subscriber_data *sdata; |
Jacob Erlbeck | 7921ab1 | 2014-12-08 15:52:00 +0100 | [diff] [blame] | 93 | int idx; |
Jacob Erlbeck | a1e0373 | 2014-12-02 11:28:38 +0100 | [diff] [blame] | 94 | |
| 95 | sdata = talloc_zero(ctx, struct sgsn_subscriber_data); |
| 96 | |
Jacob Erlbeck | d6267d1 | 2015-01-19 11:10:04 +0100 | [diff] [blame] | 97 | sdata->error_cause = SGSN_ERROR_CAUSE_NONE; |
| 98 | |
Jacob Erlbeck | 7921ab1 | 2014-12-08 15:52:00 +0100 | [diff] [blame] | 99 | for (idx = 0; idx < ARRAY_SIZE(sdata->auth_triplets); idx++) |
| 100 | sdata->auth_triplets[idx].key_seq = GSM_KEY_SEQ_INVAL; |
| 101 | |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 102 | INIT_LLIST_HEAD(&sdata->pdp_list); |
| 103 | |
Jacob Erlbeck | a1e0373 | 2014-12-02 11:28:38 +0100 | [diff] [blame] | 104 | return sdata; |
| 105 | } |
| 106 | |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 107 | struct sgsn_subscriber_pdp_data* sgsn_subscriber_pdp_data_alloc( |
| 108 | struct sgsn_subscriber_data *sdata) |
| 109 | { |
| 110 | struct sgsn_subscriber_pdp_data* pdata; |
| 111 | |
| 112 | pdata = talloc_zero(sdata, struct sgsn_subscriber_pdp_data); |
| 113 | |
| 114 | llist_add_tail(&pdata->list, &sdata->pdp_list); |
| 115 | |
| 116 | return pdata; |
| 117 | } |
| 118 | |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 119 | struct gsm_subscriber *gprs_subscr_get_or_create(const char *imsi) |
| 120 | { |
| 121 | struct gsm_subscriber *subscr; |
| 122 | |
| 123 | subscr = subscr_get_or_create(NULL, imsi); |
| 124 | if (!subscr) |
| 125 | return NULL; |
| 126 | |
Jacob Erlbeck | a1e0373 | 2014-12-02 11:28:38 +0100 | [diff] [blame] | 127 | if (!subscr->sgsn_data) |
| 128 | subscr->sgsn_data = sgsn_subscriber_data_alloc(subscr); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 129 | return subscr; |
| 130 | } |
| 131 | |
| 132 | struct gsm_subscriber *gprs_subscr_get_by_imsi(const char *imsi) |
| 133 | { |
| 134 | return subscr_active_by_imsi(NULL, imsi); |
| 135 | } |
| 136 | |
Jacob Erlbeck | 3e4e58f | 2015-01-26 11:07:24 +0100 | [diff] [blame] | 137 | void gprs_subscr_cleanup(struct gsm_subscriber *subscr) |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 138 | { |
Jacob Erlbeck | a1e0373 | 2014-12-02 11:28:38 +0100 | [diff] [blame] | 139 | if (subscr->sgsn_data->mm) { |
| 140 | subscr_put(subscr->sgsn_data->mm->subscr); |
| 141 | subscr->sgsn_data->mm->subscr = NULL; |
| 142 | subscr->sgsn_data->mm = NULL; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 143 | } |
| 144 | |
Holger Hans Peter Freyther | 1d778fd | 2015-01-20 21:14:03 +0100 | [diff] [blame] | 145 | if (subscr->flags & GPRS_SUBSCRIBER_ENABLE_PURGE) { |
| 146 | gprs_subscr_purge(subscr); |
| 147 | subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE; |
Jacob Erlbeck | 0f47b8f | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 148 | } |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 149 | } |
| 150 | |
Jacob Erlbeck | 37139e5 | 2015-01-23 13:52:55 +0100 | [diff] [blame] | 151 | void gprs_subscr_cancel(struct gsm_subscriber *subscr) |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 152 | { |
| 153 | subscr->authorized = 0; |
| 154 | subscr->flags |= GPRS_SUBSCRIBER_CANCELLED; |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 155 | subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 156 | |
| 157 | gprs_subscr_update(subscr); |
Jacob Erlbeck | 3e4e58f | 2015-01-26 11:07:24 +0100 | [diff] [blame] | 158 | gprs_subscr_cleanup(subscr); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 159 | } |
| 160 | |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 161 | static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 162 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 163 | { |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 164 | struct msgb *msg = gprs_gsup_msgb_alloc(); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 165 | |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 166 | if (strlen(gsup_msg->imsi) == 0 && subscr) |
| 167 | strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 168 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 169 | osmo_gsup_encode(msg, gsup_msg); |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 170 | |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 171 | LOGGSUBSCRP(LOGL_INFO, subscr, |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 172 | "Sending GSUP, will send: %s\n", msgb_hexdump(msg)); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 173 | |
Jacob Erlbeck | 39f040d | 2014-12-18 12:46:47 +0100 | [diff] [blame] | 174 | if (!sgsn->gsup_client) { |
| 175 | msgb_free(msg); |
| 176 | return -ENOTSUP; |
| 177 | } |
| 178 | |
| 179 | return gprs_gsup_client_send(sgsn->gsup_client, msg); |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 180 | } |
| 181 | |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 182 | static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 183 | struct osmo_gsup_message *gsup_orig, |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 184 | enum gsm48_gmm_cause cause) |
| 185 | { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 186 | struct osmo_gsup_message gsup_reply = {0}; |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 187 | |
| 188 | strncpy(gsup_reply.imsi, gsup_orig->imsi, sizeof(gsup_reply.imsi) - 1); |
| 189 | gsup_reply.cause = cause; |
| 190 | gsup_reply.message_type = |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 191 | OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type); |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 192 | |
| 193 | return gprs_subscr_tx_gsup_message(subscr, &gsup_reply); |
| 194 | } |
| 195 | |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 196 | static int gprs_subscr_handle_gsup_auth_res(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 197 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 198 | { |
| 199 | unsigned idx; |
| 200 | struct sgsn_subscriber_data *sdata = subscr->sgsn_data; |
| 201 | |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 202 | LOGGSUBSCRP(LOGL_INFO, subscr, |
Harald Welte | 121e9a4 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 203 | "Got SendAuthenticationInfoResult, num_auth_vectors = %zu\n", |
| 204 | gsup_msg->num_auth_vectors); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 205 | |
Harald Welte | 121e9a4 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 206 | if (gsup_msg->num_auth_vectors > 0) { |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 207 | memset(sdata->auth_triplets, 0, sizeof(sdata->auth_triplets)); |
| 208 | |
| 209 | for (idx = 0; idx < ARRAY_SIZE(sdata->auth_triplets); idx++) |
| 210 | sdata->auth_triplets[idx].key_seq = GSM_KEY_SEQ_INVAL; |
| 211 | } |
| 212 | |
Harald Welte | 121e9a4 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 213 | for (idx = 0; idx < gsup_msg->num_auth_vectors; idx++) { |
| 214 | size_t key_seq = idx; |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 215 | LOGGSUBSCRP(LOGL_DEBUG, subscr, |
Holger Hans Peter Freyther | 8e6ecc9 | 2015-04-23 11:55:23 -0400 | [diff] [blame] | 216 | "Adding auth tuple, cksn = %zu\n", key_seq); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 217 | if (key_seq >= ARRAY_SIZE(sdata->auth_triplets)) { |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 218 | LOGGSUBSCRP(LOGL_NOTICE, subscr, |
Holger Hans Peter Freyther | 8e6ecc9 | 2015-04-23 11:55:23 -0400 | [diff] [blame] | 219 | "Skipping auth triplet with invalid cksn %zu\n", |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 220 | key_seq); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 221 | continue; |
| 222 | } |
Harald Welte | 121e9a4 | 2016-04-20 13:13:19 +0200 | [diff] [blame] | 223 | sdata->auth_triplets[key_seq].vec = gsup_msg->auth_vectors[idx]; |
| 224 | sdata->auth_triplets[key_seq].key_seq = key_seq; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | sdata->auth_triplets_updated = 1; |
Jacob Erlbeck | d6267d1 | 2015-01-19 11:10:04 +0100 | [diff] [blame] | 228 | sdata->error_cause = SGSN_ERROR_CAUSE_NONE; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 229 | |
| 230 | gprs_subscr_update_auth_info(subscr); |
| 231 | |
| 232 | return 0; |
| 233 | } |
| 234 | |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 235 | static int gprs_subscr_pdp_data_clear(struct gsm_subscriber *subscr) |
| 236 | { |
| 237 | struct sgsn_subscriber_pdp_data *pdp, *pdp2; |
| 238 | int count = 0; |
| 239 | |
| 240 | llist_for_each_entry_safe(pdp, pdp2, &subscr->sgsn_data->pdp_list, list) { |
| 241 | llist_del(&pdp->list); |
| 242 | talloc_free(pdp); |
| 243 | count += 1; |
| 244 | } |
| 245 | |
| 246 | return count; |
| 247 | } |
| 248 | |
| 249 | static struct sgsn_subscriber_pdp_data *gprs_subscr_pdp_data_get_by_id( |
| 250 | struct gsm_subscriber *subscr, unsigned context_id) |
| 251 | { |
| 252 | struct sgsn_subscriber_pdp_data *pdp; |
| 253 | |
| 254 | llist_for_each_entry(pdp, &subscr->sgsn_data->pdp_list, list) { |
| 255 | if (pdp->context_id == context_id) |
| 256 | return pdp; |
| 257 | } |
| 258 | |
| 259 | return NULL; |
| 260 | } |
| 261 | |
| 262 | |
| 263 | static void gprs_subscr_gsup_insert_data(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 264 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 265 | { |
Holger Hans Peter Freyther | 9ba273d | 2015-04-23 09:53:53 -0400 | [diff] [blame] | 266 | struct sgsn_subscriber_data *sdata = subscr->sgsn_data; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 267 | unsigned idx; |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 268 | int rc; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 269 | |
Holger Hans Peter Freyther | 9ba273d | 2015-04-23 09:53:53 -0400 | [diff] [blame] | 270 | if (gsup_msg->msisdn_enc) { |
| 271 | if (gsup_msg->msisdn_enc_len > sizeof(sdata->msisdn)) { |
| 272 | LOGP(DGPRS, LOGL_ERROR, "MSISDN too long (%zu)\n", |
| 273 | gsup_msg->msisdn_enc_len); |
| 274 | sdata->msisdn_len = 0; |
| 275 | } else { |
| 276 | memcpy(sdata->msisdn, gsup_msg->msisdn_enc, |
| 277 | gsup_msg->msisdn_enc_len); |
| 278 | sdata->msisdn_len = gsup_msg->msisdn_enc_len; |
| 279 | } |
| 280 | } |
| 281 | |
Holger Hans Peter Freyther | 10c0f56 | 2015-05-17 20:58:40 +0200 | [diff] [blame] | 282 | if (gsup_msg->hlr_enc) { |
| 283 | if (gsup_msg->hlr_enc_len > sizeof(sdata->hlr)) { |
| 284 | LOGP(DGPRS, LOGL_ERROR, "HLR-Number too long (%zu)\n", |
| 285 | gsup_msg->hlr_enc_len); |
| 286 | sdata->hlr_len = 0; |
| 287 | } else { |
| 288 | memcpy(sdata->hlr, gsup_msg->hlr_enc, |
| 289 | gsup_msg->hlr_enc_len); |
| 290 | sdata->hlr_len = gsup_msg->hlr_enc_len; |
| 291 | } |
| 292 | } |
| 293 | |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 294 | if (gsup_msg->pdp_info_compl) { |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 295 | rc = gprs_subscr_pdp_data_clear(subscr); |
| 296 | if (rc > 0) |
| 297 | LOGP(DGPRS, LOGL_INFO, "Cleared existing PDP info\n"); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | for (idx = 0; idx < gsup_msg->num_pdp_infos; idx++) { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 301 | struct osmo_gsup_pdp_info *pdp_info = &gsup_msg->pdp_infos[idx]; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 302 | size_t ctx_id = pdp_info->context_id; |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 303 | struct sgsn_subscriber_pdp_data *pdp_data; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 304 | |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 305 | if (pdp_info->apn_enc_len >= sizeof(pdp_data->apn_str)-1) { |
| 306 | LOGGSUBSCRP(LOGL_ERROR, subscr, |
Holger Hans Peter Freyther | 8e6ecc9 | 2015-04-23 11:55:23 -0400 | [diff] [blame] | 307 | "APN too long, context id = %zu, APN = %s\n", |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 308 | ctx_id, osmo_hexdump(pdp_info->apn_enc, |
| 309 | pdp_info->apn_enc_len)); |
| 310 | continue; |
| 311 | } |
| 312 | |
Holger Hans Peter Freyther | 8cedded | 2015-04-23 11:33:35 -0400 | [diff] [blame] | 313 | if (pdp_info->qos_enc_len > sizeof(pdp_data->qos_subscribed)) { |
| 314 | LOGGSUBSCRP(LOGL_ERROR, subscr, |
| 315 | "QoS info too long (%zu)\n", |
| 316 | pdp_info->qos_enc_len); |
| 317 | continue; |
| 318 | } |
| 319 | |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 320 | LOGGSUBSCRP(LOGL_INFO, subscr, |
Holger Hans Peter Freyther | 8e6ecc9 | 2015-04-23 11:55:23 -0400 | [diff] [blame] | 321 | "Will set PDP info, context id = %zu, APN = %s\n", |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 322 | ctx_id, osmo_hexdump(pdp_info->apn_enc, pdp_info->apn_enc_len)); |
| 323 | |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 324 | /* Set PDP info [ctx_id] */ |
| 325 | pdp_data = gprs_subscr_pdp_data_get_by_id(subscr, ctx_id); |
| 326 | if (!pdp_data) { |
| 327 | pdp_data = sgsn_subscriber_pdp_data_alloc(subscr->sgsn_data); |
| 328 | pdp_data->context_id = ctx_id; |
| 329 | } |
| 330 | |
| 331 | OSMO_ASSERT(pdp_data != NULL); |
| 332 | pdp_data->pdp_type = pdp_info->pdp_type; |
| 333 | gprs_apn_to_str(pdp_data->apn_str, |
| 334 | pdp_info->apn_enc, pdp_info->apn_enc_len); |
Holger Hans Peter Freyther | 8cedded | 2015-04-23 11:33:35 -0400 | [diff] [blame] | 335 | memcpy(pdp_data->qos_subscribed, pdp_info->qos_enc, pdp_info->qos_enc_len); |
| 336 | pdp_data->qos_subscribed_len = pdp_info->qos_enc_len; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 337 | } |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | static int gprs_subscr_handle_gsup_upd_loc_res(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 341 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | 0e8add6 | 2014-12-17 14:03:35 +0100 | [diff] [blame] | 342 | { |
| 343 | gprs_subscr_gsup_insert_data(subscr, gsup_msg); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 344 | |
| 345 | subscr->authorized = 1; |
Jacob Erlbeck | d6267d1 | 2015-01-19 11:10:04 +0100 | [diff] [blame] | 346 | subscr->sgsn_data->error_cause = SGSN_ERROR_CAUSE_NONE; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 347 | |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 348 | subscr->flags |= GPRS_SUBSCRIBER_ENABLE_PURGE; |
| 349 | |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 350 | gprs_subscr_update(subscr); |
| 351 | return 0; |
| 352 | } |
| 353 | |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 354 | static int check_cause(int cause) |
| 355 | { |
| 356 | switch (cause) { |
| 357 | case GMM_CAUSE_IMSI_UNKNOWN ... GMM_CAUSE_ILLEGAL_ME: |
| 358 | case GMM_CAUSE_GPRS_NOTALLOWED ... GMM_CAUSE_NO_GPRS_PLMN: |
| 359 | return EACCES; |
| 360 | |
| 361 | case GMM_CAUSE_MSC_TEMP_NOTREACH ... GMM_CAUSE_CONGESTION: |
Jacob Erlbeck | f06fe29 | 2015-01-05 16:20:47 +0100 | [diff] [blame] | 362 | return EHOSTUNREACH; |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 363 | |
| 364 | case GMM_CAUSE_SEM_INCORR_MSG ... GMM_CAUSE_PROTO_ERR_UNSPEC: |
| 365 | default: |
| 366 | return EINVAL; |
| 367 | } |
| 368 | } |
| 369 | |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 370 | static int gprs_subscr_handle_gsup_auth_err(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 371 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 372 | { |
| 373 | unsigned idx; |
| 374 | struct sgsn_subscriber_data *sdata = subscr->sgsn_data; |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 375 | int cause_err; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 376 | |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 377 | cause_err = check_cause(gsup_msg->cause); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 378 | |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 379 | LOGGSUBSCRP(LOGL_DEBUG, subscr, |
| 380 | "Send authentication info has failed with cause %d, " |
| 381 | "handled as: %s\n", |
| 382 | gsup_msg->cause, strerror(cause_err)); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 383 | |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 384 | switch (cause_err) { |
| 385 | case EACCES: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 386 | LOGGSUBSCRP(LOGL_NOTICE, subscr, |
| 387 | "GPRS send auth info req failed, access denied, " |
| 388 | "GMM cause = '%s' (%d)\n", |
| 389 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 390 | gsup_msg->cause); |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 391 | /* Clear auth tuples */ |
| 392 | memset(sdata->auth_triplets, 0, sizeof(sdata->auth_triplets)); |
| 393 | for (idx = 0; idx < ARRAY_SIZE(sdata->auth_triplets); idx++) |
| 394 | sdata->auth_triplets[idx].key_seq = GSM_KEY_SEQ_INVAL; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 395 | |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 396 | subscr->authorized = 0; |
| 397 | sdata->error_cause = gsup_msg->cause; |
| 398 | gprs_subscr_update_auth_info(subscr); |
| 399 | break; |
| 400 | |
Jacob Erlbeck | f06fe29 | 2015-01-05 16:20:47 +0100 | [diff] [blame] | 401 | case EHOSTUNREACH: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 402 | LOGGSUBSCRP(LOGL_NOTICE, subscr, |
| 403 | "GPRS send auth info req failed, GMM cause = '%s' (%d)\n", |
| 404 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 405 | gsup_msg->cause); |
Jacob Erlbeck | f06fe29 | 2015-01-05 16:20:47 +0100 | [diff] [blame] | 406 | |
| 407 | sdata->error_cause = gsup_msg->cause; |
| 408 | gprs_subscr_update_auth_info(subscr); |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 409 | break; |
| 410 | |
| 411 | default: |
| 412 | case EINVAL: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 413 | LOGGSUBSCRP(LOGL_ERROR, subscr, |
| 414 | "GSUP protocol remote error, GMM cause = '%s' (%d)\n", |
| 415 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 416 | gsup_msg->cause); |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 417 | break; |
| 418 | } |
| 419 | |
| 420 | return -gsup_msg->cause; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | static int gprs_subscr_handle_gsup_upd_loc_err(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 424 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 425 | { |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 426 | int cause_err; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 427 | |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 428 | cause_err = check_cause(gsup_msg->cause); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 429 | |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 430 | LOGGSUBSCRP(LOGL_DEBUG, subscr, |
| 431 | "Update location has failed with cause %d, handled as: %s\n", |
| 432 | gsup_msg->cause, strerror(cause_err)); |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 433 | |
| 434 | switch (cause_err) { |
| 435 | case EACCES: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 436 | LOGGSUBSCRP(LOGL_NOTICE, subscr, |
| 437 | "GPRS update location failed, access denied, " |
| 438 | "GMM cause = '%s' (%d)\n", |
| 439 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 440 | gsup_msg->cause); |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 441 | |
| 442 | subscr->authorized = 0; |
| 443 | subscr->sgsn_data->error_cause = gsup_msg->cause; |
| 444 | gprs_subscr_update_auth_info(subscr); |
| 445 | break; |
| 446 | |
Jacob Erlbeck | f06fe29 | 2015-01-05 16:20:47 +0100 | [diff] [blame] | 447 | case EHOSTUNREACH: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 448 | LOGGSUBSCRP(LOGL_NOTICE, subscr, |
| 449 | "GPRS update location failed, GMM cause = '%s' (%d)\n", |
| 450 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 451 | gsup_msg->cause); |
Jacob Erlbeck | f06fe29 | 2015-01-05 16:20:47 +0100 | [diff] [blame] | 452 | |
| 453 | subscr->sgsn_data->error_cause = gsup_msg->cause; |
| 454 | gprs_subscr_update_auth_info(subscr); |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 455 | break; |
| 456 | |
| 457 | default: |
| 458 | case EINVAL: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 459 | LOGGSUBSCRP(LOGL_ERROR, subscr, |
| 460 | "GSUP protocol remote error, GMM cause = '%s' (%d)\n", |
| 461 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 462 | gsup_msg->cause); |
Jacob Erlbeck | 9aa9991 | 2015-01-05 18:38:41 +0100 | [diff] [blame] | 463 | break; |
| 464 | } |
| 465 | |
| 466 | return -gsup_msg->cause; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 467 | } |
| 468 | |
Jacob Erlbeck | 929acdf | 2015-01-27 13:47:24 +0100 | [diff] [blame] | 469 | static int gprs_subscr_handle_gsup_purge_no_subscr( |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 470 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | 929acdf | 2015-01-27 13:47:24 +0100 | [diff] [blame] | 471 | { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 472 | if (OSMO_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) { |
Jacob Erlbeck | 929acdf | 2015-01-27 13:47:24 +0100 | [diff] [blame] | 473 | LOGGSUPP(LOGL_NOTICE, gsup_msg, |
| 474 | "Purge MS has failed with cause '%s' (%d)\n", |
| 475 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 476 | gsup_msg->cause); |
| 477 | return -gsup_msg->cause; |
| 478 | } |
| 479 | |
| 480 | LOGGSUPP(LOGL_INFO, gsup_msg, "Completing purge MS\n"); |
| 481 | return 0; |
| 482 | } |
| 483 | |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 484 | static int gprs_subscr_handle_gsup_purge_res(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 485 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 486 | { |
| 487 | LOGGSUBSCRP(LOGL_INFO, subscr, "Completing purge MS\n"); |
| 488 | |
| 489 | /* Force silent cancellation */ |
Jacob Erlbeck | d6267d1 | 2015-01-19 11:10:04 +0100 | [diff] [blame] | 490 | subscr->sgsn_data->error_cause = SGSN_ERROR_CAUSE_NONE; |
Jacob Erlbeck | 37139e5 | 2015-01-23 13:52:55 +0100 | [diff] [blame] | 491 | gprs_subscr_cancel(subscr); |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 492 | |
| 493 | return 0; |
| 494 | } |
| 495 | |
| 496 | static int gprs_subscr_handle_gsup_purge_err(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 497 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 498 | { |
| 499 | LOGGSUBSCRP(LOGL_NOTICE, subscr, |
| 500 | "Purge MS has failed with cause '%s' (%d)\n", |
| 501 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 502 | gsup_msg->cause); |
| 503 | |
| 504 | /* In GSM 09.02, 19.1.4.4, the text and the SDL diagram imply that |
| 505 | * the subscriber data is not removed if the request has failed. On the |
| 506 | * other hand, keeping the subscriber data in either error case |
| 507 | * (subscriber unknown, syntactical message error, connection error) |
| 508 | * doesn't seem to give any advantage, since the data will be restored |
| 509 | * on the next Attach Request anyway. |
| 510 | * This approach ensures, that the subscriber record will not stick if |
| 511 | * an error happens. |
| 512 | */ |
| 513 | |
| 514 | /* TODO: Check whether this behaviour is acceptable and either just |
| 515 | * remove this TODO-notice or change the implementation to not delete |
| 516 | * the subscriber data (eventually resetting the ENABLE_PURGE flag and |
| 517 | * restarting the expiry timer based on the cause). |
| 518 | * |
| 519 | * Subscriber Unknown: cancel subscr |
| 520 | * Temporary network problems: do nothing (handled by timer based retry) |
| 521 | * Message problems (syntax, nyi, ...): cancel subscr (retry won't help) |
| 522 | */ |
| 523 | |
| 524 | gprs_subscr_handle_gsup_purge_res(subscr, gsup_msg); |
| 525 | |
| 526 | return -gsup_msg->cause; |
| 527 | } |
| 528 | |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 529 | static int gprs_subscr_handle_loc_cancel_req(struct gsm_subscriber *subscr, |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 530 | struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 531 | { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 532 | struct osmo_gsup_message gsup_reply = {0}; |
Jacob Erlbeck | 5b51205 | 2015-04-07 17:49:48 +0200 | [diff] [blame] | 533 | int is_update_procedure = !gsup_msg->cancel_type || |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 534 | gsup_msg->cancel_type == OSMO_GSUP_CANCEL_TYPE_UPDATE; |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 535 | |
Jacob Erlbeck | 8000e0e | 2015-01-27 14:56:40 +0100 | [diff] [blame] | 536 | LOGGSUBSCRP(LOGL_INFO, subscr, "Cancelling MS subscriber (%s)\n", |
| 537 | is_update_procedure ? |
| 538 | "update procedure" : "subscription withdraw"); |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 539 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 540 | gsup_reply.message_type = OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT; |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 541 | gprs_subscr_tx_gsup_message(subscr, &gsup_reply); |
| 542 | |
Jacob Erlbeck | 8000e0e | 2015-01-27 14:56:40 +0100 | [diff] [blame] | 543 | if (is_update_procedure) |
| 544 | subscr->sgsn_data->error_cause = SGSN_ERROR_CAUSE_NONE; |
| 545 | else |
| 546 | /* Since a withdraw cause is not specified, just abort the |
| 547 | * current attachment. The following re-attachment should then |
| 548 | * be rejected with a proper cause value. |
| 549 | */ |
| 550 | subscr->sgsn_data->error_cause = GMM_CAUSE_IMPL_DETACHED; |
| 551 | |
Jacob Erlbeck | 37139e5 | 2015-01-23 13:52:55 +0100 | [diff] [blame] | 552 | gprs_subscr_cancel(subscr); |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 553 | |
| 554 | return 0; |
| 555 | } |
| 556 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 557 | static int gprs_subscr_handle_unknown_imsi(struct osmo_gsup_message *gsup_msg) |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 558 | { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 559 | if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg->message_type)) { |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 560 | gprs_subscr_tx_gsup_error_reply(NULL, gsup_msg, |
| 561 | GMM_CAUSE_IMSI_UNKNOWN); |
| 562 | LOGP(DGPRS, LOGL_NOTICE, |
| 563 | "Unknown IMSI %s, discarding GSUP request " |
| 564 | "of type 0x%02x\n", |
| 565 | gsup_msg->imsi, gsup_msg->message_type); |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 566 | } else if (OSMO_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) { |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 567 | LOGP(DGPRS, LOGL_NOTICE, |
| 568 | "Unknown IMSI %s, discarding GSUP error " |
| 569 | "of type 0x%02x, cause '%s' (%d)\n", |
| 570 | gsup_msg->imsi, gsup_msg->message_type, |
| 571 | get_value_string(gsm48_gmm_cause_names, gsup_msg->cause), |
| 572 | gsup_msg->cause); |
| 573 | } else { |
| 574 | LOGP(DGPRS, LOGL_NOTICE, |
| 575 | "Unknown IMSI %s, discarding GSUP response " |
| 576 | "of type 0x%02x\n", |
| 577 | gsup_msg->imsi, gsup_msg->message_type); |
| 578 | } |
| 579 | |
| 580 | return -GMM_CAUSE_IMSI_UNKNOWN; |
| 581 | } |
| 582 | |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 583 | int gprs_subscr_rx_gsup_message(struct msgb *msg) |
| 584 | { |
| 585 | uint8_t *data = msgb_l2(msg); |
| 586 | size_t data_len = msgb_l2len(msg); |
| 587 | int rc = 0; |
| 588 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 589 | struct osmo_gsup_message gsup_msg = {0}; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 590 | struct gsm_subscriber *subscr; |
| 591 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 592 | rc = osmo_gsup_decode(data, data_len, &gsup_msg); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 593 | if (rc < 0) { |
| 594 | LOGP(DGPRS, LOGL_ERROR, |
Jacob Erlbeck | bce2061 | 2015-01-05 18:57:32 +0100 | [diff] [blame] | 595 | "decoding GSUP message fails with error '%s' (%d)\n", |
| 596 | get_value_string(gsm48_gmm_cause_names, -rc), -rc); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 597 | return rc; |
| 598 | } |
| 599 | |
Jacob Erlbeck | 07f6e36 | 2015-01-29 14:00:28 +0100 | [diff] [blame] | 600 | if (!gsup_msg.imsi[0]) { |
| 601 | LOGP(DGPRS, LOGL_ERROR, "Missing IMSI in GSUP message\n"); |
| 602 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 603 | if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type)) |
Jacob Erlbeck | 07f6e36 | 2015-01-29 14:00:28 +0100 | [diff] [blame] | 604 | gprs_subscr_tx_gsup_error_reply(NULL, &gsup_msg, |
| 605 | GMM_CAUSE_INV_MAND_INFO); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 606 | return -GMM_CAUSE_INV_MAND_INFO; |
Jacob Erlbeck | 07f6e36 | 2015-01-29 14:00:28 +0100 | [diff] [blame] | 607 | } |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 608 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 609 | if (!gsup_msg.cause && OSMO_GSUP_IS_MSGT_ERROR(gsup_msg.message_type)) |
Jacob Erlbeck | 9ff8289 | 2015-01-29 14:17:51 +0100 | [diff] [blame] | 610 | gsup_msg.cause = GMM_CAUSE_NET_FAIL; |
| 611 | |
Jacob Erlbeck | 4dedb27 | 2015-01-15 17:50:16 +0100 | [diff] [blame] | 612 | subscr = gprs_subscr_get_by_imsi(gsup_msg.imsi); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 613 | |
Jacob Erlbeck | 929acdf | 2015-01-27 13:47:24 +0100 | [diff] [blame] | 614 | if (!subscr) { |
| 615 | switch (gsup_msg.message_type) { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 616 | case OSMO_GSUP_MSGT_PURGE_MS_RESULT: |
| 617 | case OSMO_GSUP_MSGT_PURGE_MS_ERROR: |
Jacob Erlbeck | 929acdf | 2015-01-27 13:47:24 +0100 | [diff] [blame] | 618 | return gprs_subscr_handle_gsup_purge_no_subscr(&gsup_msg); |
| 619 | default: |
| 620 | return gprs_subscr_handle_unknown_imsi(&gsup_msg); |
| 621 | } |
| 622 | } |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 623 | |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 624 | LOGGSUBSCRP(LOGL_INFO, subscr, |
| 625 | "Received GSUP message of type 0x%02x\n", gsup_msg.message_type); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 626 | |
| 627 | switch (gsup_msg.message_type) { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 628 | case OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST: |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 629 | rc = gprs_subscr_handle_loc_cancel_req(subscr, &gsup_msg); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 630 | break; |
| 631 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 632 | case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT: |
Jacob Erlbeck | bce2061 | 2015-01-05 18:57:32 +0100 | [diff] [blame] | 633 | rc = gprs_subscr_handle_gsup_auth_res(subscr, &gsup_msg); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 634 | break; |
| 635 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 636 | case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR: |
Jacob Erlbeck | bce2061 | 2015-01-05 18:57:32 +0100 | [diff] [blame] | 637 | rc = gprs_subscr_handle_gsup_auth_err(subscr, &gsup_msg); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 638 | break; |
| 639 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 640 | case OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT: |
Jacob Erlbeck | bce2061 | 2015-01-05 18:57:32 +0100 | [diff] [blame] | 641 | rc = gprs_subscr_handle_gsup_upd_loc_res(subscr, &gsup_msg); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 642 | break; |
| 643 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 644 | case OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR: |
Jacob Erlbeck | bce2061 | 2015-01-05 18:57:32 +0100 | [diff] [blame] | 645 | rc = gprs_subscr_handle_gsup_upd_loc_err(subscr, &gsup_msg); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 646 | break; |
| 647 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 648 | case OSMO_GSUP_MSGT_PURGE_MS_ERROR: |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 649 | rc = gprs_subscr_handle_gsup_purge_err(subscr, &gsup_msg); |
| 650 | break; |
| 651 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 652 | case OSMO_GSUP_MSGT_PURGE_MS_RESULT: |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 653 | rc = gprs_subscr_handle_gsup_purge_res(subscr, &gsup_msg); |
| 654 | break; |
| 655 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 656 | case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST: |
| 657 | case OSMO_GSUP_MSGT_DELETE_DATA_REQUEST: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 658 | LOGGSUBSCRP(LOGL_ERROR, subscr, |
| 659 | "Rx GSUP message type %d not yet implemented\n", |
| 660 | gsup_msg.message_type); |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 661 | gprs_subscr_tx_gsup_error_reply(subscr, &gsup_msg, |
| 662 | GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 663 | rc = -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL; |
| 664 | break; |
| 665 | |
| 666 | default: |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 667 | LOGGSUBSCRP(LOGL_ERROR, subscr, |
| 668 | "Rx GSUP message type %d not valid at SGSN\n", |
| 669 | gsup_msg.message_type); |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 670 | if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type)) |
Jacob Erlbeck | 9999fd9 | 2015-01-15 17:08:30 +0100 | [diff] [blame] | 671 | gprs_subscr_tx_gsup_error_reply( |
| 672 | subscr, &gsup_msg, GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL); |
| 673 | rc = -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 674 | break; |
| 675 | }; |
| 676 | |
Jacob Erlbeck | 87c7ffc | 2015-01-08 15:29:01 +0100 | [diff] [blame] | 677 | subscr_put(subscr); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 678 | |
| 679 | return rc; |
| 680 | } |
| 681 | |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 682 | int gprs_subscr_purge(struct gsm_subscriber *subscr) |
| 683 | { |
Holger Hans Peter Freyther | 10c0f56 | 2015-05-17 20:58:40 +0200 | [diff] [blame] | 684 | struct sgsn_subscriber_data *sdata = subscr->sgsn_data; |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 685 | struct osmo_gsup_message gsup_msg = {0}; |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 686 | |
| 687 | LOGGSUBSCRP(LOGL_INFO, subscr, "purging MS subscriber\n"); |
| 688 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 689 | gsup_msg.message_type = OSMO_GSUP_MSGT_PURGE_MS_REQUEST; |
Holger Hans Peter Freyther | 10c0f56 | 2015-05-17 20:58:40 +0200 | [diff] [blame] | 690 | |
| 691 | /* Provide the HLR number in case it is known */ |
| 692 | gsup_msg.hlr_enc_len = sdata->hlr_len; |
| 693 | gsup_msg.hlr_enc = sdata->hlr; |
| 694 | |
Jacob Erlbeck | ca69b0f | 2015-02-03 19:45:46 +0100 | [diff] [blame] | 695 | return gprs_subscr_tx_gsup_message(subscr, &gsup_msg); |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 696 | } |
| 697 | |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 698 | int gprs_subscr_query_auth_info(struct gsm_subscriber *subscr) |
| 699 | { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 700 | struct osmo_gsup_message gsup_msg = {0}; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 701 | |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 702 | LOGGSUBSCRP(LOGL_INFO, subscr, |
| 703 | "subscriber auth info is not available\n"); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 704 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 705 | gsup_msg.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 706 | return gprs_subscr_tx_gsup_message(subscr, &gsup_msg); |
| 707 | } |
| 708 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 709 | int gprs_subscr_location_update(struct gsm_subscriber *subscr) |
| 710 | { |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 711 | struct osmo_gsup_message gsup_msg = {0}; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 712 | |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 713 | LOGGSUBSCRP(LOGL_INFO, subscr, |
| 714 | "subscriber data is not available\n"); |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 715 | |
Harald Welte | 28903a9 | 2016-04-25 14:53:43 +0200 | [diff] [blame] | 716 | gsup_msg.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST; |
Jacob Erlbeck | a6ddc2d | 2014-12-12 15:01:37 +0100 | [diff] [blame] | 717 | return gprs_subscr_tx_gsup_message(subscr, &gsup_msg); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 718 | } |
| 719 | |
| 720 | void gprs_subscr_update(struct gsm_subscriber *subscr) |
| 721 | { |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 722 | LOGGSUBSCRP(LOGL_DEBUG, subscr, "Updating subscriber data\n"); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 723 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 724 | subscr->flags &= ~GPRS_SUBSCRIBER_UPDATE_LOCATION_PENDING; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 725 | subscr->flags &= ~GSM_SUBSCRIBER_FIRST_CONTACT; |
| 726 | |
Jacob Erlbeck | 555b2e5 | 2015-01-26 13:52:42 +0100 | [diff] [blame] | 727 | if (subscr->sgsn_data->mm) |
| 728 | sgsn_update_subscriber_data(subscr->sgsn_data->mm); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 729 | } |
| 730 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 731 | void gprs_subscr_update_auth_info(struct gsm_subscriber *subscr) |
| 732 | { |
Jacob Erlbeck | bf34c67 | 2014-12-23 14:24:16 +0100 | [diff] [blame] | 733 | LOGGSUBSCRP(LOGL_DEBUG, subscr, |
| 734 | "Updating subscriber authentication info\n"); |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 735 | |
| 736 | subscr->flags &= ~GPRS_SUBSCRIBER_UPDATE_AUTH_INFO_PENDING; |
| 737 | subscr->flags &= ~GSM_SUBSCRIBER_FIRST_CONTACT; |
| 738 | |
Jacob Erlbeck | 555b2e5 | 2015-01-26 13:52:42 +0100 | [diff] [blame] | 739 | if (subscr->sgsn_data->mm) |
| 740 | sgsn_update_subscriber_data(subscr->sgsn_data->mm); |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 741 | } |
| 742 | |
| 743 | struct gsm_subscriber *gprs_subscr_get_or_create_by_mmctx(struct sgsn_mm_ctx *mmctx) |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 744 | { |
| 745 | struct gsm_subscriber *subscr = NULL; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 746 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 747 | if (mmctx->subscr) |
| 748 | return subscr_get(mmctx->subscr); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 749 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 750 | if (mmctx->imsi[0]) |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 751 | subscr = gprs_subscr_get_by_imsi(mmctx->imsi); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 752 | |
| 753 | if (!subscr) { |
| 754 | subscr = gprs_subscr_get_or_create(mmctx->imsi); |
| 755 | subscr->flags |= GSM_SUBSCRIBER_FIRST_CONTACT; |
Jacob Erlbeck | 65fa3f7 | 2015-01-06 16:32:41 +0100 | [diff] [blame] | 756 | subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 757 | } |
| 758 | |
| 759 | if (strcpy(subscr->equipment.imei, mmctx->imei) != 0) { |
Harald Welte | d3fa84d | 2016-04-20 17:50:17 +0200 | [diff] [blame] | 760 | strncpy(subscr->equipment.imei, mmctx->imei, |
| 761 | sizeof(subscr->equipment.imei)-1); |
| 762 | subscr->equipment.imei[sizeof(subscr->equipment.imei)-1] = 0; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 763 | } |
| 764 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 765 | if (subscr->lac != mmctx->ra.lac) |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 766 | subscr->lac = mmctx->ra.lac; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 767 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 768 | subscr->sgsn_data->mm = mmctx; |
| 769 | mmctx->subscr = subscr_get(subscr); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 770 | |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 771 | return subscr; |
| 772 | } |
| 773 | |
| 774 | int gprs_subscr_request_update_location(struct sgsn_mm_ctx *mmctx) |
| 775 | { |
| 776 | struct gsm_subscriber *subscr = NULL; |
| 777 | int rc; |
| 778 | |
| 779 | LOGMMCTXP(LOGL_DEBUG, mmctx, "Requesting subscriber data update\n"); |
| 780 | |
| 781 | subscr = gprs_subscr_get_or_create_by_mmctx(mmctx); |
| 782 | |
| 783 | subscr->flags |= GPRS_SUBSCRIBER_UPDATE_LOCATION_PENDING; |
| 784 | |
| 785 | rc = gprs_subscr_location_update(subscr); |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 786 | subscr_put(subscr); |
Jacob Erlbeck | 98a95ac | 2014-11-28 14:55:25 +0100 | [diff] [blame] | 787 | return rc; |
| 788 | } |
| 789 | |
| 790 | int gprs_subscr_request_auth_info(struct sgsn_mm_ctx *mmctx) |
| 791 | { |
| 792 | struct gsm_subscriber *subscr = NULL; |
| 793 | int rc; |
| 794 | |
| 795 | LOGMMCTXP(LOGL_DEBUG, mmctx, "Requesting subscriber authentication info\n"); |
| 796 | |
| 797 | subscr = gprs_subscr_get_or_create_by_mmctx(mmctx); |
| 798 | |
| 799 | subscr->flags |= GPRS_SUBSCRIBER_UPDATE_AUTH_INFO_PENDING; |
| 800 | |
| 801 | rc = gprs_subscr_query_auth_info(subscr); |
| 802 | subscr_put(subscr); |
| 803 | return rc; |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 804 | } |