blob: e5b0a6632fe454ccde8b3dfded4c01840242869f [file] [log] [blame]
Harald Welte3b6fb082016-04-25 18:46:22 +02001/*
Neels Hofmeyr5f460de2016-12-08 16:23:05 +01002 * (C) 2014 by sysmocom s.f.m.c. GmbH
Harald Welte3b6fb082016-04-25 18:46:22 +02003 * (C) 2015 by Holger Hans Peter Freyther
4 * (C) 2016 by Harald Welte <laforge@gnumonks.org>
5 * All Rights Reserved
6 *
7 * Author: Jacob Erlbeck
8 *
9 * This program is free software; you can redistribute it and/or modify
Neels Hofmeyr5f460de2016-12-08 16:23:05 +010010 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
Harald Welte3b6fb082016-04-25 18:46:22 +020012 * (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
Neels Hofmeyr5f460de2016-12-08 16:23:05 +010017 * GNU General Public License for more details.
Harald Welte3b6fb082016-04-25 18:46:22 +020018 *
Neels Hofmeyr5f460de2016-12-08 16:23:05 +010019 * You should have received a copy of the GNU General Public License
Harald Welte3b6fb082016-04-25 18:46:22 +020020 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#include <osmocom/gsm/tlv.h>
25#include <osmocom/core/msgb.h>
26#include <osmocom/core/logging.h>
27#include <osmocom/gsm/gsm48_ie.h>
28#include <osmocom/gsm/gsup.h>
29
30#include <stdint.h>
31
Harald Welte96e2a002017-06-12 21:44:18 +020032/*! \addtogroup gsup
33 * @{
Harald Welte381a1aa2017-10-16 18:31:20 +020034 * \file gsup.c
Neels Hofmeyr87e45502017-06-20 00:17:59 +020035 * Osmocom Generic Subscriber Update Protocol
Harald Welte96e2a002017-06-12 21:44:18 +020036 */
37
Neels Hofmeyr10f5fb42017-02-09 02:09:09 +010038const struct value_string osmo_gsup_message_type_names[] = {
39 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST),
40 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR),
41 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT),
42
43 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST),
44 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR),
45 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT),
46
47 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT),
48
49 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PURGE_MS_REQUEST),
50 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PURGE_MS_ERROR),
51 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PURGE_MS_RESULT),
52
53 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST),
54 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_INSERT_DATA_ERROR),
55 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_INSERT_DATA_RESULT),
56
57 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_DELETE_DATA_REQUEST),
58 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_DELETE_DATA_ERROR),
59 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_DELETE_DATA_RESULT),
60
61 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST),
62 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR),
63 OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT),
64 { 0, NULL }
65};
66
Harald Welte3b6fb082016-04-25 18:46:22 +020067static int decode_pdp_info(uint8_t *data, size_t data_len,
68 struct osmo_gsup_pdp_info *pdp_info)
69{
70 int rc;
71 uint8_t tag;
72 uint8_t *value;
73 size_t value_len;
74
75 /* specific parts */
76 while (data_len > 0) {
77 enum osmo_gsup_iei iei;
78
79 rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len);
80 if (rc < 0)
81 return -GMM_CAUSE_PROTO_ERR_UNSPEC;
82
83 iei = tag;
84
85 switch (iei) {
86 case OSMO_GSUP_PDP_CONTEXT_ID_IE:
87 pdp_info->context_id = osmo_decode_big_endian(value, value_len);
88 break;
89
90 case OSMO_GSUP_PDP_TYPE_IE:
91 pdp_info->pdp_type =
92 osmo_decode_big_endian(value, value_len) & 0x0fff;
93 break;
94
95 case OSMO_GSUP_ACCESS_POINT_NAME_IE:
96 pdp_info->apn_enc = value;
97 pdp_info->apn_enc_len = value_len;
98 break;
99
100 case OSMO_GSUP_PDP_QOS_IE:
101 pdp_info->qos_enc = value;
102 pdp_info->qos_enc_len = value_len;
103 break;
104
Holger Hans Peter Freythereb55c0d2017-07-07 16:53:30 +0200105 case OSMO_GSUP_CHARG_CHAR_IE:
106 pdp_info->pdp_charg_enc = value;
107 pdp_info->pdp_charg_enc_len = value_len;
108 break;
109
Harald Welte3b6fb082016-04-25 18:46:22 +0200110 default:
111 LOGP(DLGSUP, LOGL_ERROR,
112 "GSUP IE type %d not expected in PDP info\n", iei);
113 continue;
114 }
115 }
116
117 return 0;
118}
119
120static int decode_auth_info(uint8_t *data, size_t data_len,
121 struct osmo_auth_vector *auth_vector)
122{
123 int rc;
124 uint8_t tag;
125 uint8_t *value;
126 size_t value_len;
127 enum osmo_gsup_iei iei;
128 uint8_t presence = 0;
129
130 /* specific parts */
131 while (data_len > 0) {
132 rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len);
133 if (rc < 0)
134 return -GMM_CAUSE_PROTO_ERR_UNSPEC;
135
136 iei = tag;
137
138 switch (iei) {
139 case OSMO_GSUP_RAND_IE:
140 if (value_len != sizeof(auth_vector->rand))
141 goto parse_error;
142
143 memcpy(auth_vector->rand, value, value_len);
144 presence |= (1 << 0);
145 break;
146
147 case OSMO_GSUP_SRES_IE:
148 if (value_len != sizeof(auth_vector->sres))
149 goto parse_error;
150
151 memcpy(auth_vector->sres, value, value_len);
152 presence |= (1 << 1);
153 break;
154
155 case OSMO_GSUP_KC_IE:
156 if (value_len != sizeof(auth_vector->kc))
157 goto parse_error;
158
159 memcpy(auth_vector->kc, value, value_len);
160 presence |= (1 << 2);
161 break;
162
163 case OSMO_GSUP_IK_IE:
164 if (value_len != sizeof(auth_vector->ik))
165 goto parse_error;
166 memcpy(auth_vector->ik, value, value_len);
167 presence |= (1 << 4);
168 break;
169
170 case OSMO_GSUP_CK_IE:
171 if (value_len != sizeof(auth_vector->ck))
172 goto parse_error;
173 memcpy(auth_vector->ck, value, value_len);
174 presence |= (1 << 5);
175 break;
176
177 case OSMO_GSUP_AUTN_IE:
178 if (value_len != sizeof(auth_vector->autn))
179 goto parse_error;
180 memcpy(auth_vector->autn, value, value_len);
181 presence |= (1 << 6);
182 break;
183 case OSMO_GSUP_RES_IE:
184 if (value_len > sizeof(auth_vector->res))
185 goto parse_error;
186 memcpy(auth_vector->res, value, value_len);
187 auth_vector->res_len = value_len;
188 presence |= (1 << 7);
189 break;
190
191 default:
192 LOGP(DLGSUP, LOGL_ERROR,
193 "GSUP IE type %d not expected in PDP info\n", iei);
194 continue;
195 }
196 }
197
198 if (presence & 0x07)
199 auth_vector->auth_types |= OSMO_AUTH_TYPE_GSM;
200 if (presence & 0xf0)
201 auth_vector->auth_types |= OSMO_AUTH_TYPE_UMTS;
202
203 return 0;
204
205parse_error:
206 LOGP(DLGSUP, LOGL_ERROR,
207 "GSUP IE type %d, length %zu invalid in PDP info\n", iei, value_len);
208
209 return -1;
210}
211
212/*! Decode (parse) a GSUP message
213 * \param[in] const_data input data to be parsed
214 * \param[in] data_len length of input (\a const_data)
215 * \param[out] gsup_msg callee-allocated output data structure
216 * \returns 0 on success; negative otherwise
217 */
218int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
219 struct osmo_gsup_message *gsup_msg)
220{
221 int rc;
222 uint8_t tag;
223 /* the shift/match functions expect non-const pointers, but we'll
224 * either copy the data or cast pointers back to const before returning
225 * them
226 */
227 uint8_t *data = (uint8_t *)const_data;
228 uint8_t *value;
229 size_t value_len;
230 static const struct osmo_gsup_pdp_info empty_pdp_info = {0};
Neels Hofmeyr505adee2016-07-13 16:55:43 +0200231 static const struct osmo_auth_vector empty_auth_info = {{0}};
Harald Welte3b6fb082016-04-25 18:46:22 +0200232 static const struct osmo_gsup_message empty_gsup_message = {0};
233
234 *gsup_msg = empty_gsup_message;
235
236 /* generic part */
237 rc = osmo_shift_v_fixed(&data, &data_len, 1, &value);
238 if (rc < 0)
239 return -GMM_CAUSE_INV_MAND_INFO;
240
241 gsup_msg->message_type = osmo_decode_big_endian(value, 1);
242
243 rc = osmo_match_shift_tlv(&data, &data_len, OSMO_GSUP_IMSI_IE,
244 &value, &value_len);
245
246 if (rc <= 0)
247 return -GMM_CAUSE_INV_MAND_INFO;
248
249 if (value_len * 2 + 1 > sizeof(gsup_msg->imsi))
250 return -GMM_CAUSE_INV_MAND_INFO;
251
252 /* Note that gsm48_decode_bcd_number expects the number of encoded IMSI
253 * octets in the first octet. By coincidence (the TLV encoding) the byte
254 * before the value part already contains this length so we can use it
255 * here.
256 */
257 OSMO_ASSERT(value[-1] == value_len);
258 gsm48_decode_bcd_number(gsup_msg->imsi, sizeof(gsup_msg->imsi),
259 value - 1, 0);
260
261 /* specific parts */
262 while (data_len > 0) {
263 enum osmo_gsup_iei iei;
264 struct osmo_gsup_pdp_info pdp_info;
265 struct osmo_auth_vector auth_info;
266
267 rc = osmo_shift_tlv(&data, &data_len, &tag, &value, &value_len);
268 if (rc < 0)
269 return -GMM_CAUSE_PROTO_ERR_UNSPEC;
270
271 iei = tag;
272
273 switch (iei) {
274 case OSMO_GSUP_IMSI_IE:
275 case OSMO_GSUP_PDP_TYPE_IE:
276 case OSMO_GSUP_ACCESS_POINT_NAME_IE:
Harald Welte3b6fb082016-04-25 18:46:22 +0200277 case OSMO_GSUP_SRES_IE:
278 case OSMO_GSUP_KC_IE:
279 LOGP(DLGSUP, LOGL_NOTICE,
280 "GSUP IE type %d not expected (ignored)\n", iei);
281 continue;
282
283 case OSMO_GSUP_CAUSE_IE:
284 gsup_msg->cause = osmo_decode_big_endian(value, value_len);
285 break;
286
287 case OSMO_GSUP_CANCEL_TYPE_IE:
288 gsup_msg->cancel_type =
289 osmo_decode_big_endian(value, value_len) + 1;
290 break;
291
292 case OSMO_GSUP_PDP_INFO_COMPL_IE:
293 gsup_msg->pdp_info_compl = 1;
294 break;
295
296 case OSMO_GSUP_FREEZE_PTMSI_IE:
297 gsup_msg->freeze_ptmsi = 1;
298 break;
299
300 case OSMO_GSUP_PDP_CONTEXT_ID_IE:
301 /* When these IE appear in the top-level part of the
302 * message, they are used by Delete Subscr Info to delete
303 * single entries. We don't have an extra list for
304 * these but use the PDP info list instead */
305
306 /* fall through */
307
308 case OSMO_GSUP_PDP_INFO_IE:
309 if (gsup_msg->num_pdp_infos >= OSMO_GSUP_MAX_NUM_PDP_INFO) {
310 LOGP(DLGSUP, LOGL_ERROR,
311 "GSUP IE type %d (PDP_INFO) max exceeded\n",
312 iei);
313 return -GMM_CAUSE_COND_IE_ERR;
314 }
315
316 pdp_info = empty_pdp_info;
317
318 if (iei == OSMO_GSUP_PDP_INFO_IE) {
319 rc = decode_pdp_info(value, value_len, &pdp_info);
320 if (rc < 0)
321 return rc;
322 pdp_info.have_info = 1;
323 } else {
324 pdp_info.context_id =
325 osmo_decode_big_endian(value, value_len);
326 }
327
328 gsup_msg->pdp_infos[gsup_msg->num_pdp_infos++] =
329 pdp_info;
330 break;
331
332 case OSMO_GSUP_AUTH_TUPLE_IE:
333 if (gsup_msg->num_auth_vectors >= OSMO_GSUP_MAX_NUM_AUTH_INFO) {
334 LOGP(DLGSUP, LOGL_ERROR,
335 "GSUP IE type %d (AUTH_INFO) max exceeded\n",
336 iei);
337 return -GMM_CAUSE_INV_MAND_INFO;
338 }
339
340 auth_info = empty_auth_info;
341
342 rc = decode_auth_info(value, value_len, &auth_info);
343 if (rc < 0)
344 return rc;
345
346 gsup_msg->auth_vectors[gsup_msg->num_auth_vectors++] =
347 auth_info;
348 break;
349
350 case OSMO_GSUP_AUTS_IE:
Neels Hofmeyr3a5ca642017-02-21 15:53:20 +0100351 if (value_len != 14) {
Harald Welte3b6fb082016-04-25 18:46:22 +0200352 LOGP(DLGSUP, LOGL_ERROR,
Neels Hofmeyr3a5ca642017-02-21 15:53:20 +0100353 "AUTS length != 14 received\n");
Harald Welte3b6fb082016-04-25 18:46:22 +0200354 return -GMM_CAUSE_COND_IE_ERR;
355 }
356 gsup_msg->auts = value;
357 break;
358
Harald Welte766da862016-05-06 11:18:15 +0200359 case OSMO_GSUP_RAND_IE:
360 if (value_len != 16) {
361 LOGP(DLGSUP, LOGL_ERROR,
362 "RAND length != 16 received\n");
363 return -GMM_CAUSE_COND_IE_ERR;
364 }
365 gsup_msg->rand = value;
366 break;
367
Harald Welte3b6fb082016-04-25 18:46:22 +0200368 case OSMO_GSUP_MSISDN_IE:
369 gsup_msg->msisdn_enc = value;
370 gsup_msg->msisdn_enc_len = value_len;
371 break;
372
373 case OSMO_GSUP_HLR_NUMBER_IE:
374 gsup_msg->hlr_enc = value;
375 gsup_msg->hlr_enc_len = value_len;
376 break;
377
Harald Welte48dc1a52016-05-05 18:46:42 +0200378 case OSMO_GSUP_CN_DOMAIN_IE:
379 gsup_msg->cn_domain = *value;
380 break;
381
Holger Hans Peter Freythereb55c0d2017-07-07 16:53:30 +0200382 case OSMO_GSUP_CHARG_CHAR_IE:
383 gsup_msg->pdp_charg_enc = value;
384 gsup_msg->pdp_charg_enc_len = value_len;
385 break;
386
Harald Welte3b6fb082016-04-25 18:46:22 +0200387 default:
388 LOGP(DLGSUP, LOGL_NOTICE,
389 "GSUP IE type %d unknown\n", iei);
390 continue;
391 }
392 }
393
394 return 0;
395}
396
397static void encode_pdp_info(struct msgb *msg, enum osmo_gsup_iei iei,
398 const struct osmo_gsup_pdp_info *pdp_info)
399{
400 uint8_t *len_field;
401 size_t old_len;
402 uint8_t u8;
403
404 len_field = msgb_tlv_put(msg, iei, 0, NULL) - 1;
405 old_len = msgb_length(msg);
406
407 u8 = pdp_info->context_id;
408 msgb_tlv_put(msg, OSMO_GSUP_PDP_CONTEXT_ID_IE, sizeof(u8), &u8);
409
410 if (pdp_info->pdp_type) {
411 msgb_tlv_put(msg, OSMO_GSUP_PDP_TYPE_IE,
412 OSMO_GSUP_PDP_TYPE_SIZE,
413 osmo_encode_big_endian(pdp_info->pdp_type | 0xf000,
414 OSMO_GSUP_PDP_TYPE_SIZE));
415 }
416
417 if (pdp_info->apn_enc) {
418 msgb_tlv_put(msg, OSMO_GSUP_ACCESS_POINT_NAME_IE,
419 pdp_info->apn_enc_len, pdp_info->apn_enc);
420 }
421
422 if (pdp_info->qos_enc) {
423 msgb_tlv_put(msg, OSMO_GSUP_PDP_QOS_IE,
424 pdp_info->qos_enc_len, pdp_info->qos_enc);
425 }
426
Holger Hans Peter Freythereb55c0d2017-07-07 16:53:30 +0200427 if (pdp_info->pdp_charg_enc) {
428 msgb_tlv_put(msg, OSMO_GSUP_CHARG_CHAR_IE,
429 pdp_info->pdp_charg_enc_len, pdp_info->pdp_charg_enc);
430 }
431
Harald Welte3b6fb082016-04-25 18:46:22 +0200432 /* Update length field */
433 *len_field = msgb_length(msg) - old_len;
434}
435
436static void encode_auth_info(struct msgb *msg, enum osmo_gsup_iei iei,
437 const struct osmo_auth_vector *auth_vector)
438{
439 uint8_t *len_field;
440 size_t old_len;
441
442 len_field = msgb_tlv_put(msg, iei, 0, NULL) - 1;
443 old_len = msgb_length(msg);
444
Harald Weltedb78d212016-06-06 13:47:07 +0200445 if (auth_vector->auth_types & OSMO_AUTH_TYPE_GSM) {
446 msgb_tlv_put(msg, OSMO_GSUP_RAND_IE,
447 sizeof(auth_vector->rand), auth_vector->rand);
Harald Welte3b6fb082016-04-25 18:46:22 +0200448
Harald Weltedb78d212016-06-06 13:47:07 +0200449 msgb_tlv_put(msg, OSMO_GSUP_SRES_IE,
450 sizeof(auth_vector->sres), auth_vector->sres);
Harald Welte3b6fb082016-04-25 18:46:22 +0200451
Harald Weltedb78d212016-06-06 13:47:07 +0200452 msgb_tlv_put(msg, OSMO_GSUP_KC_IE,
453 sizeof(auth_vector->kc), auth_vector->kc);
454 }
455
456 if (auth_vector->auth_types & OSMO_AUTH_TYPE_UMTS) {
457 msgb_tlv_put(msg, OSMO_GSUP_IK_IE,
458 sizeof(auth_vector->ik), auth_vector->ik);
459
460 msgb_tlv_put(msg, OSMO_GSUP_CK_IE,
461 sizeof(auth_vector->ck), auth_vector->ck);
462
463 msgb_tlv_put(msg, OSMO_GSUP_AUTN_IE,
464 sizeof(auth_vector->autn), auth_vector->autn);
465
466 msgb_tlv_put(msg, OSMO_GSUP_RES_IE,
467 auth_vector->res_len, auth_vector->res);
468 }
Harald Welte3b6fb082016-04-25 18:46:22 +0200469
470 /* Update length field */
471 *len_field = msgb_length(msg) - old_len;
472}
473
474/*! Encode a GSUP message
475 * \param[out] msg message buffer to which encoded message is written
476 * \param[in] gsup_msg \ref osmo_gsup_message data to be encoded
477 */
478void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
479{
480 uint8_t u8;
481 int idx;
482 uint8_t bcd_buf[GSM48_MI_SIZE] = {0};
483 size_t bcd_len;
484
485 /* generic part */
486 OSMO_ASSERT(gsup_msg->message_type);
487 msgb_v_put(msg, gsup_msg->message_type);
488
489 bcd_len = gsm48_encode_bcd_number(bcd_buf, sizeof(bcd_buf), 0,
490 gsup_msg->imsi);
491
492 OSMO_ASSERT(bcd_len > 1);
Harald Welte1fa78562016-11-26 10:14:53 +0100493 OSMO_ASSERT(bcd_len <= sizeof(bcd_buf));
Harald Welte3b6fb082016-04-25 18:46:22 +0200494
495 /* Note that gsm48_encode_bcd_number puts the length into the first
496 * octet. Since msgb_tlv_put will add this length byte, we'll have to
497 * skip it */
498 msgb_tlv_put(msg, OSMO_GSUP_IMSI_IE, bcd_len - 1, &bcd_buf[1]);
499
500 /* specific parts */
501 if (gsup_msg->msisdn_enc)
502 msgb_tlv_put(msg, OSMO_GSUP_MSISDN_IE,
503 gsup_msg->msisdn_enc_len, gsup_msg->msisdn_enc);
504 if (gsup_msg->hlr_enc)
505 msgb_tlv_put(msg, OSMO_GSUP_HLR_NUMBER_IE,
506 gsup_msg->hlr_enc_len, gsup_msg->hlr_enc);
507
508 if ((u8 = gsup_msg->cause))
509 msgb_tlv_put(msg, OSMO_GSUP_CAUSE_IE, sizeof(u8), &u8);
510
511 if ((u8 = gsup_msg->cancel_type)) {
512 u8 -= 1;
513 msgb_tlv_put(msg, OSMO_GSUP_CANCEL_TYPE_IE, sizeof(u8), &u8);
514 }
515
516 if (gsup_msg->pdp_info_compl)
517 msgb_tlv_put(msg, OSMO_GSUP_PDP_INFO_COMPL_IE, 0, &u8);
518
519 if (gsup_msg->freeze_ptmsi)
520 msgb_tlv_put(msg, OSMO_GSUP_FREEZE_PTMSI_IE, 0, &u8);
521
522 for (idx = 0; idx < gsup_msg->num_pdp_infos; idx++) {
523 const struct osmo_gsup_pdp_info *pdp_info;
524
525 pdp_info = &gsup_msg->pdp_infos[idx];
526
527 if (pdp_info->context_id == 0)
528 continue;
529
530 if (pdp_info->have_info) {
531 encode_pdp_info(msg, OSMO_GSUP_PDP_INFO_IE, pdp_info);
532 } else {
533 u8 = pdp_info->context_id;
534 msgb_tlv_put(msg, OSMO_GSUP_PDP_CONTEXT_ID_IE,
535 sizeof(u8), &u8);
536 }
537 }
538
539 for (idx = 0; idx < gsup_msg->num_auth_vectors; idx++) {
540 const struct osmo_auth_vector *auth_vector;
541
542 auth_vector = &gsup_msg->auth_vectors[idx];
543
544 encode_auth_info(msg, OSMO_GSUP_AUTH_TUPLE_IE, auth_vector);
545 }
546
547 if (gsup_msg->auts)
Neels Hofmeyr8352d312017-02-02 20:05:14 +0100548 msgb_tlv_put(msg, OSMO_GSUP_AUTS_IE, 14, gsup_msg->auts);
Harald Welte48dc1a52016-05-05 18:46:42 +0200549
Harald Welte766da862016-05-06 11:18:15 +0200550 if (gsup_msg->rand)
551 msgb_tlv_put(msg, OSMO_GSUP_RAND_IE, 16, gsup_msg->rand);
552
Harald Welte48dc1a52016-05-05 18:46:42 +0200553 if (gsup_msg->cn_domain) {
554 uint8_t dn = gsup_msg->cn_domain;
555 msgb_tlv_put(msg, OSMO_GSUP_CN_DOMAIN_IE, 1, &dn);
556 }
Holger Hans Peter Freythereb55c0d2017-07-07 16:53:30 +0200557
558 if (gsup_msg->pdp_charg_enc) {
559 msgb_tlv_put(msg, OSMO_GSUP_CHARG_CHAR_IE,
560 gsup_msg->pdp_charg_enc_len, gsup_msg->pdp_charg_enc);
561 }
Harald Welte3b6fb082016-04-25 18:46:22 +0200562}
Harald Welte96e2a002017-06-12 21:44:18 +0200563
564/*! @} */