Coverage Report

Created: 2025-02-15 06:25

/src/wireshark/epan/dissectors/packet-gtp.c
Line
Count
Source (jump to first uncovered line)
1
/* packet-gtp.c
2
 *
3
 * Routines for GTP dissection
4
 * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
5
 *                 Nicolas Balkota <balkota@mac.com>
6
 *
7
 * Updates and corrections:
8
 * Copyright 2006 - 2009, Anders Broman <anders.broman@ericsson.com>
9
 *
10
 * Added Bearer control mode dissection:
11
 * Copyright 2011, Grzegorz Szczytowski <grzegorz.szczytowski@gmail.com>
12
 *
13
 * Updates and corrections:
14
 * Copyright 2011-2013, Anders Broman <anders.broman@ericsson.com>
15
 *
16
 * PDCP PDU number extension header support added by Martin Isaksson <martin.isaksson@ericsson.com>
17
 *
18
 * Control Plane Request-Response tracking code Largely based on similar routines in
19
 * packet-ldap.c by Ronnie Sahlberg
20
 * Added by Kari Tiirikainen <kari.tiirikainen@nsn.com>
21
 *
22
 * Wireshark - Network traffic analyzer
23
 * By Gerald Combs <gerald@wireshark.org>
24
 * Copyright 1998 Gerald Combs
25
 *
26
 * SPDX-License-Identifier: GPL-2.0-or-later
27
 *
28
 * GTP v0: 3GPP TS 09.60
29
 *
30
 *    http://www.3gpp.org/ftp/Specs/html-info/0960.htm
31
 *
32
 * GTP v1: 3GPP TS 29.060
33
 *
34
 *    http://www.3gpp.org/ftp/Specs/html-info/29060.htm
35
 *
36
 * GTP': 3GPP TS 32.295
37
 *
38
 *    http://www.3gpp.org/ftp/Specs/html-info/32295.htm
39
 */
40
41
#include "config.h"
42
43
#include <math.h>
44
45
#include <epan/packet.h>
46
#include <epan/conversation.h>
47
#include <epan/prefs.h>
48
#include <epan/expert.h>
49
#include <epan/sminmpec.h>
50
#include <epan/addr_resolv.h>
51
#include <epan/asn1.h>
52
#include <epan/tap.h>
53
#include <epan/srt_table.h>
54
#include <epan/to_str.h>
55
#include <epan/uat.h>
56
#include <epan/proto_data.h>
57
#include <epan/etypes.h>
58
#include <epan/tfs.h>
59
#include <epan/unit_strings.h>
60
61
#include "packet-radius.h"
62
#include "packet-gsm_a_common.h"
63
#include "packet-gsm_map.h"
64
#include "packet-gprscdr.h"
65
#include "packet-bssgp.h"
66
#include "packet-rrc.h"
67
#include "packet-e212.h"
68
#include "packet-e164.h"
69
#include "packet-gtp.h"
70
#include "packet-ranap.h"
71
#include "packet-pdcp-nr.h"
72
#include "packet-pdcp-lte.h"
73
#include "packet-rohc.h"
74
75
void proto_register_gtp(void);
76
void proto_reg_handoff_gtp(void);
77
78
static dissector_table_t gtp_priv_ext_dissector_table;
79
static dissector_table_t gtp_cdr_fmt_dissector_table;
80
static dissector_table_t gtp_hdr_ext_dissector_table;
81
static dissector_handle_t gtp_handle, gtp_prime_handle;
82
static dissector_handle_t nrup_handle;
83
84
static heur_dissector_list_t heur_subdissector_list;
85
86
#define GTPv0_PORT  3386
87
#define GTPv1C_PORT 2123    /* 3G Control PDU */
88
#define GTPv1U_PORT 2152    /* 3G T-PDU */
89
90
#define GTPv0_HDR_LENGTH     20
91
#define GTPv1_HDR_LENGTH     12
92
#define GTP_PRIME_HDR_LENGTH  6
93
94
/* to check compliance with ETSI  */
95
0
#define GTP_MANDATORY   1
96
#define GTP_OPTIONAL    2
97
#define GTP_CONDITIONAL 4
98
99
#define GTP_TPDU_AS_NONE -1
100
24
#define GTP_TPDU_AS_TPDU_HEUR 0
101
0
#define GTP_TPDU_AS_PDCP_LTE 1
102
0
#define GTP_TPDU_AS_PDCP_NR 2
103
0
#define GTP_TPDU_AS_SYNC 3
104
0
#define GTP_TPDU_AS_ETHERNET 4
105
0
#define GTP_TPDU_AS_CUSTOM 5
106
107
static bool g_gtp_over_tcp = true;
108
bool g_gtp_session;
109
110
static unsigned pref_pair_matching_max_interval_ms; /* Default: disable */
111
112
static unsigned g_gtpv0_port  = GTPv0_PORT;
113
static unsigned g_gtpv1c_port = GTPv1C_PORT;
114
static unsigned g_gtpv1u_port = GTPv1U_PORT;
115
116
static int proto_gtp;
117
static int proto_gtpprime;
118
119
/*KTi*/
120
static int hf_gtp_ie_id;
121
static int hf_gtp_response_in;
122
static int hf_gtp_response_to;
123
static int hf_gtp_time;
124
static int hf_gtp_apn;
125
static int hf_gtp_cause;
126
static int hf_gtp_chrg_char;
127
static int hf_gtp_chrg_char_s;
128
static int hf_gtp_chrg_char_n;
129
static int hf_gtp_chrg_char_p;
130
static int hf_gtp_chrg_char_f;
131
static int hf_gtp_chrg_char_h;
132
static int hf_gtp_chrg_char_r;
133
static int hf_gtp_chrg_id;
134
static int hf_gtp_chrg_ipv4;
135
static int hf_gtp_chrg_ipv6;
136
static int hf_gtp_ext_flow_label;
137
static int hf_gtp_ext_id;
138
static int hf_gtp_ext_val;
139
static int hf_gtp_ext_hdr;
140
static int hf_gtp_ext_hdr_next;
141
static int hf_gtp_ext_hdr_length;
142
static int hf_gtp_ext_hdr_ran_cont;
143
static int hf_gtp_ext_hdr_spare_bits;
144
static int hf_gtp_ext_hdr_spare_bytes;
145
static int hf_gtp_ext_hdr_long_pdcp_sn;
146
static int hf_gtp_ext_hdr_xw_ran_cont;
147
static int hf_gtp_ext_hdr_pdcpsn;
148
static int hf_gtp_ext_hdr_udp_port;
149
static int hf_gtp_flags;
150
static int hf_gtp_flags_ver;
151
static int hf_gtp_prime_flags_ver;
152
static int hf_gtp_flags_pt;
153
static int hf_gtp_flags_spare1;
154
static int hf_gtp_flags_hdr_length;
155
static int hf_gtp_flags_snn;
156
static int hf_gtp_flags_spare2;
157
static int hf_gtp_flags_e;
158
static int hf_gtp_flags_s;
159
static int hf_gtp_flags_pn;
160
static int hf_gtp_flow_ii;
161
static int hf_gtp_flow_label;
162
static int hf_gtp_flow_sig;
163
static int hf_gtp_gsn_addr_len;
164
static int hf_gtp_gsn_addr_type;
165
static int hf_gtp_gsn_ipv4;
166
static int hf_gtp_gsn_ipv6;
167
static int hf_gtp_length;
168
static int hf_gtp_map_cause;
169
static int hf_gtp_message_type;
170
static int hf_gtp_ms_reason;
171
static int hf_gtp_ms_valid;
172
static int hf_gtp_npdu_number;
173
static int hf_gtp_node_ipv4;
174
static int hf_gtp_node_ipv6;
175
static int hf_gtp_node_name;
176
static int hf_gtp_node_realm;
177
static int hf_gtp_nsapi;
178
static int hf_gtp_ptmsi;
179
static int hf_gtp_ptmsi_sig;
180
static int hf_gtp_qos_version;
181
static int hf_gtp_qos_spare1;
182
static int hf_gtp_qos_delay;
183
static int hf_gtp_qos_mean;
184
static int hf_gtp_qos_peak;
185
static int hf_gtp_qos_spare2;
186
static int hf_gtp_qos_precedence;
187
static int hf_gtp_qos_spare3;
188
static int hf_gtp_qos_reliability;
189
static int hf_gtp_qos_al_ret_priority;
190
static int hf_gtp_qos_traf_class;
191
static int hf_gtp_qos_del_order;
192
static int hf_gtp_qos_del_err_sdu;
193
static int hf_gtp_qos_max_sdu_size;
194
static int hf_gtp_qos_max_ul;
195
static int hf_gtp_qos_max_dl;
196
static int hf_gtp_qos_res_ber;
197
static int hf_gtp_qos_sdu_err_ratio;
198
static int hf_gtp_qos_trans_delay;
199
static int hf_gtp_qos_traf_handl_prio;
200
static int hf_gtp_qos_guar_ul;
201
static int hf_gtp_qos_guar_dl;
202
static int hf_gtp_qos_spare4;
203
static int hf_gtp_qos_sig_ind;
204
static int hf_gtp_qos_src_stat_desc;
205
static int hf_gtp_qos_arp;
206
static int hf_gtp_qos_arp_pvi;
207
static int hf_gtp_qos_arp_pl;
208
static int hf_gtp_qos_arp_pci;
209
static int hf_gtp_qos_qci;
210
static int hf_gtp_qos_ul_mbr;
211
static int hf_gtp_qos_dl_mbr;
212
static int hf_gtp_qos_ul_gbr;
213
static int hf_gtp_qos_dl_gbr;
214
static int hf_gtp_qos_ul_apn_ambr;
215
static int hf_gtp_qos_dl_apn_ambr;
216
static int hf_gtp_pkt_flow_id;
217
static int hf_gtp_rab_gtpu_dn;
218
static int hf_gtp_rab_gtpu_up;
219
static int hf_gtp_rab_pdu_dn;
220
static int hf_gtp_rab_pdu_up;
221
static int hf_gtp_uli_geo_loc_type;
222
static int hf_gtp_cgi_ci;
223
static int hf_gtp_sai_sac;
224
static int hf_gtp_rai_rac;
225
static int hf_gtp_lac;
226
static int hf_gtp_tac;
227
static int hf_gtp_ranap_cause;
228
static int hf_gtp_recovery;
229
static int hf_gtp_reorder;
230
static int hf_gtp_rnc_ipv4;
231
static int hf_gtp_rnc_ipv6;
232
static int hf_gtp_rp;
233
static int hf_gtp_rp_nsapi;
234
static int hf_gtp_rp_sms;
235
static int hf_gtp_rp_spare;
236
static int hf_gtp_sel_mode;
237
static int hf_gtp_seq_number;
238
static int hf_gtp_session;
239
static int hf_gtp_sndcp_number;
240
static int hf_gtp_tear_ind;
241
static int hf_gtp_teid;
242
static int hf_gtp_teid_cp;
243
static int hf_gtp_uplink_teid_cp;
244
static int hf_gtp_teid_data;
245
static int hf_gtp_uplink_teid_data;
246
static int hf_gtp_teid_ii;
247
static int hf_gtp_tid;
248
static int hf_gtp_tlli;
249
static int hf_gtp_tr_comm;
250
static int hf_gtp_trace_ref;
251
static int hf_gtp_trace_type;
252
static int hf_gtp_user_addr_pdp_org;
253
static int hf_gtp_user_addr_pdp_type;
254
static int hf_gtp_user_ipv4;
255
static int hf_gtp_user_ipv6;
256
static int hf_gtp_security_mode;
257
static int hf_gtp_no_of_vectors;
258
static int hf_gtp_cipher_algorithm;
259
static int hf_gtp_cksn_ksi;
260
static int hf_gtp_cksn;
261
static int hf_gtp_ksi;
262
static int hf_gtp_ext_length;
263
static int hf_gtp_utran_field;
264
static int hf_gtp_ext_apn_res;
265
static int hf_gtp_ext_rat_type;
266
static int hf_gtp_ext_imeisv;
267
static int hf_gtp_target_rnc_id;
268
static int hf_gtp_target_ext_rnc_id;
269
static int hf_gtp_bssgp_cause;
270
static int hf_gtp_bssgp_ra_discriminator;
271
static int hf_gtp_sapi;
272
static int hf_gtp_xid_par_len;
273
static int hf_gtp_rep_act_type;
274
static int hf_gtp_correlation_id;
275
static int hf_gtp_earp_pci;
276
static int hf_gtp_earp_pl;
277
static int hf_gtp_earp_pvi;
278
static int hf_gtp_ext_comm_flags_uasi;
279
static int hf_gtp_ext_comm_flags_bdwi;
280
static int hf_gtp_ext_comm_flags_pcri;
281
static int hf_gtp_ext_comm_flags_vb;
282
static int hf_gtp_ext_comm_flags_retloc;
283
static int hf_gtp_ext_comm_flags_cpsr;
284
static int hf_gtp_ext_comm_flags_ccrsi;
285
static int hf_gtp_ext_comm_flags_unauthenticated_imsi;
286
static int hf_gtp_csg_id;
287
static int hf_gtp_access_mode;
288
static int hf_gtp_cmi;
289
static int hf_gtp_csg_inf_rep_act_ucicsg;
290
static int hf_gtp_csg_inf_rep_act_ucishc;
291
static int hf_gtp_csg_inf_rep_act_uciuhc;
292
static int hf_gtp_ext_comm_flags_II_pnsi;
293
static int hf_gtp_ext_comm_flags_II_dtci;
294
static int hf_gtp_ext_comm_flags_II_pmtsmi;
295
static int hf_gtp_ext_comm_flags_II_spare;
296
static int hf_gtp_ciot_opt_sup_ind_sgni_pdn;
297
static int hf_gtp_ciot_opt_sup_ind_scni_pdn;
298
static int hf_gtp_ciot_opt_sup_ind_spare;
299
static int hf_gtp_up_fun_sel_ind_flags_dcnr;
300
static int hf_gtp_up_fun_sel_ind_flags_spare;
301
static int hf_gtp_cdr_app;
302
static int hf_gtp_cdr_rel;
303
static int hf_gtp_cdr_ver;
304
static int hf_gtp_cdr_rel_ext;
305
static int hf_gtp_cdr_length;
306
static int hf_gtp_cdr_context;
307
static int hf_gtp_cmn_flg_ppc;
308
static int hf_gtp_cmn_flg_mbs_srv_type;
309
static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy;
310
static int hf_gtp_cmn_flg_mbs_cnt_inf;
311
static int hf_gtp_cmn_flg_nrsn;
312
static int hf_gtp_cmn_flg_no_qos_neg;
313
static int hf_gtp_cmn_flg_upgrd_qos_sup;
314
static int hf_gtp_cmn_flg_dual_addr_bearer_flg;
315
static int hf_gtp_linked_nsapi;
316
static int hf_gtp_enh_nsapi;
317
static int hf_gtp_tmgi;
318
static int hf_gtp_mbms_ses_dur_days;
319
static int hf_gtp_mbms_ses_dur_s;
320
static int hf_gtp_no_of_mbms_sa_codes;
321
static int hf_gtp_mbms_sa_code;
322
static int hf_gtp_trace_ref2;
323
static int hf_gtp_trace_rec_session_ref;
324
static int hf_gtp_trace_triggers_ggsn_pdp;
325
static int hf_gtp_trace_triggers_ggsn_mbms;
326
static int hf_gtp_trace_triggers_ggsn;
327
static int hf_gtp_trace_depth;
328
static int hf_gtp_trace_loi_ggsn_gmb;
329
static int hf_gtp_trace_loi_ggsn_gi;
330
static int hf_gtp_trace_loi_ggsn_gn;
331
static int hf_gtp_trace_loi_ggsn;
332
static int hf_gtp_trace_activity_control;
333
static int hf_gtp_hop_count;
334
static int hf_gtp_mbs_2g_3g_ind;
335
static int hf_gtp_trace_triggers_bm_sc_mbms;
336
static int hf_gtp_trace_triggers_bm_sc;
337
static int hf_gtp_trace_loi_bm_sc_gmb;
338
static int hf_gtp_trace_loi_bm_sc;
339
static int hf_gtp_time_2_dta_tr;
340
static int hf_gtp_target_lac;
341
static int hf_gtp_target_rac;
342
static int hf_gtp_target_ci;
343
static int hf_gtp_source_type;
344
static int hf_gtp_source_lac;
345
static int hf_gtp_source_rac;
346
static int hf_gtp_source_ci;
347
static int hf_gtp_source_rnc_id;
348
static int hf_gtp_ext_ei;
349
static int hf_gtp_ext_gcsi;
350
static int hf_gtp_ext_dti;
351
static int hf_gtp_ra_prio_lcs;
352
static int hf_gtp_bcm;
353
static int hf_gtp_fqdn;
354
static int hf_gtp_rim_routing_addr;
355
static int hf_gtp_mbms_flow_id;
356
static int hf_gtp_mbms_dist_indic;
357
static int hf_gtp_ext_apn_ambr_ul;
358
static int hf_gtp_ext_apn_ambr_dl;
359
static int hf_gtp_ext_sub_ue_ambr_ul;
360
static int hf_gtp_ext_sub_ue_ambr_dl;
361
static int hf_gtp_ext_auth_ue_ambr_ul;
362
static int hf_gtp_ext_auth_ue_ambr_dl;
363
static int hf_gtp_ext_auth_apn_ambr_ul;
364
static int hf_gtp_ext_auth_apn_ambr_dl;
365
static int hf_gtp_ext_ggsn_back_off_time_units;
366
static int hf_gtp_ext_ggsn_back_off_timer;
367
static int hf_gtp_lapi;
368
static int hf_gtp_higher_br_16mb_flg;
369
static int hf_gtp_max_mbr_apn_ambr_ul;
370
static int hf_gtp_max_mbr_apn_ambr_dl;
371
static int hf_gtp_ext_enb_type;
372
static int hf_gtp_macro_enodeb_id;
373
static int hf_gtp_home_enodeb_id;
374
static int hf_gtp_dummy_octets;
375
376
static int hf_pdcp_cont;
377
378
static int hf_gtp_ext_hdr_pdu_ses_cont_pdu_type;
379
static int hf_gtp_ext_hdr_pdu_ses_cont_qmp;
380
static int hf_gtp_ext_hdr_pdu_ses_cont_snp_dl;
381
static int hf_gtp_ext_hdr_pdu_ses_cont_msnp;
382
static int hf_gtp_ext_hdr_pdu_ses_cont_ppp;
383
static int hf_gtp_ext_hdr_pdu_ses_cont_rqi;
384
static int hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id;
385
static int hf_gtp_ext_hdr_pdu_ses_cont_ppi;
386
static int hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp;
387
static int hf_gtp_ext_hdr_pdu_ses_cont_dl_qfi_sn;
388
static int hf_gtp_ext_hdr_pdu_ses_cont_dl_mbs_qfi_sn;
389
static int hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind;
390
static int hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind;
391
static int hf_gtp_ext_hdr_pdu_ses_cont_snp_ul;
392
static int hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind;
393
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag;
394
static int hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp_repeat;
395
static int hf_gtp_ext_hdr_pdu_ses_cont_dl_recv_time_stamp;
396
static int hf_gtp_ext_hdr_pdu_ses_cont_ul_send_time_stamp;
397
static int hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_result;
398
static int hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_result;
399
static int hf_gtp_ext_hdr_pdu_ses_cont_ul_qfi_sn;
400
static int hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_result;
401
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7;
402
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6;
403
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5;
404
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4;
405
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3;
406
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2;
407
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1;
408
static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0;
409
static int hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind;
410
411
static int hf_gtp_spare_b0;
412
static int hf_gtp_spare_b4b0;
413
static int hf_gtp_spare_b7b1;
414
static int hf_gtp_rnc_ip_addr_v4;
415
static int hf_gtp_rnc_ip_addr_v6;
416
static int hf_gtp_ms_cm_2_len;
417
static int hf_gtp_ms_cm_3_len;
418
static int hf_gtp_sup_codec_lst_len;
419
static int hf_gtp_add_flg_for_srvcc_ics;
420
static int hf_gtp_sel_mode_val;
421
static int hf_gtp_uli_timestamp;
422
static int hf_gtp_lhn_id;
423
static int hf_gtp_sel_entity;
424
static int hf_gtp_ue_usage_type_value;
425
static int hf_gtp_scef_id_length;
426
static int hf_gtp_scef_id;
427
static int hf_gtp_iov_updates_counter;
428
static int hf_gtp_mapped_ue_usage_type;
429
430
/* Generated from convert_proto_tree_add_text.pl */
431
static int hf_gtp_rfsp_index;
432
static int hf_gtp_quintuplet_ciphering_key;
433
static int hf_gtp_kc;
434
static int hf_gtp_rand;
435
static int hf_gtp_pdp_context_identifier;
436
static int hf_gtp_receive_n_pdu_number;
437
static int hf_gtp_container_length;
438
static int hf_gtp_quintuplets_length;
439
static int hf_gtp_auth;
440
static int hf_gtp_tft_length;
441
static int hf_gtp_ggsn_address_for_control_plane_ipv4;
442
static int hf_gtp_ggsn_address_for_control_plane_ipv6;
443
static int hf_gtp_ggsn_address_for_user_traffic_ipv4;
444
static int hf_gtp_ggsn_address_for_user_traffic_ipv6;
445
static int hf_gtp_integrity_key_ik;
446
static int hf_gtp_gsn_address_information_element_length;
447
static int hf_gtp_reordering_required;
448
static int hf_gtp_sres;
449
static int hf_gtp_data_record_format;
450
static int hf_gtp_timezone;
451
static int hf_gtp_timezone_dst;
452
static int hf_gtp_authentication_length;
453
static int hf_gtp_send_n_pdu_number;
454
static int hf_gtp_sequence_number_up;
455
static int hf_gtp_pdp_address_length;
456
static int hf_gtp_transaction_identifier;
457
static int hf_gtp_xres_length;
458
static int hf_gtp_ggsn_address_length;
459
static int hf_gtp_apn_length;
460
static int hf_gtp_sequence_number_down;
461
static int hf_gtp_pdp_address_ipv4;
462
static int hf_gtp_activity_status_indicator;
463
static int hf_gtp_pdp_type;
464
static int hf_gtp_quintuplet_integrity_key;
465
static int hf_gtp_pdp_address_ipv6;
466
static int hf_gtp_rab_setup_length;
467
static int hf_gtp_number_of_data_records;
468
static int hf_gtp_ciphering_key_kc;
469
static int hf_gtp_pdp_cntxt_sapi;
470
static int hf_gtp_xres;
471
static int hf_gtp_pdp_organization;
472
static int hf_gtp_node_address_length;
473
static int hf_gtp_gsn_address_length;
474
static int hf_gtp_vplmn_address_allowed;
475
static int hf_gtp_uplink_flow_label_signalling;
476
static int hf_gtp_extended_end_user_address;
477
static int hf_gtp_ciphering_key_ck;
478
static int hf_gtp_fqdn_length;
479
static int hf_gtp_seq_num_released;
480
static int hf_gtp_seq_num_canceled;
481
static int hf_gtp_requests_responded;
482
static int hf_gtp_hyphen_separator;
483
static int hf_gtp_ms_network_cap_content_len;
484
static int hf_gtp_iei;
485
static int hf_gtp_iei_mobile_id_len;
486
static int hf_gtp_qos_umts_length;
487
static int hf_gtp_num_ext_hdr_types;
488
static int hf_gtp_ext_hdr_type;
489
static int hf_gtp_tpdu_data;
490
491
static int hf_gtp_sgsn_address_for_control_plane_ipv4;
492
static int hf_gtp_sgsn_address_for_control_plane_ipv6;
493
static int hf_gtp_sgsn_address_for_user_traffic_ipv4;
494
static int hf_gtp_sgsn_address_for_user_traffic_ipv6;
495
496
/* Initialize the subtree pointers */
497
static int ett_gtp;
498
static int ett_gtp_flags;
499
static int ett_gtp_ext;
500
static int ett_gtp_ext_hdr;
501
static int ett_gtp_qos;
502
static int ett_gtp_qos_arp;
503
static int ett_gtp_flow_ii;
504
static int ett_gtp_rp;
505
static int ett_gtp_pkt_flow_id;
506
static int ett_gtp_trip;
507
static int ett_gtp_quint;
508
static int ett_gtp_proto;
509
static int ett_gtp_gsn_addr;
510
static int ett_gtp_tft;
511
static int ett_gtp_rab_setup;
512
static int ett_gtp_hdr_list;
513
static int ett_gtp_node_addr;
514
static int ett_gtp_rel_pack;
515
static int ett_gtp_can_pack;
516
static int ett_gtp_data_resp;
517
static int ett_gtp_drx;
518
static int ett_gtp_net_cap;
519
static int ett_gtp_tmgi;
520
static int ett_gtp_cdr_ver;
521
static int ett_gtp_cdr_dr;
522
static int ett_gtp_mm_cntxt;
523
static int ett_gtp_utran_cont;
524
static int ett_gtp_nr_ran_cont;
525
static int ett_gtp_pdcp_no_conf;
526
static int ett_pdu_session_cont;
527
static int ett_gtp_trace_triggers_ggsn;
528
static int ett_gtp_trace_loi_ggsn;
529
static int ett_gtp_trace_triggers_bm_sc;
530
static int ett_gtp_trace_loi_bm_sc;
531
static int ett_gtp_bss_cont;
532
static int ett_gtp_lst_set_up_pfc;
533
static int ett_gtp_rrc_cont;
534
static int ett_gtp_rim_routing_adr;
535
536
static expert_field ei_gtp_ext_hdr_pdcpsn;
537
static expert_field ei_gtp_ext_length_mal;
538
static expert_field ei_gtp_ext_length_warn;
539
static expert_field ei_gtp_undecoded;
540
static expert_field ei_gtp_message_not_found;
541
static expert_field ei_gtp_field_not_present;
542
static expert_field ei_gtp_wrong_next_field;
543
static expert_field ei_gtp_field_not_support_in_version;
544
static expert_field ei_gtp_guaranteed_bit_rate_value;
545
static expert_field ei_gtp_max_bit_rate_value;
546
static expert_field ei_gtp_ext_geo_loc_type;
547
static expert_field ei_gtp_iei;
548
static expert_field ei_gtp_unknown_extension_header;
549
static expert_field ei_gtp_unknown_pdu_type;
550
static expert_field ei_gtp_source_type_unknown;
551
static expert_field ei_gtp_cdr_rel_ext_invalid;
552
553
static const range_string assistance_info_type[] = {
554
    { 0,   0,   "UNKNOWN" },
555
    { 1,   1,   "Average CQL" },
556
    { 2,   2,   "Average HARQ Failure" },
557
    { 3,   3,   "Average HARQ Retransmissions" },
558
    { 4,   4,   "DL Radio Quality Index" },
559
    { 5,   5,   "UL Radio Quality Index" },
560
    { 6,   6,   "Power Headroom Report" },
561
    { 7,   228, "reserved for future value extensions" },
562
    { 229, 255, "reserved for test purposes" },
563
    { 0,   0,   NULL}
564
};
565
566
567
/* NRUP - TS 38.425 */
568
/* NR-U RAN Container */
569
static int proto_nrup;
570
static int hf_nrup_pdu_type;
571
static int hf_nrup_spr_bit_extnd_flag;
572
static int hf_nrup_dl_discrd_blks;
573
static int hf_nrup_dl_flush;
574
static int hf_nrup_rpt_poll;
575
static int hf_nrup_retransmission_flag;
576
static int hf_nrup_ass_inf_rep_poll_flag;
577
static int hf_nrup_spare;
578
static int hf_nrup_request_out_of_seq_report;
579
static int hf_nrup_report_delivered;
580
static int hf_nrup_user_data_existence_flag;
581
static int hf_nrup_nr_u_seq_num;
582
static int hf_nrup_dl_disc_nr_pdcp_pdu_sn;
583
static int hf_nrup_dl_disc_num_blks;
584
static int hf_nrup_dl_disc_nr_pdcp_pdu_sn_start;
585
static int hf_nrup_dl_disc_blk_sz;
586
static int hf_nrup_dl_report_nr_pdcp_pdu_sn;
587
static int hf_nrup_high_tx_nr_pdcp_sn_ind;
588
static int hf_nrup_high_delivered_nr_pdcp_sn_ind;
589
static int hf_nrup_final_frame_ind;
590
static int hf_nrup_lost_pkt_rpt;
591
static int hf_nrup_high_retx_nr_pdcp_sn_ind;
592
static int hf_nrup_high_delivered_retx_nr_pdcp_sn_ind;
593
static int hf_nrup_cause_rpt;
594
static int hf_nrup_delivered_nr_pdcp_sn_range_ind;
595
static int hf_nrup_data_rate_ind;
596
static int hf_nrup_desrd_buff_sz_data_radio_bearer;
597
static int hf_nrup_desrd_data_rate;
598
static int hf_nrup_num_lost_nru_seq_num;
599
static int hf_nrup_start_lost_nru_seq_num;
600
static int hf_nrup_end_lost_nru_seq_num;
601
static int hf_nrup_high_success_delivered_nr_pdcp_sn;
602
static int hf_nrup_high_tx_nr_pdcp_sn;
603
static int hf_nrup_cause_val;
604
static int hf_nrup_high_success_delivered_retx_nr_pdcp_sn;
605
static int hf_nrup_high_retx_nr_pdcp_sn;
606
static int hf_nrup_pdcp_duplication_ind;
607
static int hf_nrup_assistance_information_ind;
608
static int hf_nrup_ul_delay_ind;
609
static int hf_nrup_dl_delay_ind;
610
static int hf_nrup_spare_2;
611
static int hf_nrup_pdcp_duplication_activation_suggestion;
612
static int hf_nrup_num_assistance_info_fields;
613
static int hf_nrup_assistance_information_type;
614
static int hf_nrup_num_octets_radio_qa_info;
615
static int hf_nrup_radio_qa_info;
616
static int hf_nrup_ul_delay_du_result;
617
static int hf_nrup_dl_delay_du_result;
618
619
static int ett_nrup;
620
621
typedef struct {
622
    int8_t rim_routing_addr_disc;
623
} gtp_private_data_t;
624
625
626
static gtp_private_data_t*
627
gtp_get_private_data(packet_info *pinfo)
628
3
{
629
3
    gtp_private_data_t *gtp_data = (gtp_private_data_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gtp, 0);
630
631
3
    if (!gtp_data) {
632
3
        gtp_data = wmem_new(wmem_file_scope(), gtp_private_data_t);
633
3
        gtp_data->rim_routing_addr_disc = -1;
634
3
        p_add_proto_data(wmem_file_scope(), pinfo, proto_gtp, 0, gtp_data);
635
3
    }
636
3
    return gtp_data;
637
3
}
638
639
/* --- PDCP DECODE ADDITIONS --- */
640
static bool
641
pdcp_uat_fld_ip_chk_cb(void* r _U_, const char* ipaddr, unsigned len _U_, const void* u1 _U_, const void* u2 _U_, char** err)
642
0
{
643
0
    ws_in4_addr ip4_addr;
644
0
    ws_in6_addr ip6_addr;
645
646
    /* Check for a valid IPv4 or IPv6 address */
647
0
    if (ipaddr &&
648
0
        (ws_inet_pton6(ipaddr, &ip6_addr) ||
649
0
         ws_inet_pton4(ipaddr, &ip4_addr))) {
650
0
        *err = NULL;
651
0
        return true;
652
0
    }
653
654
0
    *err = ws_strdup_printf("No valid IP address given");
655
0
    return false;
656
0
}
657
658
0
#define PDCP_TEID_WILDCARD "*"
659
660
static bool
661
pdcp_uat_fld_teid_chk_cb(void* r _U_, const char* teid, unsigned len _U_, const void* u1 _U_, const void* u2 _U_, char** err)
662
0
{
663
0
    if (teid) {
664
0
        uint32_t val;
665
666
        /* Check if it is a wildcard TEID */
667
0
        if (!strcmp(teid, PDCP_TEID_WILDCARD)) {
668
0
            *err = NULL;
669
0
            return true;
670
0
        }
671
        /* Check if it is a valid 32bits unsigned integer */
672
0
        if (ws_basestrtou32(teid, NULL, &val, 0)) {
673
0
            *err = NULL;
674
0
            return true;
675
0
        }
676
0
    }
677
678
0
    *err = ws_strdup_printf("No valid TEID given");
679
0
    return false;
680
0
}
681
682
typedef struct {
683
    char *ip_addr_str;
684
    address ip_address;
685
    char *teid_str;
686
    bool teid_wildcard;
687
    uint32_t teid;
688
    unsigned direction;
689
    unsigned header_present;
690
    enum pdcp_plane plane;
691
    unsigned lte_sn_length;
692
    unsigned rohc_compression;
693
    //unsigned rohc_mode;
694
    unsigned rohc_profile;
695
    /* One approach would be to just use the TEID, but it is 32 bits and would need to be
696
     * truncated to (ultimately) 16 bits to be used as a UEId for PDCP */
697
    uint32_t ue_id;
698
    unsigned   rb_id;
699
} uat_pdcp_lte_keys_record_t;
700
701
/* N.B. this is an array/table of the struct above, where IP address + TEID is the key */
702
static uat_pdcp_lte_keys_record_t *uat_pdcp_lte_keys_records;
703
704
static bool pdcp_lte_update_cb(void *r, char **err)
705
0
{
706
0
    uat_pdcp_lte_keys_record_t* rec = (uat_pdcp_lte_keys_record_t *)r;
707
0
    ws_in4_addr ip4_addr;
708
0
    ws_in6_addr ip6_addr;
709
710
0
    if (!strcmp(rec->teid_str, PDCP_TEID_WILDCARD)) {
711
0
        rec->teid_wildcard = true;
712
0
        rec->teid = 0;
713
0
    } else if (ws_basestrtou32(rec->teid_str, NULL, &rec->teid, 0)) {
714
0
        rec->teid_wildcard = false;
715
0
    } else {
716
0
        if (err)
717
0
            *err = ws_strdup_printf("No valid TEID given");
718
0
        return false;
719
0
    }
720
721
0
    free_address_wmem(wmem_epan_scope(), &rec->ip_address);
722
0
    if (ws_inet_pton6(rec->ip_addr_str, &ip6_addr)) {
723
0
        alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv6, sizeof(ws_in6_addr), &ip6_addr);
724
0
    } else if (ws_inet_pton4(rec->ip_addr_str, &ip4_addr)) {
725
0
        alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv4, sizeof(ws_in4_addr), &ip4_addr);
726
0
    } else {
727
0
        if (err)
728
0
            *err = ws_strdup_printf("No valid IP address given");
729
0
        return false;
730
0
    }
731
732
    /* Range-check rb */
733
0
    if ((rec->rb_id < 1) || (rec->rb_id > 10)) {
734
0
        if (err)
735
0
            *err = ws_strdup_printf("RB Id must be in range [1,10]");
736
0
        return false;
737
0
    }
738
739
    /* Range-check ueid */
740
0
    if ((rec->ue_id < 1) || (rec->ue_id > 65535)) {
741
0
        if (err)
742
0
            *err = ws_strdup_printf("UEId must be in range [1,65535]");
743
0
        return false;
744
0
    }
745
746
747
0
    return true;
748
0
}
749
750
static void *pdcp_lte_copy_cb(void *n, const void *o, size_t len _U_)
751
0
{
752
0
    uat_pdcp_lte_keys_record_t* new_rec = (uat_pdcp_lte_keys_record_t *)n;
753
0
    const uat_pdcp_lte_keys_record_t* old_rec = (const uat_pdcp_lte_keys_record_t *)o;
754
755
    /* Copy UAT fields */
756
0
    new_rec->ip_addr_str = g_strdup(old_rec->ip_addr_str);
757
0
    clear_address(&new_rec->ip_address);
758
0
    new_rec->teid_str = g_strdup(old_rec->teid_str);
759
0
    new_rec->direction = old_rec->direction;
760
0
    new_rec->header_present = old_rec->header_present;
761
0
    new_rec->plane = old_rec->plane;
762
0
    new_rec->lte_sn_length = old_rec->lte_sn_length;
763
0
    new_rec->rohc_compression = old_rec->rohc_compression;
764
    //new_rec->rohc_mode = old_rec->rohc_mode;
765
0
    new_rec->rohc_profile = old_rec->rohc_profile;
766
0
    new_rec->ue_id = old_rec->ue_id;
767
0
    new_rec->rb_id = old_rec->rb_id;
768
769
0
    pdcp_lte_update_cb(new_rec, NULL);
770
771
0
    return new_rec;
772
0
}
773
774
static void pdcp_lte_free_cb(void *r)
775
0
{
776
0
    uat_pdcp_lte_keys_record_t* rec = (uat_pdcp_lte_keys_record_t *)r;
777
778
0
    g_free(rec->ip_addr_str);
779
0
    g_free(rec->teid_str);
780
0
    free_address_wmem(wmem_epan_scope(), &rec->ip_address);
781
0
}
782
783
14
#define PDCP_SN_LENGTH_12_BITS_STR "12 bits"
784
static const value_string vs_pdcp_lte_sn_length[] = {
785
    {PDCP_SN_LENGTH_5_BITS,  "5 bits"},
786
    {PDCP_SN_LENGTH_7_BITS,  "7 bits"},
787
    {PDCP_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR},
788
    {PDCP_SN_LENGTH_15_BITS, "15 bits"},
789
    {PDCP_SN_LENGTH_18_BITS, "18 bits"},
790
    {0, NULL}
791
};
792
793
/* Struct for saving PDCP-NR information about specific TEID */
794
typedef struct {
795
    char *ip_addr_str;
796
    address ip_address;
797
    char *teid_str;
798
    bool teid_wildcard;
799
    uint32_t teid;
800
    unsigned direction;
801
    /* PDCP_NR_(U|D)L_sdap_hdr_PRESENT bitmask */
802
    unsigned sdap_header_present;
803
    unsigned mac_i_present;
804
    enum pdcp_nr_plane plane;
805
    unsigned pdcp_nr_sn_length;
806
    unsigned rohc_compression;
807
    //unsigned rohc_mode;
808
    unsigned rohc_profile;
809
    /* One approach would be to just use the TEID, but it is 32 bits and would need to be
810
     * truncated to (ultimately) 16 bits to be used as a UEId for PDCP */
811
    uint32_t ue_id;
812
    unsigned   rb_id;
813
} uat_pdcp_nr_keys_record_t;
814
815
/* N.B. this is an array/table of the struct above, where IP address + TEID is the key */
816
static uat_pdcp_nr_keys_record_t *uat_pdcp_nr_keys_records;
817
818
0
static bool pdcp_nr_update_cb(void *r, char **err) {
819
0
    uat_pdcp_nr_keys_record_t* rec = (uat_pdcp_nr_keys_record_t *)r;
820
0
    ws_in4_addr ip4_addr;
821
0
    ws_in6_addr ip6_addr;
822
823
0
    if (!strcmp(rec->teid_str, PDCP_TEID_WILDCARD)) {
824
0
        rec->teid_wildcard = true;
825
0
        rec->teid = 0;
826
0
    } else if (ws_basestrtou32(rec->teid_str, NULL, &rec->teid, 0)) {
827
0
        rec->teid_wildcard = false;
828
0
    } else {
829
0
        if (err)
830
0
            *err = ws_strdup_printf("No valid TEID given");
831
0
        return false;
832
0
    }
833
834
0
    free_address_wmem(wmem_epan_scope(), &rec->ip_address);
835
0
    if (ws_inet_pton6(rec->ip_addr_str, &ip6_addr)) {
836
0
        alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv6, sizeof(ws_in6_addr), &ip6_addr);
837
0
    } else if (ws_inet_pton4(rec->ip_addr_str, &ip4_addr)) {
838
0
        alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv4, sizeof(ws_in4_addr), &ip4_addr);
839
0
    } else {
840
0
        if (err)
841
0
            *err = ws_strdup_printf("No valid IP address given");
842
0
        return false;
843
0
    }
844
845
    /* Range-check rb */
846
0
    if ((rec->rb_id < 1) || (rec->rb_id > 32)) {
847
0
        if (err)
848
0
            *err = ws_strdup_printf("RB Id must be in range [1,32]");
849
0
        return false;
850
0
    }
851
852
    /* Range-check ueid */
853
0
    if ((rec->ue_id < 1) || (rec->ue_id > 65535)) {
854
0
        if (err)
855
0
            *err = ws_strdup_printf("UEId must be in range [1,65535]");
856
0
        return false;
857
0
    }
858
859
0
    return true;
860
0
}
861
862
0
static void *pdcp_nr_copy_cb(void *n, const void *o, size_t len _U_) {
863
0
    uat_pdcp_nr_keys_record_t* new_rec = (uat_pdcp_nr_keys_record_t *)n;
864
0
    const uat_pdcp_nr_keys_record_t* old_rec = (const uat_pdcp_nr_keys_record_t *)o;
865
866
    /* Copy UAT fields */
867
0
    new_rec->ip_addr_str = g_strdup(old_rec->ip_addr_str);
868
0
    clear_address(&new_rec->ip_address);   /* not copying address.. */
869
0
    new_rec->teid_str = g_strdup(old_rec->teid_str);
870
0
    new_rec->direction = old_rec->direction;
871
0
    new_rec->sdap_header_present = old_rec->sdap_header_present;
872
0
    new_rec->mac_i_present = old_rec->mac_i_present;
873
0
    new_rec->plane = old_rec->plane;
874
0
    new_rec->pdcp_nr_sn_length = old_rec->pdcp_nr_sn_length;
875
0
    new_rec->rohc_compression = old_rec->rohc_compression;
876
    //new_rec->rohc_mode = old_rec->rohc_mode;
877
0
    new_rec->rohc_profile = old_rec->rohc_profile;
878
0
    new_rec->ue_id = old_rec->ue_id;
879
0
    new_rec->rb_id = old_rec->rb_id;
880
881
0
    pdcp_nr_update_cb(new_rec, NULL);
882
883
0
    return new_rec;
884
0
}
885
886
static void pdcp_nr_free_cb(void *r)
887
0
{
888
0
    uat_pdcp_nr_keys_record_t* rec = (uat_pdcp_nr_keys_record_t *)r;
889
890
0
    g_free(rec->ip_addr_str);
891
0
    g_free(rec->teid_str);
892
0
    free_address_wmem(wmem_epan_scope(), &rec->ip_address);
893
0
}
894
895
#define PDCP_DIRECTION_UPLINK_STR   "UL"
896
14
#define PDCP_DIRECTION_DOWNLINK_STR "DL"
897
static const value_string vs_direction[] = {
898
    { PDCP_NR_DIRECTION_UPLINK,   PDCP_DIRECTION_UPLINK_STR },
899
    { PDCP_NR_DIRECTION_DOWNLINK, PDCP_DIRECTION_DOWNLINK_STR },
900
    { 0, NULL }
901
};
902
903
/* Value sets for each drop-down list in the GUI */
904
14
#define PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR "SDAP header NOT present"
905
#define PDCP_NR_SDAP_HEADER_NOT_PRESENT 0
906
0
#define PDCP_NR_SDAP_HEADER_PRESENT     1
907
static const value_string vs_sdap_header_present[] = {
908
    { 0, PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR },
909
    { 1, "SDAP header present" },
910
    { 0, NULL }
911
};
912
913
#define PDCP_LTE_HEADER_NOT_PRESENT_STR "Header NOT present"
914
#define PDCP_LTE_HEADER_PRESENT_STR     "Header present"
915
#define PDCP_LTE_HEADER_NOT_PRESENT 0
916
0
#define PDCP_LTE_HEADER_PRESENT     1
917
918
static const value_string vs_header_present[] = {
919
    { 0, PDCP_LTE_HEADER_NOT_PRESENT_STR },
920
    { 1, PDCP_LTE_HEADER_PRESENT_STR },
921
    { 0, NULL }
922
};
923
924
925
#define MAC_I_PRESENT_FALSE_STR "MAC-I NOT present"
926
14
#define MAC_I_PRESENT_TRUE_STR  "MAC-I present"
927
static const value_string vs_mac_i_present[] = {
928
    { false, MAC_I_PRESENT_FALSE_STR },
929
    { true,  MAC_I_PRESENT_TRUE_STR },
930
    { 0, NULL }
931
};
932
933
14
#define SIGNALING_PLANE_STR "Signaling plane"
934
#define USER_PLANE_STR      "User plane"
935
static const value_string vs_pdcp_plane[] = {
936
    { NR_SIGNALING_PLANE, SIGNALING_PLANE_STR },
937
    { NR_USER_PLANE, USER_PLANE_STR },
938
    { 0, NULL }
939
};
940
941
static const value_string vs_pdcp_nr_sn_length[] = {
942
    { PDCP_NR_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR },
943
    { PDCP_NR_SN_LENGTH_18_BITS, "18 bits" },
944
    { 0, NULL }
945
};
946
947
14
#define ROHC_COMPRESSION_FALSE_STR "RoHC NOT compressed"
948
static const value_string vs_rohc_compression[] = {
949
    { false, ROHC_COMPRESSION_FALSE_STR },
950
    { true, "RoHC compressed" },
951
    { 0, NULL }
952
};
953
954
//#define ROHC_MODE_NOT_SET_STR "Mode not set"
955
//static const value_string vs_rohc_mode[] = {
956
//    { MODE_NOT_SET, ROHC_MODE_NOT_SET_STR },
957
//    { UNIDIRECTIONAL, "Unidirectional" },
958
//    { OPTIMISTIC_BIDIRECTIONAL, "Optimistic bidirectional" },
959
//    { RELIABLE_BIDIRECTIONAL, "Reliable bidirectional" },
960
//    { 0, NULL }
961
//};
962
963
#define ROHC_PROFILE_RTP_STR "RTP (1)"
964
14
#define ROHC_PROFILE_UNCOMPRESSED_STR "Uncompressed (0)"
965
static const value_string vs_rohc_profile[] = {
966
    { ROHC_PROFILE_UNCOMPRESSED, ROHC_PROFILE_UNCOMPRESSED_STR },
967
    { ROHC_PROFILE_RTP, ROHC_PROFILE_RTP_STR },
968
    { ROHC_PROFILE_UDP, "UDP (2)" },
969
    { ROHC_PROFILE_IP, "IP (4)" },
970
    { ROHC_PROFILE_UNKNOWN, "Unknown" },
971
    { 0, NULL }
972
};
973
974
/* Entries added by UAT */
975
static uat_t * pdcp_nr_keys_uat;
976
static unsigned num_pdcp_nr_keys_uat;
977
978
/* Default values for a TEID entry */
979
UAT_CSTRING_CB_DEF(pdcp_nr_users, ip_addr_str, uat_pdcp_nr_keys_record_t)
980
UAT_CSTRING_CB_DEF(pdcp_nr_users, teid_str, uat_pdcp_nr_keys_record_t)
981
UAT_VS_DEF(pdcp_nr_users, direction, uat_pdcp_nr_keys_record_t, unsigned, PDCP_NR_DIRECTION_UPLINK, PDCP_DIRECTION_UPLINK_STR)
982
UAT_VS_DEF(pdcp_nr_users, sdap_header_present, uat_pdcp_nr_keys_record_t, unsigned, PDCP_NR_SDAP_HEADER_NOT_PRESENT, PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR)
983
UAT_VS_DEF(pdcp_nr_users, mac_i_present, uat_pdcp_nr_keys_record_t, unsigned, false, MAC_I_PRESENT_FALSE_STR)
984
UAT_VS_DEF(pdcp_nr_users, plane, uat_pdcp_nr_keys_record_t, enum pdcp_nr_plane, NR_USER_PLANE, USER_PLANE_STR)
985
UAT_VS_DEF(pdcp_nr_users, pdcp_nr_sn_length, uat_pdcp_nr_keys_record_t, unsigned, PDCP_NR_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR)
986
UAT_VS_DEF(pdcp_nr_users, rohc_compression, uat_pdcp_nr_keys_record_t, unsigned, false, ROHC_COMPRESSION_FALSE_STR)
987
//UAT_VS_DEF(pdcp_nr_users, rohc_mode, uat_pdcp_nr_keys_record_t, unsigned, MODE_NOT_SET, ROHC_MODE_NOT_SET_STR)
988
UAT_VS_DEF(pdcp_nr_users, rohc_profile, uat_pdcp_nr_keys_record_t, unsigned, ROHC_PROFILE_UNCOMPRESSED, ROHC_PROFILE_UNCOMPRESSED_STR)
989
UAT_DEC_CB_DEF(pdcp_nr_users, ue_id, uat_pdcp_nr_keys_record_t)
990
UAT_DEC_CB_DEF(pdcp_nr_users, rb_id, uat_pdcp_nr_keys_record_t)
991
992
static uat_pdcp_nr_keys_record_t* look_up_pdcp_nr_keys_record(packet_info *pinfo, uint32_t teidn)
993
0
{
994
0
    unsigned int record_id;
995
996
    /* Look up UAT entries. N.B. linear search... */
997
0
    for (record_id = 0; record_id < num_pdcp_nr_keys_uat; record_id++) {
998
0
        if (addresses_equal(&uat_pdcp_nr_keys_records[record_id].ip_address, &pinfo->dst) &&
999
0
            (uat_pdcp_nr_keys_records[record_id].teid_wildcard ||
1000
0
             uat_pdcp_nr_keys_records[record_id].teid == teidn)) {
1001
0
            return &uat_pdcp_nr_keys_records[record_id];
1002
0
        }
1003
0
    }
1004
1005
    /* No match at all - return NULL */
1006
0
    return NULL;
1007
0
}
1008
1009
/* Entries added by UAT */
1010
static uat_t * pdcp_lte_keys_uat;
1011
static unsigned num_pdcp_lte_keys_uat;
1012
1013
/* Default values for a TEID entry */
1014
UAT_CSTRING_CB_DEF(pdcp_lte_users, ip_addr_str, uat_pdcp_lte_keys_record_t)
1015
UAT_CSTRING_CB_DEF(pdcp_lte_users, teid_str, uat_pdcp_lte_keys_record_t)
1016
UAT_VS_DEF(pdcp_lte_users, direction, uat_pdcp_lte_keys_record_t, unsigned, PDCP_NR_DIRECTION_UPLINK, PDCP_DIRECTION_UPLINK_STR)
1017
UAT_VS_DEF(pdcp_lte_users, header_present, uat_pdcp_lte_keys_record_t, unsigned, PDCP_LTE_HEADER_PRESENT, PDCP_LTE_HEADER_PRESENT_STR)
1018
UAT_VS_DEF(pdcp_lte_users, plane, uat_pdcp_lte_keys_record_t, enum pdcp_plane, USER_PLANE, USER_PLANE_STR)
1019
UAT_VS_DEF(pdcp_lte_users, lte_sn_length, uat_pdcp_lte_keys_record_t, unsigned, PDCP_NR_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR)
1020
UAT_VS_DEF(pdcp_lte_users, rohc_compression, uat_pdcp_lte_keys_record_t, unsigned, false, ROHC_COMPRESSION_FALSE_STR)
1021
//UAT_VS_DEF(pdcp_lte_users, rohc_mode, uat_pdcp_lte_keys_record_t, unsigned, MODE_NOT_SET, ROHC_MODE_NOT_SET_STR)
1022
UAT_VS_DEF(pdcp_lte_users, rohc_profile, uat_pdcp_lte_keys_record_t, unsigned, ROHC_PROFILE_UNCOMPRESSED, ROHC_PROFILE_UNCOMPRESSED_STR)
1023
UAT_DEC_CB_DEF(pdcp_lte_users, ue_id, uat_pdcp_lte_keys_record_t)
1024
UAT_DEC_CB_DEF(pdcp_lte_users, rb_id, uat_pdcp_lte_keys_record_t)
1025
1026
static uat_pdcp_lte_keys_record_t* look_up_pdcp_lte_keys_record(packet_info *pinfo, uint32_t teidn)
1027
0
{
1028
0
    unsigned int record_id;
1029
1030
    /* Look up UAT entries. N.B. linear search... */
1031
0
    for (record_id = 0; record_id < num_pdcp_lte_keys_uat; record_id++) {
1032
0
        if (addresses_equal(&uat_pdcp_lte_keys_records[record_id].ip_address, &pinfo->dst) &&
1033
0
            (uat_pdcp_lte_keys_records[record_id].teid_wildcard ||
1034
0
             uat_pdcp_lte_keys_records[record_id].teid == teidn)) {
1035
0
            return &uat_pdcp_lte_keys_records[record_id];
1036
0
        }
1037
0
    }
1038
1039
    /* No match at all - return NULL */
1040
0
    return NULL;
1041
0
}
1042
1043
/* --- END PDCP NR DECODE ADDITIONS --- */
1044
1045
static bool g_gtp_etsi_order;
1046
1047
static int dissect_tpdu_as = GTP_TPDU_AS_TPDU_HEUR;
1048
static const enum_val_t gtp_decode_tpdu_as[] = {
1049
    {"none", "None",   GTP_TPDU_AS_NONE},
1050
    {"heuristic", "TPDU Heuristic",   GTP_TPDU_AS_TPDU_HEUR},
1051
    {"pdcp-lte", "PDCP-LTE",   GTP_TPDU_AS_PDCP_LTE },
1052
    {"pdcp-nr", "PDCP-NR",   GTP_TPDU_AS_PDCP_NR },
1053
    {"sync", "SYNC",   GTP_TPDU_AS_SYNC},
1054
    {"eth", "ETHERNET",   GTP_TPDU_AS_ETHERNET},
1055
    {"custom", "Custom",   GTP_TPDU_AS_CUSTOM},
1056
    {NULL, NULL, 0}
1057
};
1058
1059
1060
static int gtp_tap;
1061
static int gtpv1_tap;
1062
1063
/* Definition of flags masks */
1064
28
#define GTP_VER_MASK 0xE0
1065
1066
static const true_false_string gtp_hdr_length_vals = {
1067
    "6-Octet Header",
1068
    "20-Octet Header"
1069
};
1070
1071
static const value_string ver_types[] = {
1072
    {0, "GTP release 97/98 version"},
1073
    {1, "GTP release 99 version"},
1074
    {2, "GTPv2-C"},
1075
    {3, "None"},
1076
    {4, "None"},
1077
    {5, "None"},
1078
    {6, "None"},
1079
    {7, "None"},
1080
    {0, NULL}
1081
};
1082
1083
static const value_string pt_types[] = {
1084
    {0, "GTP'"},
1085
    {1, "GTP"},
1086
    {0, NULL}
1087
};
1088
1089
14
#define GTP_PT_MASK         0x10
1090
14
#define GTP_SPARE1_MASK     0x0E
1091
14
#define GTP_SPARE2_MASK     0x08
1092
2.42k
#define GTP_E_MASK          0x04
1093
2.42k
#define GTP_S_MASK          0x02
1094
14
#define GTP_SNN_MASK        0x01
1095
2.42k
#define GTP_PN_MASK         0x01
1096
1097
#define GTP_EXT_HDR_NO_MORE_EXT_HDRS         0x00
1098
#define GTP_EXT_HDR_MBMS_SUPPORT_IND         0x01
1099
#define GTP_EXT_HDR_MS_INFO_CHG_REP_SUPP_IND 0x02
1100
#define GTP_EXT_HDR_LONG_PDCP_PDU_NUMBER     0x03 /* TS 29.281 (GTPv1-U)*/
1101
#define GTP_EXT_HDR_SERVICE_CLASS_INDICATOR  0x20 /* TS 29.281 (GTPv1-U)*/
1102
0
#define GTP_EXT_HDR_UDP_PORT                 0x40
1103
4
#define GTP_EXT_HDR_RAN_CONT                 0x81
1104
2
#define GTP_EXT_HDR_LONG_PDCP_PDU            0x82
1105
0
#define GTP_EXT_HDR_XW_RAN_CONT              0x83
1106
6
#define GTP_EXT_HDR_NR_RAN_CONT              0x84
1107
1
#define GTP_EXT_HDR_PDU_SESSION_CONT         0x85
1108
2
#define GTP_EXT_HDR_PDCP_SN                  0xC0
1109
2
#define GTP_EXT_HDR_SUSPEND_REQ              0xC1
1110
1
#define GTP_EXT_HDR_SUSPEND_RESP             0xC2
1111
1112
static const value_string next_extension_header_fieldvals[] = {
1113
    {GTP_EXT_HDR_NO_MORE_EXT_HDRS, "No more extension headers"},
1114
    {GTP_EXT_HDR_MBMS_SUPPORT_IND, "MBMS support indication"},
1115
    {GTP_EXT_HDR_MS_INFO_CHG_REP_SUPP_IND, "MS Info Change Reporting support indication"},
1116
    {GTP_EXT_HDR_LONG_PDCP_PDU_NUMBER, "Long PDCP PDU Number"},
1117
    {GTP_EXT_HDR_SERVICE_CLASS_INDICATOR, "Service Class Indicator"},
1118
    {GTP_EXT_HDR_UDP_PORT, "UDP Port number"},
1119
    {GTP_EXT_HDR_RAN_CONT,"RAN container"},
1120
    {GTP_EXT_HDR_LONG_PDCP_PDU,"Long PDCP PDU number"},
1121
    {GTP_EXT_HDR_XW_RAN_CONT,"Xw RAN container"},
1122
    {GTP_EXT_HDR_NR_RAN_CONT,"NR RAN container"},
1123
    {GTP_EXT_HDR_PDU_SESSION_CONT,"PDU Session container"},
1124
    {GTP_EXT_HDR_PDCP_SN, "PDCP PDU number"},
1125
    {GTP_EXT_HDR_SUSPEND_REQ, "Suspend Request"},
1126
    {GTP_EXT_HDR_SUSPEND_RESP, "Suspend Response"},
1127
    {0, NULL}
1128
};
1129
1130
/* Definition of 3G charging characteristics masks */
1131
14
#define GTP_MASK_CHRG_CHAR_S    0xF000
1132
14
#define GTP_MASK_CHRG_CHAR_N    0x0800
1133
14
#define GTP_MASK_CHRG_CHAR_P    0x0400
1134
14
#define GTP_MASK_CHRG_CHAR_F    0x0200
1135
14
#define GTP_MASK_CHRG_CHAR_H    0x0100
1136
14
#define GTP_MASK_CHRG_CHAR_R    0x00FF
1137
1138
/* Definition of GSN Address masks */
1139
14
#define GTP_EXT_GSN_ADDR_TYPE_MASK      0xC0
1140
14
#define GTP_EXT_GSN_ADDR_LEN_MASK       0x3F
1141
1142
/* Definition of QoS masks */
1143
766
#define GTP_EXT_QOS_SPARE1_MASK                 0xC0
1144
766
#define GTP_EXT_QOS_DELAY_MASK                  0x38
1145
766
#define GTP_EXT_QOS_RELIABILITY_MASK            0x07
1146
766
#define GTP_EXT_QOS_PEAK_MASK                   0xF0
1147
766
#define GTP_EXT_QOS_SPARE2_MASK                 0x08
1148
766
#define GTP_EXT_QOS_PRECEDENCE_MASK             0x07
1149
766
#define GTP_EXT_QOS_SPARE3_MASK                 0xE0
1150
766
#define GTP_EXT_QOS_MEAN_MASK                   0x1F
1151
410
#define GTP_EXT_QOS_TRAF_CLASS_MASK             0xE0
1152
410
#define GTP_EXT_QOS_DEL_ORDER_MASK              0x18
1153
410
#define GTP_EXT_QOS_DEL_ERR_SDU_MASK            0x07
1154
410
#define GTP_EXT_QOS_RES_BER_MASK                0xF0
1155
410
#define GTP_EXT_QOS_SDU_ERR_RATIO_MASK          0x0F
1156
410
#define GTP_EXT_QOS_TRANS_DELAY_MASK            0xFC
1157
410
#define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK    0x03
1158
388
#define GTP_EXT_QOS_SPARE4_MASK                 0xE0
1159
388
#define GTP_EXT_QOS_SIG_IND_MASK                0x10
1160
388
#define GTP_EXT_QOS_SRC_STAT_DESC_MASK          0x0F
1161
1162
/* Definition of Radio Priority's masks */
1163
14
#define GTPv1_EXT_RP_NSAPI_MASK         0xF0
1164
14
#define GTPv1_EXT_RP_SPARE_MASK         0x08
1165
14
#define GTPv1_EXT_RP_MASK               0x07
1166
1167
3
#define NR_UP_DL_USER_DATA                0
1168
0
#define NR_UP_DL_DATA_DELIVERY_STATUS     1
1169
1
#define NR_UP_ASSISTANCE_INFORMATION_DATA 2
1170
1171
static const value_string nr_pdu_type_cnst[] = {
1172
    {NR_UP_DL_USER_DATA,                "DL User Data"},
1173
    {NR_UP_DL_DATA_DELIVERY_STATUS,     "DL Data Delivery Status"},
1174
    {NR_UP_ASSISTANCE_INFORMATION_DATA, "Assistance Information Data"},
1175
    {0, NULL}
1176
};
1177
1178
static const range_string nr_up_cause_vals[] = {
1179
    {0,   0,     "Unknown"},
1180
    {1,   1,     "Radio Link Outage"},
1181
    {2,   2,     "Radio Link Resume"},
1182
    {3,   3,     "UL Radio Link Outage"},
1183
    {4,   4,     "DL Radio Link Outage"},
1184
    {5,   5,     "UL Radio Link Resume"},
1185
    {6,   6,     "DL Radio Link Resume"},
1186
    {7,   228,   "Reserved for future value extensions"},
1187
    {228, 255,   "Reserved for test purposes"},
1188
    {0,   0,     NULL}
1189
};
1190
1191
1192
static const true_false_string tfs_final_frame_indication = {
1193
    "Frame is final",
1194
    "Frame is not final"
1195
};
1196
1197
1198
static const value_string gtp_message_type[] = {
1199
    {GTP_MSG_UNKNOWN,             "For future use"},
1200
    {GTP_MSG_ECHO_REQ,            "Echo request"},
1201
    {GTP_MSG_ECHO_RESP,           "Echo response"},
1202
    {GTP_MSG_VER_NOT_SUPP,        "Version not supported"},
1203
    {GTP_MSG_NODE_ALIVE_REQ,      "Node alive request"},
1204
    {GTP_MSG_NODE_ALIVE_RESP,     "Node alive response"},
1205
    {GTP_MSG_REDIR_REQ,           "Redirection request"},
1206
    {GTP_MSG_REDIR_RESP,          "Redirection response"},
1207
    /*
1208
     * 8-15 For future use. Shall not be sent. If received,
1209
     * shall be treated as an Unknown message.
1210
     */
1211
#if 0
1212
    {   8,                              "Unknown message(For future use)"},
1213
    {   9,                              "Unknown message(For future use)"},
1214
    {  10,                              "Unknown message(For future use)"},
1215
    {  11,                              "Unknown message(For future use)"},
1216
    {  12,                              "Unknown message(For future use)"},
1217
    {  13,                              "Unknown message(For future use)"},
1218
    {  14,                              "Unknown message(For future use)"},
1219
    {  15,                              "Unknown message(For future use)"},
1220
#endif
1221
    {GTP_MSG_CREATE_PDP_REQ,            "Create PDP context request"},
1222
    {GTP_MSG_CREATE_PDP_RESP,           "Create PDP context response"},
1223
    {GTP_MSG_UPDATE_PDP_REQ,            "Update PDP context request"},
1224
    {GTP_MSG_UPDATE_PDP_RESP,           "Update PDP context response"},
1225
    {GTP_MSG_DELETE_PDP_REQ,            "Delete PDP context request"},
1226
    {GTP_MSG_DELETE_PDP_RESP,           "Delete PDP context response"},
1227
    {GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ,  "Initiate PDP Context Activation Request"},
1228
    {GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, "Initiate PDP Context Activation Response"},
1229
/*
1230
 * 24-25 For future use. Shall not be sent. If received,
1231
 * shall be treated as an Unknown message.
1232
 */
1233
    {GTP_MSG_DELETE_AA_PDP_REQ,   "Delete AA PDP Context Request"},
1234
    {GTP_MSG_DELETE_AA_PDP_RESP,  "Delete AA PDP Context Response"},
1235
    {GTP_MSG_ERR_IND,             "Error indication"},
1236
    {GTP_MSG_PDU_NOTIFY_REQ,      "PDU notification request"},
1237
    {GTP_MSG_PDU_NOTIFY_RESP,     "PDU notification response"},
1238
    {GTP_MSG_PDU_NOTIFY_REJ_REQ,  "PDU notification reject request"},
1239
    {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
1240
    {GTP_MSG_SUPP_EXT_HDR,        "Supported extension header notification"},
1241
    {GTP_MSG_SEND_ROUT_INFO_REQ,  "Send routing information for GPRS request"},
1242
    {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
1243
    {GTP_MSG_FAIL_REP_REQ,        "Failure report request"},
1244
    {GTP_MSG_FAIL_REP_RESP,       "Failure report response"},
1245
    {GTP_MSG_MS_PRESENT_REQ,      "Note MS GPRS present request"},
1246
    {GTP_MSG_MS_PRESENT_RESP,     "Note MS GPRS present response"},
1247
    /* 38-47 For future use. Shall not be sent. If received,
1248
     * shall be treated as an Unknown message.
1249
     */
1250
#if 0
1251
    {  38,                        "Unknown message(For future use)"},
1252
    {  39,                        "Unknown message(For future use)"},
1253
    {  40,                        "Unknown message(For future use)"},
1254
    {  41,                        "Unknown message(For future use)"},
1255
    {  42,                        "Unknown message(For future use)"},
1256
    {  43,                        "Unknown message(For future use)"},
1257
    {  44,                        "Unknown message(For future use)"},
1258
    {  45,                        "Unknown message(For future use)"},
1259
    {  46,                        "Unknown message(For future use)"},
1260
    {  47,                        "Unknown message(For future use)"},
1261
#endif
1262
    {GTP_MSG_IDENT_REQ,           "Identification request"},
1263
    {GTP_MSG_IDENT_RESP,          "Identification response"},
1264
    {GTP_MSG_SGSN_CNTXT_REQ,      "SGSN context request"},
1265
    {GTP_MSG_SGSN_CNTXT_RESP,     "SGSN context response"},
1266
    {GTP_MSG_SGSN_CNTXT_ACK,      "SGSN context acknowledgement"},
1267
    {GTP_MSG_FORW_RELOC_REQ,      "Forward relocation request"},
1268
    {GTP_MSG_FORW_RELOC_RESP,     "Forward relocation response"},
1269
    {GTP_MSG_FORW_RELOC_COMP,     "Forward relocation complete"},
1270
    {GTP_MSG_RELOC_CANCEL_REQ,    "Relocation cancel request"},
1271
    {GTP_MSG_RELOC_CANCEL_RESP,   "Relocation cancel response"},
1272
    {GTP_MSG_FORW_SRNS_CNTXT,     "Forward SRNS context"},
1273
    {GTP_MSG_FORW_RELOC_ACK,      "Forward relocation complete acknowledge"},
1274
    {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
1275
    {GTP_MSG_UE_REG_QUERY_REQ,    "UE Registration Query Request"},
1276
    {GTP_MSG_UE_REG_QUERY_RESP,   "UE Registration Query Response"},
1277
    /* 63-69 For future use. Shall not be sent. If received,
1278
     * shall be treated as an Unknown message.
1279
     */
1280
#if 0
1281
    {  63,                        "Unknown message(For future use)"},
1282
    {  64,                        "Unknown message(For future use)"},
1283
    {  65,                        "Unknown message(For future use)"},
1284
    {  66,                        "Unknown message(For future use)"},
1285
    {  67,                        "Unknown message(For future use)"},
1286
    {  68,                        "Unknown message(For future use)"},
1287
    {  69,                        "Unknown message(For future use)"},
1288
#endif
1289
    {GTP_MSG_RAN_INFO_RELAY,      "RAN Information Relay"},
1290
    /* 71-95 For future use. Shall not be sent. If received,
1291
     * shall be treated as an Unknown message.
1292
     */
1293
#if 0
1294
    {  71,                        "Unknown message(For future use)"},
1295
    {  72,                        "Unknown message(For future use)"},
1296
    {  73,                        "Unknown message(For future use)"},
1297
    {  74,                        "Unknown message(For future use)"},
1298
    {  75,                        "Unknown message(For future use)"},
1299
    {  76,                        "Unknown message(For future use)"},
1300
    {  77,                        "Unknown message(For future use)"},
1301
    {  78,                        "Unknown message(For future use)"},
1302
    {  79,                        "Unknown message(For future use)"},
1303
    {  80,                        "Unknown message(For future use)"},
1304
    {  81,                        "Unknown message(For future use)"},
1305
    {  82,                        "Unknown message(For future use)"},
1306
    {  83,                        "Unknown message(For future use)"},
1307
    {  84,                        "Unknown message(For future use)"},
1308
    {  85,                        "Unknown message(For future use)"},
1309
    {  86,                        "Unknown message(For future use)"},
1310
    {  87,                        "Unknown message(For future use)"},
1311
    {  88,                        "Unknown message(For future use)"},
1312
    {  89,                        "Unknown message(For future use)"},
1313
    {  90,                        "Unknown message(For future use)"},
1314
    {  91,                        "Unknown message(For future use)"},
1315
    {  92,                        "Unknown message(For future use)"},
1316
    {  93,                        "Unknown message(For future use)"},
1317
    {  94,                        "Unknown message(For future use)"},
1318
    {  95,                        "Unknown message(For future use)"},
1319
#endif
1320
    {GTP_MBMS_NOTIFY_REQ,         "MBMS Notification Request"},
1321
    {GTP_MBMS_NOTIFY_RES,         "MBMS Notification Response"},
1322
    {GTP_MBMS_NOTIFY_REJ_REQ,     "MBMS Notification Reject Request"},
1323
    {GTP_MBMS_NOTIFY_REJ_RES,     "MBMS Notification Reject Response"},
1324
    {GTP_CREATE_MBMS_CNTXT_REQ,   "Create MBMS Context Request"},
1325
    {GTP_CREATE_MBMS_CNTXT_RES,   "Create MBMS Context Response"},
1326
    {GTP_UPD_MBMS_CNTXT_REQ,      "Update MBMS Context Request"},
1327
    {GTP_UPD_MBMS_CNTXT_RES,      "Update MBMS Context Response"},
1328
    {GTP_DEL_MBMS_CNTXT_REQ,      "Delete MBMS Context Request"},
1329
    {GTP_DEL_MBMS_CNTXT_RES,      "Delete MBMS Context Response"},
1330
    /* 106 - 111 For future use. Shall not be sent. If received,
1331
     * shall be treated as an Unknown message.
1332
     */
1333
#if 0
1334
    {  106,                       "Unknown message(For future use)"},
1335
    {  107,                       "Unknown message(For future use)"},
1336
    {  108,                       "Unknown message(For future use)"},
1337
    {  109,                       "Unknown message(For future use)"},
1338
    {  110,                       "Unknown message(For future use)"},
1339
    {  111,                       "Unknown message(For future use)"},
1340
#endif
1341
    {GTP_MBMS_REG_REQ,            "MBMS Registration Request"},
1342
    {GTP_MBMS_REG_RES,            "MBMS Registration Response"},
1343
    {GTP_MBMS_DE_REG_REQ,         "MBMS De-Registration Request"},
1344
    {GTP_MBMS_DE_REG_RES,         "MBMS De-Registration Response"},
1345
    {GTP_MBMS_SES_START_REQ,      "MBMS Session Start Request"},
1346
    {GTP_MBMS_SES_START_RES,      "MBMS Session Start Response"},
1347
    {GTP_MBMS_SES_STOP_REQ,       "MBMS Session Stop Request"},
1348
    {GTP_MBMS_SES_STOP_RES,       "MBMS Session Stop Response"},
1349
    {GTP_MBMS_SES_UPD_REQ,        "MBMS Session Update Request"},
1350
    {GTP_MBMS_SES_UPD_RES,        "MBMS Session Update Response"},
1351
    /* 122-127 For future use. Shall not be sent.
1352
     * If received, shall be treated as an Unknown message.
1353
     */
1354
#if 0
1355
    {  122,                       "Unknown message(For future use)"},
1356
    {  123,                       "Unknown message(For future use)"},
1357
    {  124,                       "Unknown message(For future use)"},
1358
    {  125,                       "Unknown message(For future use)"},
1359
    {  126,                       "Unknown message(For future use)"},
1360
    {  127,                       "Unknown message(For future use)"},
1361
#endif
1362
    {GTP_MS_INFO_CNG_NOT_REQ,     "MS Info Change Notification Request"},
1363
    {GTP_MS_INFO_CNG_NOT_RES,     "MS Info Change Notification Response"},
1364
    /* 130-239 For future use. Shall not be sent. If received,
1365
     * shall be treated as an Unknown message.
1366
     */
1367
#if 0
1368
    {  130,                       "Unknown message(For future use)"},
1369
    {  131,                       "Unknown message(For future use)"},
1370
    {  132,                       "Unknown message(For future use)"},
1371
    {  133,                       "Unknown message(For future use)"},
1372
    {  134,                       "Unknown message(For future use)"},
1373
    {  135,                       "Unknown message(For future use)"},
1374
    {  136,                       "Unknown message(For future use)"},
1375
    {  137,                       "Unknown message(For future use)"},
1376
    {  138,                       "Unknown message(For future use)"},
1377
    {  139,                       "Unknown message(For future use)"},
1378
    {  140,                       "Unknown message(For future use)"},
1379
    {  141,                       "Unknown message(For future use)"},
1380
    {  142,                       "Unknown message(For future use)"},
1381
    {  143,                       "Unknown message(For future use)"},
1382
    {  144,                       "Unknown message(For future use)"},
1383
    {  145,                       "Unknown message(For future use)"},
1384
    {  146,                       "Unknown message(For future use)"},
1385
    {  147,                       "Unknown message(For future use)"},
1386
    {  148,                       "Unknown message(For future use)"},
1387
    {  149,                       "Unknown message(For future use)"},
1388
    {  150,                       "Unknown message(For future use)"},
1389
    {  151,                       "Unknown message(For future use)"},
1390
    {  152,                       "Unknown message(For future use)"},
1391
    {  153,                       "Unknown message(For future use)"},
1392
    {  154,                       "Unknown message(For future use)"},
1393
    {  155,                       "Unknown message(For future use)"},
1394
    {  156,                       "Unknown message(For future use)"},
1395
    {  157,                       "Unknown message(For future use)"},
1396
    {  158,                       "Unknown message(For future use)"},
1397
    {  159,                       "Unknown message(For future use)"},
1398
#endif
1399
    {GTP_MSG_DATA_TRANSF_REQ,     "Data record transfer request"},
1400
    {GTP_MSG_DATA_TRANSF_RESP,    "Data record transfer response"},
1401
    /* 242-253 For future use. Shall not be sent. If received,
1402
     * shall be treated as an Unknown message.
1403
     */
1404
#if 0
1405
    {  242,                       "Unknown message(For future use)"},
1406
    {  243,                       "Unknown message(For future use)"},
1407
    {  244,                       "Unknown message(For future use)"},
1408
    {  245,                       "Unknown message(For future use)"},
1409
    {  246,                       "Unknown message(For future use)"},
1410
    {  247,                       "Unknown message(For future use)"},
1411
    {  248,                       "Unknown message(For future use)"},
1412
    {  249,                       "Unknown message(For future use)"},
1413
    {  250,                       "Unknown message(For future use)"},
1414
    {  251,                       "Unknown message(For future use)"},
1415
    {  252,                       "Unknown message(For future use)"},
1416
    {  253,                       "Unknown message(For future use)"},
1417
#endif
1418
    {GTP_MSG_END_MARKER,          "End Marker"},
1419
    {GTP_MSG_TPDU,                "T-PDU"},
1420
    {0, NULL}
1421
};
1422
static value_string_ext gtp_message_type_ext = VALUE_STRING_EXT_INIT(gtp_message_type);
1423
1424
/* definitions of fields in extension header */
1425
#define GTP_EXT_CAUSE                 0x01
1426
#define GTP_EXT_IMSI                  0x02
1427
246
#define GTP_EXT_RAI                   0x03
1428
#define GTP_EXT_TLLI                  0x04
1429
#define GTP_EXT_PTMSI                 0x05
1430
#define GTP_EXT_QOS_GPRS              0x06
1431
#define GTP_EXT_REORDER               0x08
1432
60
#define GTP_EXT_AUTH_TRI              0x09
1433
#define GTP_EXT_MAP_CAUSE             0x0B
1434
#define GTP_EXT_PTMSI_SIG             0x0C
1435
#define GTP_EXT_MS_VALID              0x0D
1436
#define GTP_EXT_RECOVER               0x0E
1437
206
#define GTP_EXT_SEL_MODE              0x0F
1438
1439
#define GTP_EXT_16                    0x10
1440
#define GTP_EXT_FLOW_LABEL            0x10
1441
#define GTP_EXT_TEID                  0x10    /* 0xFF10 3G */
1442
1443
#define GTP_EXT_17                    0x11
1444
#define GTP_EXT_FLOW_SIG              0x11
1445
#define GTP_EXT_TEID_CP               0x11    /* 0xFF11 3G */
1446
1447
#define GTP_EXT_18                    0x12
1448
194
#define GTP_EXT_FLOW_II               0x12
1449
81
#define GTP_EXT_TEID_II               0x12    /* 0xFF12 3G */
1450
1451
#define GTP_EXT_19                    0x13    /* 19 TV Teardown Ind 7.7.16 */
1452
#define GTP_EXT_MS_REASON             0x13    /* same as 0x1D GTPv1_EXT_MS_REASON */
1453
#define GTP_EXT_TEAR_IND              0x13    /* 0xFF13 3G */
1454
1455
414
#define GTP_EXT_NSAPI                 0x14    /* 3G */
1456
253
#define GTP_EXT_RANAP_CAUSE           0x15    /* 3G */
1457
126
#define GTP_EXT_RAB_CNTXT             0x16    /* 3G */
1458
#define GTP_EXT_RP_SMS                0x17    /* 3G */
1459
#define GTP_EXT_RP                    0x18    /* 3G */
1460
62
#define GTP_EXT_PKT_FLOW_ID           0x19    /* 3G */
1461
306
#define GTP_EXT_CHRG_CHAR             0x1A    /* 3G */
1462
#define GTP_EXT_TRACE_REF             0x1B    /* 3G */
1463
#define GTP_EXT_TRACE_TYPE            0x1C    /* 3G */
1464
#define GTPv1_EXT_MS_REASON           0x1D    /* 3G 29 TV MS Not Reachable Reason 7.7.25A */
1465
/* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1466
#define GTP_EXT_TR_COMM               0x7E    /* charging */
1467
#define GTP_EXT_CHRG_ID               0x7F    /* 127 TV Charging ID 7.7.26 */
1468
40
#define GTP_EXT_USER_ADDR             0x80
1469
52
#define GTP_EXT_MM_CNTXT              0x81
1470
352
#define GTP_EXT_PDP_CNTXT             0x82
1471
18
#define GTP_EXT_APN                   0x83
1472
429
#define GTP_EXT_PROTO_CONF            0x84
1473
#define GTP_EXT_GSN_ADDR              0x85
1474
4
#define GTP_EXT_MSISDN                0x86
1475
#define GTP_EXT_QOS_UMTS              0x87    /* 3G */
1476
#define GTP_EXT_AUTH_QUI              0x88    /* 3G */
1477
#define GTP_EXT_TFT                   0x89    /* 3G */
1478
2
#define GTP_EXT_TARGET_ID             0x8A    /* 3G */
1479
6
#define GTP_EXT_UTRAN_CONT            0x8B    /* 3G */
1480
#define GTP_EXT_RAB_SETUP             0x8C    /* 3G */
1481
24
#define GTP_EXT_HDR_LIST              0x8D    /* 3G */
1482
1
#define GTP_EXT_TRIGGER_ID            0x8E    /* 3G   142 7.7.41 */
1483
4
#define GTP_EXT_OMC_ID                0x8F    /* 3G   143 TLV OMC Identity 7.7.42 */
1484
6
#define GTP_EXT_RAN_TR_CONT           0x90    /* 3G   144 TLV RAN Transparent Container 7.7.43 */
1485
8
#define GTP_EXT_PDP_CONT_PRIO         0x91    /* 3G   145 TLV PDP Context Prioritization 7.7.45 */
1486
22
#define GTP_EXT_ADD_RAB_SETUP_INF     0x92    /* 3G   146 TLV Additional RAB Setup Information 7.7.45A */
1487
4
#define GTP_EXT_SGSN_NO               0x93    /* 3G   147 TLV SGSN Number 7.7.47 */
1488
2
#define GTP_EXT_COMMON_FLGS           0x94    /* 3G   148 TLV Common Flags 7.7.48 */
1489
36
#define GTP_EXT_APN_RES               0x95    /* 3G   149 */
1490
26
#define GTP_EXT_RA_PRIO_LCS           0x96    /* 3G   150 TLV Radio Priority LCS 7.7.25B */
1491
10
#define GTP_EXT_RAT_TYPE              0x97    /* 3G   151 TLV RAT Type 7.7.50 */
1492
6
#define GTP_EXT_USR_LOC_INF           0x98    /* 3G   152 TLV User Location Information 7.7.51 */
1493
14
#define GTP_EXT_MS_TIME_ZONE          0x99    /* 3G   153 TLV MS Time Zone 7.7.52 */
1494
6
#define GTP_EXT_IMEISV                0x9A    /* 3G   154 TLV IMEI(SV) 7.7.53 */
1495
62
#define GTP_EXT_CAMEL_CHG_INF_CON     0x9B    /* 3G   155 TLV CAMEL Charging Information Container 7.7.54 */
1496
20
#define GTP_EXT_MBMS_UE_CTX           0x9C    /* 3G   156 TLV MBMS UE Context 7.7.55 */
1497
8
#define GTP_EXT_TMGI                  0x9D    /* 3G   157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
1498
34
#define GTP_EXT_RIM_RA                0x9E    /* 3G   158 TLV RIM Routing Address 7.7.57 */
1499
8
#define GTP_EXT_MBMS_PROT_CONF_OPT    0x9F    /* 3G   159 TLV MBMS Protocol Configuration Options 7.7.58 */
1500
28
#define GTP_EXT_MBMS_SA               0xA0    /* 3G   160 TLV MBMS Service Area 7.7.60 */
1501
4.19k
#define GTP_EXT_SRC_RNC_PDP_CTX_INF   0xA1    /* 3G   161 TLV Source RNC PDCP context info 7.7.61 */
1502
2
#define GTP_EXT_ADD_TRS_INF           0xA2    /* 3G   162 TLV Additional Trace Info 7.7.62 */
1503
16
#define GTP_EXT_HOP_COUNT             0xA3    /* 3G   163 TLV Hop Counter 7.7.63 */
1504
6
#define GTP_EXT_SEL_PLMN_ID           0xA4    /* 3G   164 TLV Selected PLMN ID 7.7.64 */
1505
24
#define GTP_EXT_MBMS_SES_ID           0xA5    /* 3G   165 TLV MBMS Session Identifier 7.7.65 */
1506
6
#define GTP_EXT_MBMS_2G_3G_IND        0xA6    /* 3G   166 TLV MBMS 2G/3G Indicator 7.7.66 */
1507
4
#define GTP_EXT_ENH_NSAPI             0xA7    /* 3G   167 TLV Enhanced NSAPI 7.7.67 */
1508
18
#define GTP_EXT_MBMS_SES_DUR          0xA8    /* 3G   168 TLV MBMS Session Duration 7.7.59 */
1509
98
#define GTP_EXT_ADD_MBMS_TRS_INF      0xA9    /* 3G   169 TLV Additional MBMS Trace Info 7.7.68 */
1510
12
#define GTP_EXT_MBMS_SES_ID_REP_NO    0xAA    /* 3G   170 TLV MBMS Session Identity Repetition Number 7.7.69 */
1511
8
#define GTP_EXT_MBMS_TIME_TO_DATA_TR  0xAB    /* 3G   171 TLV MBMS Time To Data Transfer 7.7.70 */
1512
2
#define GTP_EXT_PS_HO_REQ_CTX         0xAC    /* 3G   172 TLV PS Handover Request Context 7.7.71 */
1513
6
#define GTP_EXT_BSS_CONT              0xAD    /* 3G   173 TLV BSS Container 7.7.72 */
1514
12
#define GTP_EXT_CELL_ID               0xAE    /* 3G   174 TLV Cell Identification 7.7.73 */
1515
8
#define GTP_EXT_PDU_NO                0xAF    /* 3G   175 TLV PDU Numbers                               7.7.74 */
1516
6
#define GTP_EXT_BSSGP_CAUSE           0xB0    /* 3G   176 TLV BSSGP Cause                               7.7.75 */
1517
6
#define GTP_EXT_REQ_MBMS_BEARER_CAP   0xB1    /* 3G   177 TLV Required MBMS bearer capabilities         7.7.76 */
1518
6
#define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2    /* 3G   178 TLV RIM Routing Address Discriminator         7.7.77 */
1519
6
#define GTP_EXT_LIST_OF_SETUP_PFCS    0xB3    /* 3G   179 TLV List of set-up PFCs                       7.7.78 */
1520
100
#define GTP_EXT_PS_HANDOVER_XIP_PAR   0xB4    /* 3G   180 TLV PS Handover XID Parameters                7.7.79 */
1521
8
#define GTP_EXT_MS_INF_CHG_REP_ACT    0xB5    /* 3G   181 TLV MS Info Change Reporting Action           7.7.80 */
1522
8
#define GTP_EXT_DIRECT_TUNNEL_FLGS    0xB6    /* 3G   182 TLV Direct Tunnel Flags                       7.7.81 */
1523
10
#define GTP_EXT_CORRELATION_ID        0xB7    /* 3G   183 TLV Correlation-ID                            7.7.82 */
1524
2
#define GTP_EXT_BEARER_CONTROL_MODE   0xB8    /* 3G   184 TLV Bearer Control Mode                       7.7.83 */
1525
2
#define GTP_EXT_MBMS_FLOW_ID          0xB9    /* 3G   185 TLV MBMS Flow Identifier                      7.7.84 */
1526
4
#define GTP_EXT_MBMS_IP_MCAST_DIST    0xBA    /* 3G   186 TLV MBMS IP Multicast Distribution            7.7.85 */
1527
6
#define GTP_EXT_MBMS_DIST_ACK         0xBB    /* 3G   187 TLV MBMS Distribution Acknowledgement         7.7.86 */
1528
8
#define GTP_EXT_RELIABLE_IRAT_HO_INF  0xBC    /* 3G   188 TLV Reliable INTER RAT HANDOVER INFO          7.7.87 */
1529
6
#define GTP_EXT_RFSP_INDEX            0xBD    /* 3G   189 TLV RFSP Index                                7.7.88 */
1530
4
#define GTP_EXT_FQDN                  0xBE    /* 3G   190 TLV Fully Qualified Domain Name (FQDN)        7.7.90 */
1531
6
#define GTP_EXT_EVO_ALLO_RETE_P1      0xBF    /* 3G   191 TLV Evolved Allocation/Retention Priority I   7.7.91 */
1532
4
#define GTP_EXT_EVO_ALLO_RETE_P2      0xC0    /* 3G   192 TLV Evolved Allocation/Retention Priority II  7.7.92 */
1533
6
#define GTP_EXT_EXTENDED_COMMON_FLGS  0xC1    /* 3G   193 TLV Extended Common Flags                     7.7.93 */
1534
4
#define GTP_EXT_UCI                   0xC2    /* 3G   194 TLV User CSG Information (UCI)                7.7.94 */
1535
10
#define GTP_EXT_CSG_INF_REP_ACT       0xC3    /* 3G   195 TLV CSG Information Reporting Action          7.7.95 */
1536
4
#define GTP_EXT_CSG_ID                0xC4    /* 3G   196 TLV CSG ID                                    7.7.96 */
1537
4
#define GTP_EXT_CMI                   0xC5    /* 3G   197 TLV CSG Membership Indication (CMI)           7.7.97 */
1538
4
#define GTP_EXT_AMBR                  0xC6    /* 3G   198 TLV Aggregate Maximum Bit Rate (AMBR)         7.7.98 */
1539
10
#define GTP_EXT_UE_NETWORK_CAP        0xC7    /* 3G   199 TLV UE Network Capability                     7.7.99 */
1540
4
#define GTP_EXT_UE_AMBR               0xC8    /* 3G   200 TLV UE-AMBR                                   7.7.100 */
1541
6
#define GTP_EXT_APN_AMBR_WITH_NSAPI   0xC9    /* 3G   201 TLV APN-AMBR with NSAPI                       7.7.101 */
1542
6
#define GTP_EXT_GGSN_BACK_OFF_TIME    0xCA    /* 3G   202 TLV GGSN Back-Off Time                        7.7.102 */
1543
22
#define GTP_EXT_SIG_PRI_IND           0xCB    /* 3G   203 TLV Signalling Priority Indication            7.7.103 */
1544
8
#define GTP_EXT_SIG_PRI_IND_W_NSAPI   0xCC    /* 3G   204 TLV Signalling Priority Indication with NSAPI 7.7.104 */
1545
4
#define GTP_EXT_HIGHER_BR_16MB_FLG    0xCD    /* 3G   205 TLV Higher bitrates than 16 Mbps flag         7.7.105 */
1546
14
#define GTP_EXT_MAX_MBR_APN_AMBR      0xCE    /* 3G   206 TLV Max MBR/APN-AMBR                          7.7.106 */
1547
66
#define GTP_EXT_ADD_MM_CTX_SRVCC      0xCF    /* 3G   207 TLV Additional MM context for SRVCC           7.7.107 */
1548
0
#define GTP_EXT_ADD_FLGS_SRVCC        0xD0    /* 3G   208 TLV Additional flags for SRVCC                7.7.108 */
1549
4
#define GTP_EXT_STN_SR                0xD1    /* 3G   209 TLV STN-SR                                    7.7.109 */
1550
14
#define GTP_EXT_C_MSISDN              0xD2    /* 3G   210 TLV C-MSISDN                                  7.7.110 */
1551
22
#define GTP_EXT_EXT_RANAP_CAUSE       0xD3    /* 3G   211 TLV Extended RANAP Cause                      7.7.111 */
1552
6
#define GTP_EXT_ENODEB_ID             0xD4    /* 3G   212 TLV eNodeB ID                                 7.7.112 */
1553
8
#define GTP_EXT_SEL_MODE_W_NSAPI      0xD5    /* 3G   213 TLV Selection Mode with NSAPI                 7.7.113 */
1554
12
#define GTP_EXT_ULI_TIMESTAMP         0xD6    /* 3G   214 TLV ULI Timestamp                             7.7.114 */
1555
2
#define GTP_EXT_LHN_ID_W_SAPI         0xD7    /* 3G   215 TLV Local Home Network ID (LHN-ID) with NSAPI 7.7.115 */
1556
14
#define GTP_EXT_CN_OP_SEL_ENTITY      0xD8    /* 3G   216 TLV CN Operator Selection Entity              7.7.116 */
1557
6
#define GTP_EXT_UE_USAGE_TYPE         0xD9    /* 3G   217 TLV UE Usage Type                             7.7.117 */
1558
8
#define GTP_EXT_EXT_COMMON_FLGS_II    0xDA    /* 3G   218 TLV Extended Common Flags II                  7.7.118 */
1559
2
#define GTP_EXT_NODE_IDENTIFIER       0xDB    /* 3G   219 TLV Node Identifier                           7.7.119 */
1560
38
#define GTP_EXT_CIOT_OPT_SUP_IND      0xDC    /* 3G   220 TLV CIoT Optimizations Support Indication     7.7.120 */
1561
12
#define GTP_EXT_SCEF_PDN_CONNECTION   0xDD    /* 3G   221 TLV SCEF PDN Connection                       7.7.121 */
1562
8
#define GTP_EXT_IOV_UPDATES_COUNTER   0xDE    /* 3G   222 TLV IOV_updates counter                       7.7.122 */
1563
6
#define GTP_EXT_MAPPED_UE_USAGE_TYPE  0xDF    /* 3G   223 TLV Mapped UE Usage Type                      7.7.123 */
1564
6
#define GTP_EXT_UP_FUN_SEL_IND_FLAGS  0xE0    /* 3G   224 TLV UP Function Selection Indication Flags    7.7.124 */
1565
1566
1567
/*  225-238 TLV Spare. For future use.     */
1568
1569
/* 239-250  Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
1570
1571
#define GTP_EXT_C1                    0xC1
1572
#define GTP_EXT_C2                    0xC2
1573
#define GTP_EXT_REL_PACK              0xF9    /* charging */
1574
#define GTP_EXT_CAN_PACK              0xFA    /* charging */
1575
18
#define GTP_EXT_CHRG_ADDR             0xFB    /* 3G   251     TLV     Charging Gateway Address        7.7.44 */
1576
/* 252-254  Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
1577
25
#define GTP_EXT_DATA_REQ              0xFC    /* charging */
1578
#define GTP_EXT_DATA_RESP             0xFD    /* charging */
1579
#define GTP_EXT_NODE_ADDR             0xFE    /* charging */
1580
54
#define GTP_EXT_PRIV_EXT              0xFF
1581
1582
static const value_string gtp_val[] = {
1583
    {GTP_EXT_CAUSE,                 "Cause of operation"},
1584
    {GTP_EXT_IMSI,                  "IMSI"},
1585
    {GTP_EXT_RAI,                   "Routing Area Identity"},
1586
    {GTP_EXT_TLLI,                  "Temporary Logical Link Identity"},
1587
    {GTP_EXT_PTMSI,                 "Packet TMSI"},
1588
/*   6 */  {GTP_EXT_QOS_GPRS,       "Quality of Service"},
1589
/* 6-7 Spare */
1590
/*   8 */  {GTP_EXT_REORDER,        "Reorder required"},
1591
/*   9 */  {GTP_EXT_AUTH_TRI,       "Authentication triplets"},
1592
/* 10 Spare */
1593
/*  11 */  {GTP_EXT_MAP_CAUSE,      "MAP cause"},
1594
/*  12 */  {GTP_EXT_PTMSI_SIG,      "P-TMSI signature"},
1595
/*  13 */  {GTP_EXT_MS_VALID,       "MS validated"},
1596
/*  14 */  {GTP_EXT_RECOVER,        "Recovery"},
1597
/*  15 */  {GTP_EXT_SEL_MODE,       "Selection mode"},
1598
1599
/*  16 */  {GTP_EXT_16,             "Flow label data I"},
1600
/*  16 */  /* ??? {GTP_EXT_FLOW_LABEL,     "Flow label data I"}, */
1601
/*  16 */  /* ??? {GTP_EXT_TEID,           "Tunnel Endpoint Identifier Data I"}, */   /* 3G */
1602
1603
    {GTP_EXT_17,                    "Flow label signalling"},
1604
/* ???    {GTP_EXT_FLOW_SIG,              "Flow label signalling"}, */
1605
/* ???    {GTP_EXT_TEID_CP,               "Tunnel Endpoint Identifier Data Control Plane"}, */ /* 3G */
1606
1607
    {GTP_EXT_18,                    "Flow label data II"},
1608
/* ???    {GTP_EXT_FLOW_II,               "Flow label data II"}, */
1609
/* ???    {GTP_EXT_TEID_II,               "Tunnel Endpoint Identifier Data II"}, */   /* 3G */
1610
1611
    {GTP_EXT_19,                    "MS not reachable reason"},
1612
/* ???    {GTP_EXT_MS_REASON,             "MS not reachable reason"}, */
1613
/* ???    {GTP_EXT_TEAR_IND,              "Teardown ID"}, */ /* 3G */
1614
1615
    {GTP_EXT_NSAPI,                 "NSAPI"},   /* 3G */
1616
    {GTP_EXT_RANAP_CAUSE,           "RANAP cause"},   /* 3G */
1617
    {GTP_EXT_RAB_CNTXT,             "RAB context"}, /* 3G */
1618
    {GTP_EXT_RP_SMS,                "Radio Priority for MO SMS"},  /* 3G */
1619
    {GTP_EXT_RP,                    "Radio Priority"}, /* 3G */
1620
    {GTP_EXT_PKT_FLOW_ID,           "Packet Flow ID"},    /* 3G */
1621
    {GTP_EXT_CHRG_CHAR,             "Charging characteristics"},    /* 3G */
1622
    {GTP_EXT_TRACE_REF,             "Trace references"},    /* 3G */
1623
    {GTP_EXT_TRACE_TYPE,            "Trace type"}, /* 3G */
1624
/*  29 */  {GTPv1_EXT_MS_REASON,    "MS not reachable reason"},   /* 3G */
1625
/* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1626
/* 126 */  {GTP_EXT_TR_COMM,        "Packet transfer command"},   /* charging */
1627
/* 127 */  {GTP_EXT_CHRG_ID,        "Charging ID"},
1628
    {GTP_EXT_USER_ADDR,             "End user address"},
1629
    {GTP_EXT_MM_CNTXT,              "MM context"},
1630
    {GTP_EXT_PDP_CNTXT,             "PDP context"},
1631
    {GTP_EXT_APN,                   "Access Point Name"},
1632
    {GTP_EXT_PROTO_CONF,            "Protocol configuration options"},
1633
    {GTP_EXT_GSN_ADDR,              "GSN address"},
1634
    {GTP_EXT_MSISDN,                "MS international PSTN/ISDN number"},
1635
    {GTP_EXT_QOS_UMTS,              "Quality of service (UMTS)"},    /* 3G */
1636
    {GTP_EXT_AUTH_QUI,              "Authentication quintuplets"},   /* 3G */
1637
    {GTP_EXT_TFT,                   "Traffic Flow Template (TFT)"},   /* 3G */
1638
    {GTP_EXT_TARGET_ID,             "Target (RNC) identification"}, /* 3G */
1639
    {GTP_EXT_UTRAN_CONT,            "UTRAN transparent field"},    /* 3G */
1640
    {GTP_EXT_RAB_SETUP,             "RAB setup information"},   /* 3G */
1641
    {GTP_EXT_HDR_LIST,              "Extension Header Types List"},  /* 3G */
1642
    {GTP_EXT_TRIGGER_ID,            "Trigger Id"}, /* 3G */
1643
    {GTP_EXT_OMC_ID,                "OMC Identity"},   /* 3G */
1644
1645
    {GTP_EXT_RAN_TR_CONT,           "RAN Transparent Container"}, /* 7.7.43 */
1646
    {GTP_EXT_PDP_CONT_PRIO,         "PDP Context Prioritization"},  /* 7.7.45 */
1647
    {GTP_EXT_ADD_RAB_SETUP_INF,     "Additional RAB Setup Information"},    /* 7.7.45A */
1648
    {GTP_EXT_SGSN_NO,               "SGSN Number"},   /* 7.7.47 */
1649
    {GTP_EXT_COMMON_FLGS,           "Common Flags"},  /* 7.7.48 */
1650
    {GTP_EXT_APN_RES,               "APN Restriction"},   /* 3G */
1651
    {GTP_EXT_RA_PRIO_LCS,           "Radio Priority LCS"},    /* 7.7.25B */
1652
    {GTP_EXT_RAT_TYPE,              "RAT Type"}, /* 3G */
1653
    {GTP_EXT_USR_LOC_INF,           "User Location Information"}, /* 7.7.51 */
1654
    {GTP_EXT_MS_TIME_ZONE,          "MS Time Zone"}, /* 7.7.52 */
1655
1656
    {GTP_EXT_IMEISV,                "IMEI(SV)"},   /* 3G */
1657
    {GTP_EXT_CAMEL_CHG_INF_CON,     "CAMEL Charging Information Container"},    /* 7.7.54 */
1658
    {GTP_EXT_MBMS_UE_CTX,           "MBMS UE Context"},   /* 7.7.55 */
1659
    {GTP_EXT_TMGI,                  "Temporary Mobile Group Identity (TMGI)"},   /* 7.7.56 */
1660
    {GTP_EXT_RIM_RA,                "RIM Routing Address"},    /* 7.7.57 */
1661
    {GTP_EXT_MBMS_PROT_CONF_OPT,    "MBMS Protocol Configuration Options"},    /* 7.7.58 */
1662
    {GTP_EXT_MBMS_SA,               "MBMS Service Area"}, /* 7.7.60 */
1663
    {GTP_EXT_SRC_RNC_PDP_CTX_INF,   "Source RNC PDCP context info"},  /* 7.7.61 */
1664
    {GTP_EXT_ADD_TRS_INF,           "Additional Trace Info"}, /* 7.7.62 */
1665
    {GTP_EXT_HOP_COUNT,             "Hop Counter"}, /* 7.7.63 */
1666
    {GTP_EXT_SEL_PLMN_ID,           "Selected PLMN ID"},  /* 7.7.64 */
1667
    {GTP_EXT_MBMS_SES_ID,           "MBMS Session Identifier"},   /* 7.7.65 */
1668
    {GTP_EXT_MBMS_2G_3G_IND,        "MBMS 2G/3G Indicator"},   /* 7.7.66 */
1669
    {GTP_EXT_ENH_NSAPI,             "Enhanced NSAPI"},  /* 7.7.67 */
1670
    {GTP_EXT_MBMS_SES_DUR,          "MBMS Session Duration"},    /* 7.7.59 */
1671
    {GTP_EXT_ADD_MBMS_TRS_INF,      "Additional MBMS Trace Info"},   /* 7.7.68 */
1672
    {GTP_EXT_MBMS_SES_ID_REP_NO,    "MBMS Session Identity Repetition Number"},    /* 7.7.69 */
1673
    {GTP_EXT_MBMS_TIME_TO_DATA_TR,  "MBMS Time To Data Transfer"},   /* 7.7.70 */
1674
    {GTP_EXT_PS_HO_REQ_CTX,         "PS Handover Request Context"}, /* 7.7.71 */
1675
    {GTP_EXT_BSS_CONT,              "BSS Container"},    /* 7.7.72 */
1676
    {GTP_EXT_CELL_ID,               "Cell Identification"},   /* 7.7.73 */
1677
    {GTP_EXT_PDU_NO,                "PDU Numbers"},    /* 7.7.74 */
1678
    {GTP_EXT_BSSGP_CAUSE,           "BSSGP Cause"},   /* 7.7.75 */
1679
    {GTP_EXT_REQ_MBMS_BEARER_CAP,   "Required MBMS bearer capabilities"}, /* 7.7.76 */
1680
    {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"},   /* 7.7.77 */
1681
    {GTP_EXT_LIST_OF_SETUP_PFCS,    "List of set-up PFCs"},    /* 7.7.78 */
1682
/* 180 */  {GTP_EXT_PS_HANDOVER_XIP_PAR, "  PS Handover XID Parameters"},                  /* 7.7.79 */
1683
/* 181 */  {GTP_EXT_MS_INF_CHG_REP_ACT,     "MS Info Change Reporting Action"},            /* 7.7.80 */
1684
/* 182 */  {GTP_EXT_DIRECT_TUNNEL_FLGS,     "Direct Tunnel Flags"},                        /* 7.7.81 */
1685
/* 183 */  {GTP_EXT_CORRELATION_ID,         "Correlation-ID"},                             /* 7.7.82 */
1686
/* 184 */  {GTP_EXT_BEARER_CONTROL_MODE,    "Bearer Control Mode"},                        /* 7.7.83 */
1687
/* 185 */  {GTP_EXT_MBMS_FLOW_ID,           "MBMS Flow Identifier"},                       /* 7.7.84 */
1688
/* 186 */  {GTP_EXT_MBMS_IP_MCAST_DIST,     "MBMS IP Multicast Distribution"},             /* 7.7.85 */
1689
/* 187 */  {GTP_EXT_MBMS_DIST_ACK,          "MBMS Distribution Acknowledgement"},          /* 7.7.86 */
1690
/* 188 */  {GTP_EXT_RELIABLE_IRAT_HO_INF,   "Reliable INTER RAT HANDOVER INFO"},           /* 7.7.87 */
1691
/* 189 */  {GTP_EXT_RFSP_INDEX,             "RFSP Index"},                                 /* 7.7.88 */
1692
/* 190 */  {GTP_EXT_FQDN,                   "Fully Qualified Domain Name (FQDN)"},         /* 7.7.90 */
1693
/* 191 */  {GTP_EXT_EVO_ALLO_RETE_P1,       "Evolved Allocation/Retention Priority I"},    /* 7.7.91 */
1694
/* 192 */  {GTP_EXT_EVO_ALLO_RETE_P2,       "Evolved Allocation/Retention Priority II"},   /* 7.7.92 */
1695
/* 193 */  {GTP_EXT_EXTENDED_COMMON_FLGS,   "Extended Common Flags"},                      /* 7.7.93 */
1696
/* 194 */  {GTP_EXT_UCI,                    "User CSG Information (UCI)"},                 /* 7.7.94 */
1697
/* 195 */  {GTP_EXT_CSG_INF_REP_ACT,        "CSG Information Reporting Action"},           /* 7.7.95 */
1698
/* 196 */  {GTP_EXT_CSG_ID,                 "CSG ID"},                                     /* 7.7.96 */
1699
/* 197 */  {GTP_EXT_CMI,                    "CSG Membership Indication (CMI)"},            /* 7.7.97 */
1700
/* 198 */  {GTP_EXT_AMBR,                   "Aggregate Maximum Bit Rate (AMBR)"},          /* 7.7.98 */
1701
/* 199 */  {GTP_EXT_UE_NETWORK_CAP,         "UE Network Capability"},                      /* 7.7.99 */
1702
/* 200 */  {GTP_EXT_UE_AMBR,                "UE-AMBR"},                                    /* 7.7.100 */
1703
/* 201 */  {GTP_EXT_APN_AMBR_WITH_NSAPI,    "APN-AMBR with NSAPI"},                        /* 7.7.101 */
1704
/* 202 */  {GTP_EXT_GGSN_BACK_OFF_TIME,     "GGSN Back-Off Time"},                         /* 7.7.102 */
1705
/* 203 */  {GTP_EXT_SIG_PRI_IND,            "Signalling Priority Indication"},             /* 7.7.103 */
1706
/* 204 */  {GTP_EXT_SIG_PRI_IND_W_NSAPI,    "Signalling Priority Indication with NSAPI"},  /* 7.7.104 */
1707
/* 205 */  {GTP_EXT_HIGHER_BR_16MB_FLG,     "Higher bitrates than 16 Mbps flag"},          /* 7.7.105 */
1708
/* 206 */  {GTP_EXT_MAX_MBR_APN_AMBR,       "Max MBR/APN-AMBR"},                           /* 7.7.106 */
1709
/* 207 */  {GTP_EXT_ADD_MM_CTX_SRVCC,       "Additional MM context for SRVCC"},            /* 7.7.107 */
1710
/* 208 */  {GTP_EXT_ADD_FLGS_SRVCC,         "Additional flags for SRVCC"},                 /* 7.7.108 */
1711
/* 209 */  {GTP_EXT_STN_SR,                 "STN-SR"},                                     /* 7.7.109 */
1712
/* 210 */  {GTP_EXT_C_MSISDN,               "C-MSISDN"},                                   /* 7.7.110 */
1713
/* 211 */  {GTP_EXT_EXT_RANAP_CAUSE,        "Extended RANAP Cause"},                       /* 7.7.111 */
1714
/* 212 */  {GTP_EXT_ENODEB_ID,              "eNodeB ID" },                                 /* 7.7.112 */
1715
/* 213 */  {GTP_EXT_SEL_MODE_W_NSAPI,       "Selection Mode with NSAPI" },                 /* 7.7.113 */
1716
/* 214 */  {GTP_EXT_ULI_TIMESTAMP,          "ULI Timestamp" },                             /* 7.7.114 */
1717
/* 215 */  {GTP_EXT_LHN_ID_W_SAPI,          "Local Home Network ID (LHN-ID) with NSAPI" }, /* 7.7.115 */
1718
/* 216 */  {GTP_EXT_CN_OP_SEL_ENTITY,       "Operator Selection Entity" },                 /* 7.7.116 */
1719
/* 217 */  {GTP_EXT_UE_USAGE_TYPE,          "UE Usage Type" },                             /* 7.7.117 */
1720
/* 218 */  {GTP_EXT_EXT_COMMON_FLGS_II,     "Extended Common Flags II"},                   /* 7.7.118 */
1721
/* 219 */  {GTP_EXT_NODE_IDENTIFIER,        "Node Identifier" },                           /* 7.7.119 */
1722
/* 220 */  {GTP_EXT_CIOT_OPT_SUP_IND,       "CIoT Optimizations Support Indication" },     /* 7.7.120 */
1723
/* 221 */  {GTP_EXT_SCEF_PDN_CONNECTION,    "SCEF PDN Connection" },                       /* 7.7.121 */
1724
/* 222 */  {GTP_EXT_IOV_UPDATES_COUNTER,    "IOV_updates counter" },                       /* 7.7.122 */
1725
/* 223 */  {GTP_EXT_MAPPED_UE_USAGE_TYPE,   "Mapped UE Usage Type" },                      /* 7.7.123 */
1726
/* 224 */  {GTP_EXT_UP_FUN_SEL_IND_FLAGS,   "UP Function Selection Indication Flags" },    /* 7.7.124 */
1727
1728
1729
/* 225-238 TLV Spare. For future use. */
1730
/* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1731
/* 249 */  {GTP_EXT_REL_PACK,  "Sequence numbers of released packets IE"},  /* charging */
1732
/* 250 */  {GTP_EXT_CAN_PACK,  "Sequence numbers of canceled packets IE"},  /* charging */
1733
/* 251 */  {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},                 /* 7.7.44 */
1734
/* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1735
/* 252 */  {GTP_EXT_DATA_REQ,  "Data record packet"},                       /* charging */
1736
/* 253 */  {GTP_EXT_DATA_RESP, "Requests responded"},                       /* charging */
1737
/* 254 */  {GTP_EXT_NODE_ADDR, "Address of recommended node"},              /* charging */
1738
/* 255 */  {GTP_EXT_PRIV_EXT,  "Private Extension"},
1739
    {0, NULL}
1740
};
1741
static value_string_ext gtp_val_ext = VALUE_STRING_EXT_INIT(gtp_val);
1742
1743
/* It seems like some IE's are renamed in gtpv1 at least reading
1744
 * 3GPP TS 29.060 version 6.11.0 Release 6
1745
 */
1746
static const value_string gtpv1_val[] = {
1747
/*   1 */  {GTP_EXT_CAUSE,                 "Cause of operation"},
1748
/*   2 */  {GTP_EXT_IMSI,                  "IMSI"},
1749
/*   3 */  {GTP_EXT_RAI,                   "Routing Area Identity"},
1750
/*   4 */  {GTP_EXT_TLLI,                  "Temporary Logical Link Identity"},
1751
/*   5 */  {GTP_EXT_PTMSI,                 "Packet TMSI"},
1752
/*   6 */  {GTP_EXT_QOS_GPRS,              "Quality of Service"},
1753
/* 6-7 Spare */
1754
/*   7 */  {7,                             "Spare"},
1755
/*   8 */  {GTP_EXT_REORDER,               "Reorder required"},
1756
/*   9 */  {GTP_EXT_AUTH_TRI,              "Authentication triplets"},
1757
/* 10 Spare */
1758
/*  10 */  {10,                            "Spare"},
1759
/*  11 */  {GTP_EXT_MAP_CAUSE,             "MAP cause"},
1760
/*  12 */  {GTP_EXT_PTMSI_SIG,             "P-TMSI signature"},
1761
/*  13 */  {GTP_EXT_MS_VALID,              "MS validated"},
1762
/*  14 */  {GTP_EXT_RECOVER,               "Recovery"},
1763
/*  15 */  {GTP_EXT_SEL_MODE,              "Selection mode"},
1764
/*  16 */  {GTP_EXT_TEID,                  "Tunnel Endpoint Identifier Data I"},              /* 3G */
1765
/*  17 */  {GTP_EXT_TEID_CP,               "Tunnel Endpoint Identifier Data Control Plane"},  /* 3G */
1766
/*  18 */  {GTP_EXT_TEID_II,               "Tunnel Endpoint Identifier Data II"},             /* 3G */
1767
/*  19 */  {GTP_EXT_TEAR_IND,              "Teardown ID"},                                    /* 3G */
1768
1769
/*  20 */  {GTP_EXT_NSAPI,                 "NSAPI"},                                          /* 3G */
1770
/*  21 */  {GTP_EXT_RANAP_CAUSE,           "RANAP cause"},                                    /* 3G */
1771
/*  22 */  {GTP_EXT_RAB_CNTXT,             "RAB context"},                                    /* 3G */
1772
/*  23 */  {GTP_EXT_RP_SMS,                "Radio Priority for MO SMS"},                      /* 3G */
1773
/*  24 */  {GTP_EXT_RP,                    "Radio Priority"},                                 /* 3G */
1774
/*  25 */  {GTP_EXT_PKT_FLOW_ID,           "Packet Flow ID"},                                 /* 3G */
1775
/*  26 */  {GTP_EXT_CHRG_CHAR,             "Charging characteristics"},                       /* 3G */
1776
/*  27 */  {GTP_EXT_TRACE_REF,             "Trace references"},                               /* 3G */
1777
/*  28 */  {GTP_EXT_TRACE_TYPE,            "Trace type"},                                     /* 3G */
1778
/*  29 */  {GTPv1_EXT_MS_REASON,           "MS not reachable reason"},                        /* 3G */
1779
/* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1780
/* 126 */  {GTP_EXT_TR_COMM,               "Packet transfer command"},                        /* charging */
1781
/* 127 */  {GTP_EXT_CHRG_ID,               "Charging ID"},
1782
1783
/* 128 */  {GTP_EXT_USER_ADDR,             "End user address"},
1784
/* 129 */  {GTP_EXT_MM_CNTXT,              "MM context"},
1785
/* 130 */  {GTP_EXT_PDP_CNTXT,             "PDP context"},
1786
/* 131 */  {GTP_EXT_APN,                   "Access Point Name"},
1787
/* 132 */  {GTP_EXT_PROTO_CONF,            "Protocol configuration options"},
1788
/* 133 */  {GTP_EXT_GSN_ADDR,              "GSN address"},
1789
/* 134 */  {GTP_EXT_MSISDN,                "MS international PSTN/ISDN number"},
1790
/* 135 */  {GTP_EXT_QOS_UMTS,              "Quality of service (UMTS)"},                      /* 3G */
1791
/* 136 */  {GTP_EXT_AUTH_QUI,              "Authentication quintuplets"},                     /* 3G */
1792
/* 137 */  {GTP_EXT_TFT,                   "Traffic Flow Template (TFT)"},                    /* 3G */
1793
/* 138 */  {GTP_EXT_TARGET_ID,             "Target (RNC) identification"},                    /* 3G */
1794
/* 139 */  {GTP_EXT_UTRAN_CONT,            "UTRAN transparent field"},                        /* 3G */
1795
/* 140 */  {GTP_EXT_RAB_SETUP,             "RAB setup information"},                          /* 3G */
1796
/* 141 */  {GTP_EXT_HDR_LIST,              "Extension Header Types List"},                    /* 3G */
1797
/* 142 */  {GTP_EXT_TRIGGER_ID,            "Trigger Id"},                                     /* 3G */
1798
/* 143 */  {GTP_EXT_OMC_ID,                "OMC Identity"},                                   /* 3G */
1799
/* 144 */  {GTP_EXT_RAN_TR_CONT,           "RAN Transparent Container"},                      /* 7.7.43 */
1800
/* 145 */  {GTP_EXT_PDP_CONT_PRIO,         "PDP Context Prioritization"},                     /* 7.7.45 */
1801
/* 146 */  {GTP_EXT_ADD_RAB_SETUP_INF,     "Additional RAB Setup Information"},               /* 7.7.45A */
1802
/* 147 */  {GTP_EXT_SGSN_NO,               "SGSN Number"},                                    /* 7.7.47 */
1803
/* 148 */  {GTP_EXT_COMMON_FLGS,           "Common Flags"},                                   /* 7.7.48 */
1804
/* 149 */  {GTP_EXT_APN_RES,               "APN Restriction"},                                /* 3G */
1805
/* 150 */  {GTP_EXT_RA_PRIO_LCS,           "Radio Priority LCS"},                             /* 7.7.25B */
1806
/* 151 */  {GTP_EXT_RAT_TYPE,              "RAT Type"},                                       /* 3G */
1807
/* 152 */  {GTP_EXT_USR_LOC_INF,           "User Location Information"},                      /* 7.7.51 */
1808
/* 153 */  {GTP_EXT_MS_TIME_ZONE,          "MS Time Zone"},                                   /* 7.7.52 */
1809
1810
/* 154 */  {GTP_EXT_IMEISV,                "IMEI(SV)"},                                       /* 3G */
1811
/* 155 */  {GTP_EXT_CAMEL_CHG_INF_CON,     "CAMEL Charging Information Container"},           /* 7.7.54 */
1812
/* 156 */  {GTP_EXT_MBMS_UE_CTX,           "MBMS UE Context"},                                /* 7.7.55 */
1813
/* 157 */  {GTP_EXT_TMGI,                  "Temporary Mobile Group Identity (TMGI)"},         /* 7.7.56 */
1814
/* 158 */  {GTP_EXT_RIM_RA,                "RIM Routing Address"},                            /* 7.7.57 */
1815
/* 159 */  {GTP_EXT_MBMS_PROT_CONF_OPT,    "MBMS Protocol Configuration Options"},            /* 7.7.58 */
1816
/* 160 */  {GTP_EXT_MBMS_SA,               "MBMS Service Area"},                              /* 7.7.60 */
1817
/* 161 */  {GTP_EXT_SRC_RNC_PDP_CTX_INF,   "Source RNC PDCP context info"},                   /* 7.7.61 */
1818
/* 162 */  {GTP_EXT_ADD_TRS_INF,           "Additional Trace Info"},                          /* 7.7.62 */
1819
/* 163 */  {GTP_EXT_HOP_COUNT,             "Hop Counter"},                                    /* 7.7.63 */
1820
/* 164 */  {GTP_EXT_SEL_PLMN_ID,           "Selected PLMN ID"},                               /* 7.7.64 */
1821
/* 165 */  {GTP_EXT_MBMS_SES_ID,           "MBMS Session Identifier"},                        /* 7.7.65 */
1822
/* 166 */  {GTP_EXT_MBMS_2G_3G_IND,        "MBMS 2G/3G Indicator"},                           /* 7.7.66 */
1823
/* 167 */  {GTP_EXT_ENH_NSAPI,             "Enhanced NSAPI"},                                 /* 7.7.67 */
1824
/* 168 */  {GTP_EXT_MBMS_SES_DUR,          "MBMS Session Duration"},                          /* 7.7.59 */
1825
/* 169 */  {GTP_EXT_ADD_MBMS_TRS_INF,      "Additional MBMS Trace Info"},                     /* 7.7.68 */
1826
/* 170 */  {GTP_EXT_MBMS_SES_ID_REP_NO,    "MBMS Session Identity Repetition Number"},        /* 7.7.69 */
1827
/* 171 */  {GTP_EXT_MBMS_TIME_TO_DATA_TR,  "MBMS Time To Data Transfer"},                     /* 7.7.70 */
1828
/* 172 */  {GTP_EXT_PS_HO_REQ_CTX,         "PS Handover Request Context"},                    /* 7.7.71 */
1829
/* 173 */  {GTP_EXT_BSS_CONT,              "BSS Container"},                                  /* 7.7.72 */
1830
/* 174 */  {GTP_EXT_CELL_ID,               "Cell Identification"},                            /* 7.7.73 */
1831
/* 175 */  {GTP_EXT_PDU_NO,                "PDU Numbers"},                                    /* 7.7.74 */
1832
/* 176 */  {GTP_EXT_BSSGP_CAUSE,           "BSSGP Cause"},                                    /* 7.7.75 */
1833
1834
/* 177 */  {GTP_EXT_REQ_MBMS_BEARER_CAP,   "Required MBMS bearer capabilities"},              /* 7.7.76 */
1835
/* 178 */  {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"},              /* 7.7.77 */
1836
/* 179 */  {GTP_EXT_LIST_OF_SETUP_PFCS,    "List of set-up PFCs"},                            /* 7.7.78 */
1837
/* 180 */  {GTP_EXT_PS_HANDOVER_XIP_PAR,   "PS Handover XID Parameters"},                     /* 7.7.79 */
1838
/* 181 */  {GTP_EXT_MS_INF_CHG_REP_ACT,    "MS Info Change Reporting Action"},                /* 7.7.80 */
1839
/* 182 */  {GTP_EXT_DIRECT_TUNNEL_FLGS,    "Direct Tunnel Flags"},                            /* 7.7.81 */
1840
/* 183 */  {GTP_EXT_CORRELATION_ID,        "Correlation-ID"},                                 /* 7.7.82 */
1841
/* 184 */  {GTP_EXT_BEARER_CONTROL_MODE,   "Bearer Control Mode"},                            /* 7.7.83 */
1842
/* 185 */  {GTP_EXT_MBMS_FLOW_ID,          "MBMS Flow Identifier"},                           /* 7.7.84 */
1843
/* 186 */  {GTP_EXT_MBMS_IP_MCAST_DIST,    "MBMS IP Multicast Distribution"},                 /* 7.7.85 */
1844
/* 187 */  {GTP_EXT_MBMS_DIST_ACK,         "MBMS Distribution Acknowledgement"},              /* 7.7.86 */
1845
/* 188 */  {GTP_EXT_RELIABLE_IRAT_HO_INF,  "Reliable INTER RAT HANDOVER INFO"},               /* 7.7.87 */
1846
/* 190 */  {GTP_EXT_RFSP_INDEX,            "RFSP Index"},                                     /* 7.7.88 */
1847
/* 190 */  {GTP_EXT_FQDN,                  "Fully Qualified Domain Name (FQDN)"},             /* 7.7.90 */
1848
/* 191 */  {GTP_EXT_EVO_ALLO_RETE_P1,      "Evolved Allocation/Retention Priority I"},        /* 7.7.91 */
1849
/* 192 */  {GTP_EXT_EVO_ALLO_RETE_P2,      "Evolved Allocation/Retention Priority II"},       /* 7.7.92 */
1850
/* 193 */  {GTP_EXT_EXTENDED_COMMON_FLGS,  "Extended Common Flags"},                          /* 7.7.93 */
1851
/* 194 */  {GTP_EXT_UCI,                   "User CSG Information (UCI)"},                     /* 7.7.94 */
1852
/* 195 */  {GTP_EXT_CSG_INF_REP_ACT,       "CSG Information Reporting Action"},               /* 7.7.95 */
1853
/* 196 */  {GTP_EXT_CSG_ID,                "CSG ID"},                                         /* 7.7.96 */
1854
/* 197 */  {GTP_EXT_CMI,                   "CSG Membership Indication (CMI)"},                /* 7.7.97 */
1855
/* 198 */  {198,                           "Aggregate Maximum Bit Rate (AMBR)"},              /* 7.7.98 */
1856
/* 199 */  {199,                           "UE Network Capability"},                          /* 7.7.99 */
1857
/* 200 */  {200,                           "UE-AMBR"},                                        /* 7.7.100 */
1858
/* 201 */  {201,                           "APN-AMBR with NSAPI"},                            /* 7.7.101 */
1859
/* 202 */  {202,                           "GGSN Back-Off Time"},                             /* 7.7.102 */
1860
/* 203 */  {203,                           "Signalling Priority Indication"},                 /* 7.7.103 */
1861
/* 204 */  {204,                           "Signalling Priority Indication with NSAPI"},      /* 7.7.104 */
1862
/* 205 */  {205,                           "Higher bitrates than 16 Mbps flag"},              /* 7.7.105 */
1863
/* 206 */  {206,                           "Max MBR/APN-AMBR"},                               /* 7.7.106 */
1864
/* 207 */  {207,                           "Additional MM context for SRVCC"},                /* 7.7.107 */
1865
/* 208 */  {208,                           "Additional flags for SRVCC"},                     /* 7.7.108 */
1866
/* 209 */  {209,                           "STN-SR"},                                         /* 7.7.109 */
1867
/* 210 */  {210,                           "C-MSISDN"},                                       /* 7.7.110 */
1868
/* 211 */  {211,                           "Extended RANAP Cause"},                           /* 7.7.111 */
1869
/* 212 */  {GTP_EXT_ENODEB_ID,             "eNodeB ID" },                                     /* 7.7.112 */
1870
/* 213 */  {GTP_EXT_SEL_MODE_W_NSAPI,      "Selection Mode with NSAPI" },                     /* 7.7.113 */
1871
/* 214 */  {GTP_EXT_ULI_TIMESTAMP,         "ULI Timestamp" },                                 /* 7.7.114 */
1872
/* 215 */  {GTP_EXT_LHN_ID_W_SAPI,         "Local Home Network ID (LHN-ID) with NSAPI" },     /* 7.7.115 */
1873
/* 216 */  {GTP_EXT_CN_OP_SEL_ENTITY,      "Operator Selection Entity" },                     /* 7.7.116 */
1874
/* 217 */  {GTP_EXT_UE_USAGE_TYPE,         "UE Usage Type" },                                 /* 7.7.117 */
1875
/* 218 */  {GTP_EXT_EXT_COMMON_FLGS_II,    "Extended Common Flags II"},                       /* 7.7.118 */
1876
/* 219 */  {GTP_EXT_NODE_IDENTIFIER,       "Node Identifier" },                              /* 7.7.119 */
1877
/* 220 */  {GTP_EXT_CIOT_OPT_SUP_IND,      "CIoT Optimizations Support Indication" },        /* 7.7.120 */
1878
/* 221 */  {GTP_EXT_SCEF_PDN_CONNECTION,   "SCEF PDN Connection" },                          /* 7.7.121 */
1879
/* 222 */  {GTP_EXT_IOV_UPDATES_COUNTER,   "IOV_updates counter" },                          /* 7.7.122 */
1880
/* 223 */  {GTP_EXT_MAPPED_UE_USAGE_TYPE,  "Mapped UE Usage Type" },                         /* 7.7.123 */
1881
/* 224 */  {GTP_EXT_UP_FUN_SEL_IND_FLAGS,  "UP Function Selection Indication Flags" },       /* 7.7.124 */
1882
1883
/* 225-238 TLV Spare. For future use. */
1884
/* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1885
/* 249 */  {GTP_EXT_REL_PACK,              "Sequence numbers of released packets IE"},        /* charging */
1886
/* 250 */  {GTP_EXT_CAN_PACK,              "Sequence numbers of canceled packets IE"},        /* charging */
1887
/* 251 */  {GTP_EXT_CHRG_ADDR,             "Charging Gateway address"},                       /* 7.7.44 */
1888
/* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1889
/* 252 */  {GTP_EXT_DATA_REQ,              "Data record packet"},                             /* charging */
1890
/* 253 */  {GTP_EXT_DATA_RESP,             "Requests responded"},                             /* charging */
1891
/* 254 */  {GTP_EXT_NODE_ADDR,             "Address of recommended node"},                    /* charging */
1892
/* 255 */  {GTP_EXT_PRIV_EXT,              "Private Extension"},
1893
1894
    {0, NULL}
1895
};
1896
static value_string_ext gtpv1_val_ext = VALUE_STRING_EXT_INIT(gtpv1_val);
1897
1898
/* GPRS:    9.60 v7.6.0, page 37
1899
 * UMTS:    29.060 v4.0, page 45
1900
 * ETSI TS 129 060 V9.4.0 (2010-10) Ch 7.7.1
1901
 */
1902
static const value_string cause_type[] = {
1903
    {  0, "Request IMSI"},
1904
    {  1, "Request IMEI"},
1905
    {  2, "Request IMSI and IMEI"},
1906
    {  3, "No identity needed"},
1907
    {  4, "MS refuses"},
1908
    {  5, "MS is not GPRS responding"},
1909
    {  6, "Reactivation Requested"},
1910
    {  7, "PDP address inactivity timer expires"},
1911
    /* For future use 8-48 */
1912
    /* Cause values reserved for GPRS charging
1913
     * protocol use (see GTP' in 3GPP TS 32.295 [33])
1914
     * 49-63
1915
     */
1916
    { 59, "System failure"}, /* charging */
1917
    { 60, "The transmit buffers are becoming full"}, /* charging */
1918
    { 61, "The receive buffers are becoming full"},  /* charging */
1919
    { 62, "Another node is about to go down"},       /* charging */
1920
    { 63, "This node is about to go down"},          /* charging */
1921
    /* For future use 64-127 */
1922
    {128, "Request accepted"},
1923
    {129, "New PDP type due to network preference"},
1924
    {130, "New PDP type due to single address bearer only"},
1925
    /* For future use 131-176 */
1926
    /* Cause values reserved for GPRS charging
1927
     * protocol use (see GTP' in 3GPP TS 32.295 [33])
1928
     * 177-191
1929
     */
1930
    {177, "CDR decoding error"},
1931
1932
    {192, "Non-existent"},
1933
    {193, "Invalid message format"},
1934
    {194, "IMSI not known"},
1935
    {195, "MS is GPRS detached"},
1936
    {196, "MS is not GPRS responding"},
1937
    {197, "MS refuses"},
1938
    {198, "Version not supported"},
1939
    {199, "No resource available"},
1940
    {200, "Service not supported"},
1941
    {201, "Mandatory IE incorrect"},
1942
    {202, "Mandatory IE missing"},
1943
    {203, "Optional IE incorrect"},
1944
    {204, "System failure"},
1945
    {205, "Roaming restriction"},
1946
    {206, "P-TMSI signature mismatch"},
1947
    {207, "GPRS connection suspended"},
1948
    {208, "Authentication failure"},
1949
    {209, "User authentication failed"},
1950
    {210, "Context not found"},
1951
    {211, "All PDP dynamic addresses are occupied"},
1952
    {212, "No memory is available"},
1953
    {213, "Relocation failure"},
1954
    {214, "Unknown mandatory extension header"},
1955
    {215, "Semantic error in the TFT operation"},
1956
    {216, "Syntactic error in the TFT operation"},
1957
    {217, "Semantic errors in packet filter(s)"},
1958
    {218, "Syntactic errors in packet filter(s)"},
1959
    {219, "Missing or unknown APN"},
1960
    {220, "Unknown PDP address or PDP type"},
1961
    {221, "PDP context without TFT already activated"},
1962
    {222, "APN access denied - no subscription"},
1963
    {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
1964
    {224, "MS MBMS Capabilities Insufficient"},
1965
    {225, "Invalid Correlation-ID"},
1966
    {226, "MBMS Bearer Context Superseded"},
1967
    {227, "Bearer Control Mode violation"},
1968
    {228, "Collision with network initiated request"},
1969
    {229, "APN Congestion"},
1970
    {230, "Bearer handling not supported"},
1971
    {231, "Target access restricted for the subscriber" },
1972
    {232, "UE is temporarily not reachable due to power saving" },
1973
    {233, "Relocation failure due to NAS message redirection"},
1974
    /* For future use -240 */
1975
    /* Cause values reserved for GPRS charging
1976
     * protocol use (see GTP' in 3GPP TS 32.295 [33])
1977
     * 241-255
1978
     */
1979
    {252, "Request related to possibly duplicated packets already fulfilled"},  /* charging */
1980
    {253, "Request already fulfilled"}, /* charging */
1981
    {254, "Sequence numbers of released/cancelled packets IE incorrect"},   /* charging */
1982
    {255, "Request not fulfilled"}, /* charging */
1983
    {0, NULL}
1984
};
1985
value_string_ext cause_type_ext = VALUE_STRING_EXT_INIT(cause_type);
1986
1987
/* GPRS:    9.02 v7.7.0
1988
 * UMTS:    29.002 v4.2.1, chapter 17.5, page 268
1989
 * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
1990
 */
1991
1992
static const value_string gsn_addr_type[] = {
1993
    {0x00, "IPv4"},
1994
    {0x01, "IPv6"},
1995
    {0, NULL}
1996
};
1997
1998
static const value_string pdp_type[] = {
1999
    {0x00, "X.25"},
2000
    {0x01, "PPP"},
2001
    {0x02, "OSP:IHOSS"},
2002
    {0x21, "IPv4"},
2003
    {0x57, "IPv6"},
2004
    {0x8d, "IPv4v6"},
2005
    {0, NULL}
2006
};
2007
2008
static const value_string pdp_org_type[] = {
2009
    {0, "ETSI"},
2010
    {1, "IETF"},
2011
    {0, NULL}
2012
};
2013
2014
static const value_string qos_delay_type[] = {
2015
    {0x00, "Subscribed delay class (in MS to network direction)"},
2016
    {0x01, "Delay class 1"},
2017
    {0x02, "Delay class 2"},
2018
    {0x03, "Delay class 3"},
2019
    {0x04, "Delay class 4 (best effort)"},
2020
    {0x07, "Reserved"},
2021
    {0, NULL}
2022
};
2023
2024
static const value_string qos_reliability_type[] = {
2025
    {0x00, "Subscribed reliability class (in MS to network direction)"},
2026
    {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
2027
    {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
2028
    {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
2029
    {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
2030
    {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
2031
    {0x07, "Reserved"},
2032
    {0, NULL}
2033
};
2034
2035
static const value_string qos_peak_type[] = {
2036
    {0x00, "Subscribed peak throughput (in MS to network direction)"},
2037
    {0x01, "Up to 1 000 oct/s"},
2038
    {0x02, "Up to 2 000 oct/s"},
2039
    {0x03, "Up to 4 000 oct/s"},
2040
    {0x04, "Up to 8 000 oct/s"},
2041
    {0x05, "Up to 16 000 oct/s"},
2042
    {0x06, "Up to 32 000 oct/s"},
2043
    {0x07, "Up to 64 000 oct/s"},
2044
    {0x08, "Up to 128 000 oct/s"},
2045
    {0x09, "Up to 256 000 oct/s"},
2046
/* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
2047
    {0x0A, "Reserved"},
2048
    {0x0B, "Reserved"},
2049
    {0x0C, "Reserved"},
2050
    {0x0D, "Reserved"},
2051
    {0x0E, "Reserved"},
2052
    {0x0F, "Reserved"},
2053
    {0, NULL}
2054
};
2055
2056
static const value_string qos_precedence_type[] = {
2057
    {0x00, "Subscribed precedence (in MS to network direction)"},
2058
    {0x01, "High priority"},
2059
    {0x02, "Normal priority"},
2060
    {0x03, "Low priority"},
2061
    {0x07, "Reserved"},
2062
    {0, NULL}
2063
};
2064
2065
static const value_string qos_mean_type[] = {
2066
    {0x00, "Subscribed mean throughput (in MS to network direction)"},
2067
    {0x01, "100 oct/h"},        /* Class 2 */
2068
    {0x02, "200 oct/h"},        /* Class 3 */
2069
    {0x03, "500 oct/h"},        /* Class 4 */
2070
    {0x04, "1 000 oct/h"},      /* Class 5 */
2071
    {0x05, "2 000 oct/h"},      /* Class 6 */
2072
    {0x06, "5 000 oct/h"},      /* Class 7 */
2073
    {0x07, "10 000 oct/h"},     /* Class 8 */
2074
    {0x08, "20 000 oct/h"},     /* Class 9 */
2075
    {0x09, "50 000 oct/h"},     /* Class 10 */
2076
    {0x0A, "100 000 oct/h"},    /* Class 11 */
2077
    {0x0B, "200 000 oct/h"},    /* Class 12 */
2078
    {0x0C, "500 000 oct/h"},    /* Class 13 */
2079
    {0x0D, "1 000 000 oct/h"},  /* Class 14 */
2080
    {0x0E, "2 000 000 oct/h"},  /* Class 15 */
2081
    {0x0F, "5 000 000 oct/h"},  /* Class 16 */
2082
    {0x10, "10 000 000 oct/h"}, /* Class 17 */
2083
    {0x11, "20 000 000 oct/h"}, /* Class 18 */
2084
    {0x12, "50 000 000 oct/h"}, /* Class 19 */
2085
/* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
2086
    {0x13, "Reserved"},
2087
    {0x14, "Reserved"},
2088
    {0x15, "Reserved"},
2089
    {0x16, "Reserved"},
2090
    {0x17, "Reserved"},
2091
    {0x18, "Reserved"},
2092
    {0x19, "Reserved"},
2093
    {0x1A, "Reserved"},
2094
    {0x1B, "Reserved"},
2095
    {0x1C, "Reserved"},
2096
    {0x1D, "Reserved"},
2097
    {0x1E, "Reserved"},
2098
    {0x1F, "Best effort"},  /* Class 1 */
2099
    {0, NULL}
2100
};
2101
static value_string_ext qos_mean_type_ext = VALUE_STRING_EXT_INIT(qos_mean_type);
2102
2103
static const value_string qos_del_err_sdu[] = {
2104
    {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
2105
    {0x01, "No detect ('-')"},
2106
    {0x02, "Erroneous SDUs are delivered ('yes')"},
2107
    {0x03, "Erroneous SDUs are not delivered ('no')"},
2108
    {0x07, "Reserved"},  /* All other values are reserved */
2109
    {0, NULL}
2110
};
2111
2112
static const value_string qos_del_order[] = {
2113
    {0x00, "Subscribed delivery order (in MS to network direction)"},
2114
    {0x01, "With delivery order ('yes')"},
2115
    {0x02, "Without delivery order ('no')"},
2116
    {0x03, "Reserved"},  /* All other values are reserved */
2117
    {0, NULL}
2118
};
2119
2120
static const value_string qos_traf_class[] = {
2121
    {0x00, "Subscribed traffic class (in MS to network direction)"},
2122
    {0x01, "Conversational class"},
2123
    {0x02, "Streaming class"},
2124
    {0x03, "Interactive class"},
2125
    {0x04, "Background class"},
2126
    {0x07, "Reserved"},  /* All other values are reserved */
2127
    {0, NULL}
2128
};
2129
2130
static const value_string qos_max_sdu_size[] = {
2131
    {0x00, "Subscribed maximum SDU size (in MS to network direction"},
2132
    /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
2133
    {0x97, "1502 octets"},
2134
    {0x98, "1510 octets"},
2135
    {0x99, "1520 octets"},
2136
    {0, NULL}             /* All other values are reserved */
2137
};
2138
2139
static const value_string qos_max_ul[] = {
2140
    {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
2141
    /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2142
    /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2143
    /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2144
    {0xFF, "0 kbps"},
2145
    {0, NULL}
2146
};
2147
2148
static const value_string qos_max_dl[] = {
2149
    {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
2150
    /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2151
    /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2152
    /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2153
    {0xFF, "0 kbps"},
2154
    {0, NULL}
2155
};
2156
2157
static const value_string qos_res_ber[] = {
2158
    {0x00, "Subscribed residual BER (in MS to network direction)"},
2159
    {0x01, "1/20 = 5x10^-2"},
2160
    {0x02, "1/100 = 1x10^-2"},
2161
    {0x03, "1/200 = 5x10^-3"},
2162
    {0x04, "1/250 = 4x10^-3"},
2163
    {0x05, "1/1 000 = 1x10^-3"},
2164
    {0x06, "1/10 000 = 1x10^-4"},
2165
    {0x07, "1/100 000 = 1x10^-5"},
2166
    {0x08, "1/1 000 000 = 1x10^-6"},
2167
    {0x09, "3/50 000 000 = 6x10^-8"},
2168
    {0x0F, "Reserved"},    /* All other values are reserved */
2169
    {0, NULL}
2170
};
2171
2172
static const value_string qos_sdu_err_ratio[] = {
2173
    {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
2174
    {0x01, "1/100 = 1x10^-2"},
2175
    {0x02, "7/1000 = 7x10^-3"},
2176
    {0x03, "1/1 000 = 1x10^-3"},
2177
    {0x04, "1/10 000 = 1x10^-4"},
2178
    {0x05, "1/100 000 = 1x10^-5"},
2179
    {0x06, "1/1 000 000 = 1x10^-6"},
2180
    {0x07, "1/10 = 1x10^-1"},
2181
    {0x0F, "Reserved"},    /* All other values are reserved */
2182
    {0, NULL}
2183
};
2184
2185
static const value_string qos_traf_handl_prio[] = {
2186
    {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
2187
    {0x01, "Priority level 1"},
2188
    {0x02, "Priority level 2"},
2189
    {0x03, "Priority level 3"},
2190
    {0, NULL}
2191
};
2192
2193
static const value_string qos_trans_delay[] = {
2194
    {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
2195
    {0x01, "10 ms"},        /* Using a granularity of 10 ms */
2196
    {0x02, "20 ms"},
2197
    {0x03, "30 ms"},
2198
    {0x04, "40 ms"},
2199
    {0x05, "50 ms"},
2200
    {0x06, "60 ms"},
2201
    {0x07, "70 ms"},
2202
    {0x08, "80 ms"},
2203
    {0x09, "90 ms"},
2204
    {0x0A, "100 ms"},
2205
    {0x0B, "110 ms"},
2206
    {0x0C, "120 ms"},
2207
    {0x0D, "130 ms"},
2208
    {0x0E, "140 ms"},
2209
    {0x0F, "150 ms"},
2210
    {0x10, "200 ms"},       /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
2211
    {0x11, "250 ms"},
2212
    {0x12, "300 ms"},
2213
    {0x13, "350 ms"},
2214
    {0x14, "400 ms"},
2215
    {0x15, "450 ms"},
2216
    {0x16, "500 ms"},
2217
    {0x17, "550 ms"},
2218
    {0x18, "600 ms"},
2219
    {0x19, "650 ms"},
2220
    {0x1A, "700 ms"},
2221
    {0x1B, "750 ms"},
2222
    {0x1C, "800 ms"},
2223
    {0x1D, "850 ms"},
2224
    {0x1E, "900 ms"},
2225
    {0x1F, "950 ms"},
2226
    {0x20, "1000 ms"},      /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
2227
    {0x21, "1100 ms"},
2228
    {0x22, "1200 ms"},
2229
    {0x23, "1300 ms"},
2230
    {0x24, "1400 ms"},
2231
    {0x25, "1500 ms"},
2232
    {0x26, "1600 ms"},
2233
    {0x27, "1700 ms"},
2234
    {0x28, "1800 ms"},
2235
    {0x29, "1900 ms"},
2236
    {0x2A, "2000 ms"},
2237
    {0x2B, "2100 ms"},
2238
    {0x2C, "2200 ms"},
2239
    {0x2D, "2300 ms"},
2240
    {0x2E, "2400 ms"},
2241
    {0x2F, "2500 ms"},
2242
    {0x30, "2600 ms"},
2243
    {0x31, "2700 ms"},
2244
    {0x32, "2800 ms"},
2245
    {0x33, "2900 ms"},
2246
    {0x34, "3000 ms"},
2247
    {0x35, "3100 ms"},
2248
    {0x36, "3200 ms"},
2249
    {0x37, "3300 ms"},
2250
    {0x38, "3400 ms"},
2251
    {0x39, "3500 ms"},
2252
    {0x3A, "3600 ms"},
2253
    {0x3B, "3700 ms"},
2254
    {0x3C, "3800 ms"},
2255
    {0x3D, "3900 ms"},
2256
    {0x3E, "4000 ms"},
2257
    {0x3F, "Reserved"},
2258
    {0, NULL}
2259
};
2260
static value_string_ext qos_trans_delay_ext = VALUE_STRING_EXT_INIT(qos_trans_delay);
2261
2262
static const value_string qos_guar_ul[] = {
2263
    {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
2264
    /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2265
    /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2266
    /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2267
    {0xFF, "0 kbps"},
2268
    {0, NULL}
2269
};
2270
2271
static const value_string src_stat_desc_vals[] = {
2272
    {0x00, "unknown"},
2273
    {0x01, "speech"},
2274
    {0, NULL}
2275
};
2276
2277
2278
static const true_false_string gtp_sig_ind = {
2279
    "Optimised for signalling traffic",
2280
    "Not optimised for signalling traffic"
2281
};
2282
2283
static const value_string qos_guar_dl[] = {
2284
    {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
2285
    /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2286
    /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2287
    /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2288
    {0xFF, "0 kbps"},
2289
    {0, NULL}
2290
};
2291
2292
static const value_string tr_comm_type[] = {
2293
    {1, "Send data record packet"},
2294
    {2, "Send possibly duplicated data record packet"},
2295
    {3, "Cancel data record packet"},
2296
    {4, "Release data record packet"},
2297
    {0, NULL}
2298
};
2299
2300
/*
2301
 * UMTS:   23.040 v14.0.0, chapter 3.3.2
2302
 */
2303
static const value_string ms_not_reachable_type[] = {
2304
    { 0, "No paging response via the MSC"},
2305
    { 1, "IMSI detached"},
2306
    { 2, "Roaming restriction"},
2307
    { 3, "Deregistered in the HLR for non GPRS"},
2308
    { 4, "MS purge for non GPRS"},
2309
    { 5, "No paging response via the SGSN"},
2310
    { 6, "GPRS detached"},
2311
    { 7, "Deregistered in the HLR for non GPRS"},
2312
    { 8, "MS purged for GPRS"},
2313
    { 9, "Unidentified subscriber via the MSC"},
2314
    {10, "Unidentified subscriber via the SGSN"},
2315
    {11, "Deregistered in the HSS/HLR for IMS"},
2316
    {12, "No response via the IP-SM-GW"},
2317
    {13, "The MS is temporarily unavailable"},
2318
    {0, NULL}             /* All other values are reserved */
2319
};
2320
2321
/* UMTS:   25.413 v3.4.0, chapter 9.2.1.4, page 80
2322
 */
2323
static const value_string ranap_cause_type[] = {
2324
/* Radio Network Layer Cause (1-->64) */
2325
    {   1, "RAB preempted"},
2326
    {   2, "Trelocoverall Expiry"},
2327
    {   3, "Trelocprep Expiry"},
2328
    {   4, "Treloccomplete Expiry"},
2329
    {   5, "Tqueuing Expiry"},
2330
    {   6, "Relocation Triggered"},
2331
    {   7, "TRELOCalloc Expiry"},
2332
    {   8, "Unable to Establish During Relocation"},
2333
    {   9, "Unknown Target RNC"},
2334
    {  10, "Relocation Cancelled"},
2335
    {  11, "Successful Relocation"},
2336
    {  12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
2337
    {  13, "Change of Ciphering and/or Integrity Protection is not supported"},
2338
    {  14, "Failure in the Radio Interface Procedure"},
2339
    {  15, "Release due to UTRAN Generated Reason"},
2340
    {  16, "User Inactivity"},
2341
    {  17, "Time Critical Relocation"},
2342
    {  18, "Requested Traffic Class not Available"},
2343
    {  19, "Invalid RAB Parameters Value"},
2344
    {  20, "Requested Maximum Bit Rate not Available"},
2345
    {  21, "Requested Guaranteed Bit Rate not Available"},
2346
    {  22, "Requested Transfer Delay not Achievable"},
2347
    {  23, "Invalid RAB Parameters Combination"},
2348
    {  24, "Condition Violation for SDU Parameters"},
2349
    {  25, "Condition Violation for Traffic Handling Priority"},
2350
    {  26, "Condition Violation for Guaranteed Bit Rate"},
2351
    {  27, "User Plane Versions not Supported"},
2352
    {  28, "Iu UP Failure"},
2353
    {  29, "Relocation Failure in Target CN/RNC or Target System"},
2354
    {  30, "Invalid RAB ID"},
2355
    {  31, "No Remaining RAB"},
2356
    {  32, "Interaction with other procedure"},
2357
    {  33, "Requested Maximum Bit Rate for DL not Available"},
2358
    {  34, "Requested Maximum Bit Rate for UL not Available"},
2359
    {  35, "Requested Guaranteed Bit Rate for DL not Available"},
2360
    {  36, "Requested Guaranteed Bit Rate for UL not Available"},
2361
    {  37, "Repeated Integrity Checking Failure"},
2362
    {  38, "Requested Report Type not supported"},
2363
    {  39, "Request superseded"},
2364
    {  40, "Release due to UE generated signalling connection release"},
2365
    {  41, "Resource Optimisation Relocation"},
2366
    {  42, "Requested Information Not Available"},
2367
    {  43, "Relocation desirable for radio reasons"},
2368
    {  44, "Relocation not supported in Target RNC or Target System"},
2369
    {  45, "Directed Retry"},
2370
    {  46, "Radio Connection With UE Lost"},
2371
    {  47, "rNC-unable-to-establish-all-RFCs"},
2372
    {  48, "deciphering-keys-not-available"},
2373
    {  49, "dedicated-assistance-data-not-available"},
2374
    {  50, "relocation-target-not-allowed"},
2375
    {  51, "location-reporting-congestion"},
2376
    {  52, "reduce-load-in-serving-cell"},
2377
    {  53, "no-radio-resources-available-in-target-cell"},
2378
    {  54, "gERAN-Iumode-failure"},
2379
    {  55, "access-restricted-due-to-shared-networks"},
2380
    {  56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
2381
    {  57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
2382
    {  58, "mBMS-no-multicast-service-for-this-UE"},
2383
    {  59, "mBMS-unknown-UE-ID"},
2384
    {  60, "successful-MBMS-session-start-no-data-bearer-necessary"},
2385
    {  61, "mBMS-superseded-due-to-NNSF"},
2386
    {  62, "mBMS-UE-linking-already-done"},
2387
    {  63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
2388
    {  64, "tMGI-unknown"},
2389
/* Transport Layer Cause (65-->80) */
2390
    {  65, "Signalling Transport Resource Failure"},
2391
    {  66, "Iu Transport Connection Failed to Establish"},
2392
/* NAS Cause (81-->96) */
2393
    {  81, "User Restriction Start Indication"},
2394
    {  82, "User Restriction End Indication"},
2395
    {  83, "Normal Release"},
2396
/* Protocol Cause (97-->112) */
2397
    {  97, "Transfer Syntax Error"},
2398
    {  98, "Semantic Error"},
2399
    {  99, "Message not compatible with receiver state"},
2400
    { 100, "Abstract Syntax Error (Reject)"},
2401
    { 101, "Abstract Syntax Error (Ignore and Notify)"},
2402
    { 102, "Abstract Syntax Error (Falsely Constructed Message"},
2403
/* Miscellaneous Cause (113-->128) */
2404
    { 113, "O & M Intervention"},
2405
    { 114, "No Resource Available"},
2406
    { 115, "Unspecified Failure"},
2407
    { 116, "Network Optimisation"},
2408
/* Non-standard Cause (129-->255) */
2409
2410
/* ranap_CauseRadioNetworkExtension ??
2411
    { 257, "iP-multicast-address-and-APN-not-valid" },
2412
    { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
2413
    { 259, "mBMS-request-superseded" },
2414
    { 260, "mBMS-de-registration-during-session-not-allowed" },
2415
    { 261, "mBMS-no-data-bearer-necessary" },
2416
  */
2417
2418
    {0, NULL}
2419
};
2420
static value_string_ext ranap_cause_type_ext = VALUE_STRING_EXT_INIT(ranap_cause_type);
2421
2422
static const value_string mm_sec_modep[] = {
2423
    {0, "Used cipher value, UMTS keys and Quintuplets"},
2424
    {1, "GSM key and triplets"},
2425
    {2, "UMTS key and quintuplets"},
2426
    {3, "GSM key and quintuplets"},
2427
    {0, NULL}
2428
};
2429
2430
static const value_string gtp_cipher_algorithm[] = {
2431
    {0, "No ciphering"},
2432
    {1, "GEA/1"},
2433
    {2, "GEA/2"},
2434
    {3, "GEA/3"},
2435
    {4, "GEA/4"},
2436
    {5, "GEA/5"},
2437
    {6, "GEA/6"},
2438
    {7, "GEA/7"},
2439
    {0, NULL}
2440
};
2441
static const value_string gtp_ext_rat_type_vals[] = {
2442
    {0, "Reserved"},
2443
    {1, "UTRAN"},
2444
    {2, "GERAN"},
2445
    {3, "WLAN"},
2446
    {4, "GAN"},
2447
    {5, "HSPA Evolution"},
2448
    {6, "EUTRAN (WB-E-UTRAN)"},
2449
    {7, "Virtual"},
2450
    {8, "EUTRAN-NB-IoT"},
2451
    {0, NULL}
2452
};
2453
static const value_string chg_rep_act_type_vals[] = {
2454
    {0, "Stop Reporting"},
2455
    {1, "Start Reporting CGI/SAI"},
2456
    {2, "Start Reporting RAI"},
2457
    {0, NULL}
2458
};
2459
2460
2461
static const value_string geographic_location_type[] = {
2462
    {0, "Cell Global Identification (CGI)"},
2463
    {1, "Service Area Identity (SAI)"},
2464
    {2, "Routing Area Identification (RAI)"},
2465
/* reserved for future used (3-->127) */
2466
/* values below used by Radius */
2467
    {128, "TAI"},
2468
    {129, "ECGI"},
2469
    {130, "TAI & ECGI"},
2470
    {131, "eNodeB ID"},
2471
    {132, "TAI and eNodeB ID"},
2472
    {133, "extended eNodeB ID"},
2473
    {134, "TAI and extended eNodeB ID"},
2474
    {135, "NCGI"},
2475
    {136, "5GS TAI"},
2476
    {137, "5GS TAI and NCGI"},
2477
    {138, "NG-RAN Node ID"},
2478
    {139, "5GS TAI and NG-RAN Node ID"},
2479
/* reserved for future used (140-->255) */
2480
    {0, NULL}
2481
};
2482
2483
static const value_string gtp_ext_hdr_pdu_ses_cont_pdu_type_vals[] = {
2484
    {0,  "DL PDU SESSION INFORMATION"},
2485
    {1,  "UL PDU SESSION INFORMATION"},
2486
    {0, NULL}
2487
};
2488
2489
2490
#define MM_PROTO_GROUP_CALL_CONTROL     0x00
2491
#define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
2492
#define MM_PROTO_PDSS1                  0x02
2493
#define MM_PROTO_CALL_CONTROL           0x03
2494
#define MM_PROTO_PDSS2                  0x04
2495
#define MM_PROTO_MM_NON_GPRS            0x05
2496
#define MM_PROTO_RR_MGMT                0x06
2497
#define MM_PROTO_MM_GPRS                0x08
2498
#define MM_PROTO_SMS                    0x09
2499
#define MM_PROTO_SESSION_MGMT           0x0A
2500
#define MM_PROTO_NON_CALL_RELATED       0x0B
2501
2502
static GHashTable *gtpstat_msg_idx_hash;
2503
2504
static void
2505
gtpstat_init(struct register_srt* srt _U_, GArray* srt_array)
2506
0
{
2507
0
    if (gtpstat_msg_idx_hash != NULL) {
2508
0
        g_hash_table_destroy(gtpstat_msg_idx_hash);
2509
0
    }
2510
0
    gtpstat_msg_idx_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
2511
2512
0
    init_srt_table("GTP Requests", NULL, srt_array, 0, NULL, NULL, NULL);
2513
0
}
2514
2515
static tap_packet_status
2516
gtpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv, tap_flags_t flags _U_)
2517
0
{
2518
0
    unsigned i = 0;
2519
0
    srt_stat_table *gtp_srt_table;
2520
0
    srt_data_t *data = (srt_data_t *)pss;
2521
0
    const gtp_msg_hash_t *gtp=(const gtp_msg_hash_t *)prv;
2522
0
    int idx = 0;
2523
2524
    /* we are only interested in reply packets */
2525
0
    if(gtp->is_request){
2526
0
        return TAP_PACKET_DONT_REDRAW;
2527
0
    }
2528
    /* if we have not seen the request, just ignore it */
2529
0
    if(!gtp->req_frame){
2530
0
        return TAP_PACKET_DONT_REDRAW;
2531
0
    }
2532
2533
    /* Redoing the message indexing is bit redundant (and keeps us from
2534
     * passing in the filter "gtp.message" in init_srt_table above),
2535
     * but using message type as such would yield a long gtp_srt_table.
2536
     */
2537
2538
0
    gtp_srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
2539
2540
0
    idx = GPOINTER_TO_UINT(g_hash_table_lookup(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype)));
2541
2542
    /* Store the value incremented by 1 to avoid confusing index 0 with NULL */
2543
0
    if (idx == 0) {
2544
0
        idx = g_hash_table_size(gtpstat_msg_idx_hash);
2545
0
        g_hash_table_insert(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype), GUINT_TO_POINTER(idx + 1));
2546
0
        init_srt_table_row(gtp_srt_table, idx, val_to_str_ext_const(gtp->msgtype, &gtp_message_type_ext, "Unknown"));
2547
0
    } else {
2548
0
        idx -= 1;
2549
0
    }
2550
2551
0
    add_srt_table_data(gtp_srt_table, idx, &gtp->req_time, pinfo);
2552
2553
0
    return TAP_PACKET_REDRAW;
2554
0
}
2555
2556
2557
static dissector_handle_t eth_handle;
2558
static dissector_handle_t ip_handle;
2559
static dissector_handle_t ipv6_handle;
2560
static dissector_handle_t ppp_handle;
2561
static dissector_handle_t sync_handle;
2562
static dissector_handle_t gtpcdr_handle;
2563
static dissector_handle_t sndcpxid_handle;
2564
static dissector_handle_t gtpv2_handle;
2565
static dissector_handle_t bssgp_handle;
2566
static dissector_handle_t pdcp_nr_handle;
2567
static dissector_handle_t pdcp_lte_handle;
2568
static dissector_handle_t gtp_tpdu_custom_handle;
2569
static dissector_table_t bssap_pdu_type_table;
2570
2571
static int proto_pdcp_lte;
2572
2573
uint32_t gtp_session_count;
2574
2575
/* Relation between frame -> session */
2576
wmem_map_t* session_table;
2577
/* Relation between <teid,ip> -> frame */
2578
wmem_map_t* frame_map;
2579
2580
typedef struct {
2581
    uint32_t teid;
2582
    address addr;
2583
} gtp_info_t;
2584
2585
static unsigned
2586
gtp_info_hash(const void *key)
2587
0
{
2588
0
    const gtp_info_t *k = (const gtp_info_t *)key;
2589
2590
    /* The TEID is likely unique, so just use it. */
2591
0
    return g_int_hash(&k->teid);
2592
0
}
2593
2594
static gboolean
2595
gtp_info_equal(const void *key1, const void *key2)
2596
0
{
2597
0
    const gtp_info_t *a = (const gtp_info_t *)key1;
2598
0
    const gtp_info_t *b = (const gtp_info_t *)key2;
2599
2600
0
    return (a->teid == b->teid && (cmp_address(&a->addr, &b->addr) == 0));
2601
0
}
2602
2603
/* GTP Session funcs*/
2604
uint32_t
2605
0
get_frame(address ip, uint32_t teid, uint32_t *frame) {
2606
0
    gtp_info_t info;
2607
0
    uint32_t *value;
2608
2609
0
    info.teid = teid;
2610
0
    copy_address_shallow(&info.addr, &ip);
2611
0
    value = wmem_map_lookup(frame_map, &info);
2612
0
    if (value != NULL) {
2613
0
        *frame = GPOINTER_TO_UINT(value);
2614
0
        return 1;
2615
0
    }
2616
0
    return 0;
2617
0
}
2618
2619
static gboolean
2620
0
frame_equal(void *key _U_, void *value, void *data){
2621
0
    uint32_t frame = GPOINTER_TO_UINT(data);
2622
2623
0
    return (GPOINTER_TO_UINT(value) == frame);
2624
0
}
2625
2626
void
2627
0
remove_frame_info(uint32_t f) {
2628
    /* XXX: This iterates through the entire map and it is slow if done
2629
     * often. For large files with lots of removals, there are better
2630
     * alternatives, e.g. marking sessions as expired and then periodically
2631
     * removing all expired sessions from the map, or using a bijective
2632
     * map to coordinate removals.
2633
     */
2634
0
    wmem_map_foreach_remove(frame_map, frame_equal, GUINT_TO_POINTER(f));
2635
0
}
2636
2637
void
2638
0
add_gtp_session(uint32_t frame, uint32_t session) {
2639
2640
0
    wmem_map_insert(session_table, GUINT_TO_POINTER(frame), GUINT_TO_POINTER(session));
2641
0
}
2642
2643
bool
2644
0
teid_exists(uint32_t teid, wmem_list_t *teid_list) {
2645
0
    wmem_list_frame_t *elem;
2646
0
    uint32_t *info;
2647
0
    bool found;
2648
0
    found = false;
2649
0
    elem = wmem_list_head(teid_list);
2650
0
    while (!found && elem) {
2651
0
        info = (uint32_t*)wmem_list_frame_data(elem);
2652
0
        found = *info == teid;
2653
0
        elem = wmem_list_frame_next(elem);
2654
0
    }
2655
0
    return found;
2656
0
}
2657
2658
bool
2659
0
ip_exists(address ip, wmem_list_t *ip_list) {
2660
0
    wmem_list_frame_t *elem;
2661
0
    address *info;
2662
0
    bool found;
2663
0
    found = false;
2664
0
    elem = wmem_list_head(ip_list);
2665
0
    while (!found && elem) {
2666
0
        info = (address*)wmem_list_frame_data(elem);
2667
0
        found = addresses_equal(info, &ip);
2668
0
        elem = wmem_list_frame_next(elem);
2669
0
    }
2670
0
    return found;
2671
0
}
2672
2673
2674
/* wmem_map_foreach() callback used in fill_map() */
2675
static void
2676
0
remove_session_from_table(void *key, void *val, void *userdata) {
2677
0
    unsigned fr = GPOINTER_TO_UINT(key);
2678
0
    unsigned session = GPOINTER_TO_UINT(val);
2679
0
    unsigned remove_session = GPOINTER_TO_UINT(userdata);
2680
2681
    /* If it's the session we are looking for, we remove all the frame information */
2682
0
    if (session == remove_session) {
2683
0
        remove_frame_info(fr);
2684
0
    }
2685
0
}
2686
2687
void
2688
0
fill_map(wmem_list_t *teid_list, wmem_list_t *ip_list, uint32_t frame) {
2689
0
    wmem_list_frame_t *elem_ip, *elem_teid;
2690
0
    gtp_info_t *gtp_info;
2691
0
    uint32_t teid, session;
2692
0
    address *ip;
2693
2694
    /* XXX: This adds all combinations of addresses and TEIDs. It
2695
     * should only add matching pairs for a F-TEID, though this is
2696
     * difficult to determine for GTPv1 (especially if the check_etsi
2697
     * preference is off) unlike with GTPv2.
2698
     * It also should not add anything that uses the reserved TEID
2699
     * (0), such as happens in GTPv2 on S11/S4 interfaces for the
2700
     * PGW S5/S8 TEID on initial attach, etc.
2701
     */
2702
0
    elem_ip = wmem_list_head(ip_list);
2703
0
    while (elem_ip) {
2704
0
        ip = (address*)wmem_list_frame_data(elem_ip);
2705
        /* We loop over the teid list */
2706
0
        elem_teid = wmem_list_head(teid_list);
2707
0
        while (elem_teid) {
2708
0
            teid = *(uint32_t*)wmem_list_frame_data(elem_teid);
2709
0
            gtp_info = wmem_new0(wmem_file_scope(), gtp_info_t);
2710
0
            gtp_info->teid = teid;
2711
0
            copy_address_wmem(wmem_file_scope(), &gtp_info->addr, ip);
2712
0
            if (wmem_map_lookup(frame_map, gtp_info)) {
2713
                /* If the teid and ip already maps to a session, that means
2714
                 * that we need to remove old info about that session */
2715
                /* We look for its session ID */
2716
0
                session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame)));
2717
0
                if (session) {
2718
                    /* If the msg has the same session ID and it's not the upd req we have to remove its info */
2719
0
                    wmem_map_foreach(session_table, remove_session_from_table, GUINT_TO_POINTER(session));
2720
0
                }
2721
0
            }
2722
0
            wmem_map_insert(frame_map, gtp_info, GUINT_TO_POINTER(frame));
2723
0
            elem_teid = wmem_list_frame_next(elem_teid);
2724
0
        }
2725
0
        elem_ip = wmem_list_frame_next(elem_ip);
2726
0
    }
2727
0
}
2728
2729
bool
2730
0
is_cause_accepted(uint8_t cause, uint32_t version) {
2731
0
    if (version == 1) {
2732
0
        return cause == 128 || cause == 129 || cause == 130;
2733
0
    }
2734
0
    else if (version == 2) {
2735
0
        return cause == 16 || cause == 17 || cause == 18 || cause == 19;
2736
0
    }
2737
0
    return false;
2738
0
}
2739
2740
static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2741
static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2742
static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2743
static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2744
static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2745
static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2746
static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2747
static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2748
static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2749
static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2750
static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2751
static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2752
static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2753
static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2754
static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2755
static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2756
static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2757
static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2758
static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2759
static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2760
static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2761
static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2762
static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2763
static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2764
static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2765
static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2766
static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2767
static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2768
static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2769
static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2770
static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2771
static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2772
static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2773
static int decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args, const char * tree_name, int hf_ipv4, int hf_ipv6);
2774
static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2775
static int decode_gtp_sgsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2776
static int decode_gtp_sgsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2777
static int decode_gtp_ggsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2778
static int decode_gtp_ggsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2779
static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2780
static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2781
static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2782
static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2783
static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2784
static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2785
static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2786
static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2787
static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2788
static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2789
static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2790
2791
static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2792
static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2793
static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2794
static int decode_gtp_sgsn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2795
static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2796
static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2797
static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2798
static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2799
static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2800
static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2801
static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2802
static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2803
static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2804
static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2805
static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2806
static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2807
static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2808
static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2809
static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2810
static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2811
static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2812
static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2813
static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2814
static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2815
static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2816
static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2817
static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2818
static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2819
static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2820
static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2821
static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2822
static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2823
static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2824
static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2825
static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2826
static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2827
static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2828
static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2829
static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2830
static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2831
static int decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2832
static int decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2833
static int decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2834
static int decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2835
static int decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2836
static int decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2837
static int decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2838
static int decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2839
static int decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2840
static int decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2841
static int decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2842
static int decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2843
static int decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2844
static int decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2845
static int decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2846
static int decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2847
static int decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2848
static int decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2849
static int decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2850
static int decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2851
static int decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2852
static int decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2853
static int decode_gtp_ext_enodeb_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2854
static int decode_gtp_ext_sel_mode_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2855
static int decode_gtp_ext_uli_timestamp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2856
static int decode_gtp_ext_lhn_id_w_sapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2857
static int decode_gtp_ext_cn_op_sel_entity(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2858
static int decode_gtp_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2859
static int decode_gtp_extended_common_flgs_II(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2860
static int decode_gtp_ext_node_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2861
static int decode_gtp_ciot_opt_sup_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2862
static int decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2863
static int decode_gtp_iov_updates_counter(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2864
static int decode_gtp_mapped_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2865
static int decode_gtp_up_fun_sel_ind_flags(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2866
2867
static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2868
static int decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2869
static int decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2870
static int decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2871
static int decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2872
static int decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2873
2874
static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2875
static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2876
static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2877
static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2878
static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2879
static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2880
static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2881
static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2882
2883
typedef struct {
2884
    int optcode;
2885
    int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *, session_args_t *);
2886
} gtp_opt_t;
2887
2888
static const gtp_opt_t gtpopt[] = {
2889
/* 0x01 */  {GTP_EXT_CAUSE, decode_gtp_cause},
2890
/* 0x02 */  {GTP_EXT_IMSI, decode_gtp_imsi},
2891
/* 0x03 */  {GTP_EXT_RAI, decode_gtp_rai},
2892
/* 0x04 */  {GTP_EXT_TLLI, decode_gtp_tlli},
2893
/* 0x05 */  {GTP_EXT_PTMSI, decode_gtp_ptmsi},
2894
/* 0x06 */  {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
2895
/* 0x07 */
2896
/* 0x08 */  {GTP_EXT_REORDER, decode_gtp_reorder},
2897
/* 0x09 */  {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
2898
/* 0x0a */
2899
/* 0x0b */  {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
2900
/* 0x0c */  {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
2901
/* 0x0d */  {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
2902
/* 0x0e */  {GTP_EXT_RECOVER, decode_gtp_recovery},
2903
/* 0x0f */  {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
2904
/* 0x10 */  {GTP_EXT_16, decode_gtp_16},
2905
/* 0x11 */  {GTP_EXT_17, decode_gtp_17},
2906
/* 0x12 */  {GTP_EXT_18, decode_gtp_18},
2907
/* 0x13 */  {GTP_EXT_19, decode_gtp_19},
2908
/* 0x14 */  {GTP_EXT_NSAPI, decode_gtp_nsapi},
2909
/* 0x15 */  {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
2910
/* 0x16 */  {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
2911
/* 0x17 */  {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
2912
/* 0x18 */  {GTP_EXT_RP, decode_gtp_rp},
2913
/* 0x19 */  {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
2914
/* 0x1a */  {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
2915
/* 0x1b */  {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
2916
/* 0x1c */  {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
2917
/* 0x1d */  {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
2918
2919
/* 0x7e */  {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
2920
/* 0x7f */  {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
2921
/* 0x80 */  {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
2922
/* 0x81 */  {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
2923
/* 0x82 */  {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
2924
/* 0x83 */  {GTP_EXT_APN, decode_gtp_apn},
2925
/* 0x84 */  {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
2926
/* 0x85 */  {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
2927
/* 0x86 */  {GTP_EXT_MSISDN, decode_gtp_msisdn},
2928
/* 0x87 */  {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts},                            /* 3G */
2929
/* 0x88 */  {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui},                            /* 3G */
2930
/* 0x89 */  {GTP_EXT_TFT, decode_gtp_tft},                                      /* 3G */
2931
/* 0x8a */  {GTP_EXT_TARGET_ID, decode_gtp_target_id},                          /* 3G */
2932
/* 0x8b */  {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont},                        /* 3G */
2933
/* 0x8c */  {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup},                          /* 3G */
2934
/* 0x8d */  {GTP_EXT_HDR_LIST, decode_gtp_hdr_list},                            /* 3G */
2935
/* 0x8e */  {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id},                        /* 3G */
2936
/* 0x8f */  {GTP_EXT_OMC_ID, decode_gtp_omc_id},                                /* 3G */
2937
    /* TS 29 060 V6.11.0 */
2938
/* 0x90 */  {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont},                      /* 7.7.43 */
2939
/* 0x91 */  {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio},                  /* 7.7.45 */
2940
/* 0x92 */  {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf},          /* 7.7.45A */
2941
/* 0x93 */  {GTP_EXT_SGSN_NO, decode_gtp_sgsn_no},                              /* 7.7.47 */
2942
/* 0x94 */  {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs},                      /* 7.7.48 */
2943
/* 0x95 */  {GTP_EXT_APN_RES, decode_gtp_apn_res},                              /* 3G */
2944
/* 0x96 */  {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs},                      /* 7.7.25B */
2945
/* 0x97 */  {GTP_EXT_RAT_TYPE, decode_gtp_rat_type},                            /* 3G */
2946
/* 0x98 */  {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf},                      /* 7.7.51 */
2947
/* 0x99 */  {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone},                    /* 7.7.52 */
2948
/* 0x9a */  {GTP_EXT_IMEISV, decode_gtp_imeisv},                                /* 3G 7.7.53 */
2949
/* 0x9b */  {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con},          /* 7.7.54 */
2950
/* 0x9c */  {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx},                      /* 7.7.55 */
2951
/* 0x9d */  {GTP_EXT_TMGI, decode_gtp_tmgi},                                    /* 7.7.56 */
2952
/* 0x9e */  {GTP_EXT_RIM_RA, decode_gtp_rim_ra},                                /* 7.7.57 */
2953
/* 0x9f */  {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt},        /* 7.7.58 */
2954
/* 0xa0 */  {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa},                              /* 7.7.60 */
2955
/* 0xa1 */  {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf},      /* 7.7.61 */
2956
/* 0xa2 */  {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf},                      /* 7.7.62 */
2957
/* 0xa3 */  {GTP_EXT_HOP_COUNT, decode_gtp_hop_count},                          /* 7.7.63 */
2958
/* 0xa4 */  {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id},                      /* 7.7.64 */
2959
/* 0xa5 */  {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id},                      /* 7.7.65 */
2960
/* 0xa6 */  {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind},                /* 7.7.66 */
2961
/* 0xa7 */  {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi},                          /* 7.7.67 */
2962
/* 0xa8 */  {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur},                    /* 7.7.59 */
2963
/* 0xa9 */  {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf},            /* 7.7.68 */
2964
/* 0xaa */  {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no},        /* 7.7.69 */
2965
/* 0xab */  {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr},    /* 7.7.70 */
2966
/* 0xac */  {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx},                  /* 7.7.71 */
2967
/* 0xad */  {GTP_EXT_BSS_CONT, decode_gtp_bss_cont},                            /* 7.7.72 */
2968
/* 0xae */  {GTP_EXT_CELL_ID, decode_gtp_cell_id},                              /* 7.7.73 */
2969
/* 0xaf */  {GTP_EXT_PDU_NO, decode_gtp_pdu_no},                                /* 7.7.74 */
2970
/* 0xb0 */  {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause},                      /* 7.7.75 */
2971
/* 0xb1 */  {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap},          /* 7.7.76 */
2972
/* 0xb2 */  {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc},            /* 7.7.77 */
2973
/* 0xb3 */  {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc},            /* 7.7.78 */
2974
/* 0xb4 */  {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid},          /* 7.7.79 */
2975
/* 0xb5 */  {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act},        /* 7.7.80 */
2976
/* 0xb6 */  {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg},            /* 7.7.81 */
2977
/* 0xb7 */  {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id},                      /* 7.7.82 */
2978
/* 0xb8 */  {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod},         /* 7.7.83 */
2979
/* 0xb9 */  {GTP_EXT_MBMS_FLOW_ID, decode_gtp_mbms_flow_id},                    /* 7.7.84 */
2980
/* 0xba */  {GTP_EXT_MBMS_IP_MCAST_DIST, decode_gtp_mbms_ip_mcast_dist},        /* 7.7.85 */
2981
/* 0xba */  {GTP_EXT_MBMS_DIST_ACK, decode_gtp_mbms_dist_ack},                  /* 7.7.86 */
2982
/* 0xbc */  {GTP_EXT_RELIABLE_IRAT_HO_INF, decode_gtp_reliable_irat_ho_inf},    /* 7.7.87 */
2983
/* 0xbd */  {GTP_EXT_RFSP_INDEX, decode_gtp_rfsp_index},                        /* 7.7.88 */
2984
2985
/* 0xbe */  {GTP_EXT_FQDN, decode_gtp_fqdn},                                    /* 7.7.90 */
2986
/* 0xbf */  {GTP_EXT_EVO_ALLO_RETE_P1, decode_gtp_evolved_allc_rtn_p1},         /* 7.7.91 */
2987
/* 0xc0 */  {GTP_EXT_EVO_ALLO_RETE_P2, decode_gtp_evolved_allc_rtn_p2},         /* 7.7.92 */
2988
/* 0xc1 */  {GTP_EXT_EXTENDED_COMMON_FLGS, decode_gtp_extended_common_flgs},    /* 7.7.93 */
2989
/* 0xc2 */  {GTP_EXT_UCI, decode_gtp_uci},                                      /* 7.7.94 */
2990
/* 0xc3 */  {GTP_EXT_CSG_INF_REP_ACT, decode_gtp_csg_inf_rep_act},              /* 7.7.95 */
2991
/* 0xc4 */  {GTP_EXT_CSG_ID, decode_gtp_csg_id},                                /* 7.7.96 */
2992
/* 0xc5 */  {GTP_EXT_CMI, decode_gtp_cmi},                                      /* 7.7.97 */
2993
/* 0xc6 */  {GTP_EXT_AMBR, decode_gtp_apn_ambr},                                /* 7.7.98 */
2994
/* 0xc7 */  {GTP_EXT_UE_NETWORK_CAP, decode_gtp_ue_network_cap},                /* 7.7.99 */
2995
/* 0xc8 */  {GTP_EXT_UE_AMBR, decode_gtp_ue_ambr},                              /* 7.7.100 */
2996
/* 0xc9 */  {GTP_EXT_APN_AMBR_WITH_NSAPI, decode_gtp_apn_ambr_with_nsapi},      /* 7.7.101 */
2997
/* 0xCA */  {GTP_EXT_GGSN_BACK_OFF_TIME, decode_gtp_ggsn_back_off_time},        /* 7.7.102 */
2998
/* 0xCB */  {GTP_EXT_SIG_PRI_IND, decode_gtp_sig_pri_ind},                      /* 7.7.103 */
2999
/* 0xCC */  {GTP_EXT_SIG_PRI_IND_W_NSAPI, decode_gtp_sig_pri_ind_w_nsapi},      /* 7.7.104 */
3000
/* 0xCD */  {GTP_EXT_HIGHER_BR_16MB_FLG, decode_gtp_higher_br_16mb_flg},        /* 7.7.105 */
3001
/* 0xCE */  {GTP_EXT_MAX_MBR_APN_AMBR, decode_gtp_max_mbr_apn_ambr},            /* 7.7.106 */
3002
/* 0xCF */  {GTP_EXT_ADD_MM_CTX_SRVCC, decode_gtp_add_mm_ctx_srvcc},            /* 7.7.107 */
3003
/* 0xD0 */  {GTP_EXT_ADD_FLGS_SRVCC, decode_gtp_add_flgs_srvcc},                /* 7.7.108 */
3004
/* 0xD1 */  {GTP_EXT_STN_SR, decode_gtp_stn_sr},                                /* 7.7.109 */
3005
/* 0xD2 */  {GTP_EXT_C_MSISDN, decode_gtp_c_msisdn},                            /* 7.7.110 */
3006
/* 0xD3 */  {GTP_EXT_EXT_RANAP_CAUSE, decode_gtp_ext_ranap_cause},              /* 7.7.111 */
3007
/* 0xD4 */  {GTP_EXT_ENODEB_ID, decode_gtp_ext_enodeb_id },                     /* 7.7.112 */
3008
/* 0xD5 */  {GTP_EXT_SEL_MODE_W_NSAPI, decode_gtp_ext_sel_mode_w_nsapi },       /* 7.7.113 */
3009
/* 0xD6 */  {GTP_EXT_ULI_TIMESTAMP, decode_gtp_ext_uli_timestamp },             /* 7.7.114 */
3010
/* 0xD7 */  {GTP_EXT_LHN_ID_W_SAPI, decode_gtp_ext_lhn_id_w_sapi },             /* 7.7.115 */
3011
/* 0xD8 */  {GTP_EXT_CN_OP_SEL_ENTITY, decode_gtp_ext_cn_op_sel_entity },       /* 7.7.116 */
3012
/* 0xD9 */  {GTP_EXT_UE_USAGE_TYPE, decode_gtp_ue_usage_type },                 /* 7.7.117 */
3013
/* 0xDA */  {GTP_EXT_EXT_COMMON_FLGS_II, decode_gtp_extended_common_flgs_II },  /* 7.7.118 */
3014
/* 0xDB */  {GTP_EXT_NODE_IDENTIFIER, decode_gtp_ext_node_id },                 /* 7.7.119 */
3015
/* 0xDC */  {GTP_EXT_CIOT_OPT_SUP_IND, decode_gtp_ciot_opt_sup_ind },           /* 7.7.120 */
3016
/* 0xDD */  {GTP_EXT_SCEF_PDN_CONNECTION, decode_gtp_scef_pdn_conn },           /* 7.7.121 */
3017
/* 0xDE */  {GTP_EXT_IOV_UPDATES_COUNTER, decode_gtp_iov_updates_counter },     /* 7.7.122 */
3018
/* 0xDF */  {GTP_EXT_MAPPED_UE_USAGE_TYPE, decode_gtp_mapped_ue_usage_type },   /* 7.7.123 */
3019
/* 0xE0 */  {GTP_EXT_UP_FUN_SEL_IND_FLAGS, decode_gtp_up_fun_sel_ind_flags },   /* 7.7.124 */
3020
3021
/* 0xf9 */  {GTP_EXT_REL_PACK, decode_gtp_rel_pack },                           /* charging */
3022
/* 0xfa */  {GTP_EXT_CAN_PACK, decode_gtp_can_pack},                            /* charging */
3023
/* 0xfb */  {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
3024
3025
/* 0xfc */  {GTP_EXT_DATA_REQ, decode_gtp_data_req},                           /* charging */
3026
/* 0xfd */  {GTP_EXT_DATA_RESP, decode_gtp_data_resp},                         /* charging */
3027
/* 0xfe */  {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
3028
/* 0xff */  {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
3029
    {0, decode_gtp_unknown}
3030
};
3031
3032
3.58k
#define NUM_GTP_IES 255
3033
static int ett_gtp_ies[NUM_GTP_IES];
3034
3035
static uint8_t gtp_version;
3036
3037
4.87k
#define BCD2CHAR(d)         ((d) | 0x30)
3038
3039
static char *
3040
id_to_str(tvbuff_t *tvb, int offset)
3041
399
{
3042
399
    static char str[17] = "                ";
3043
399
    uint8_t bits8to5, bits4to1;
3044
399
    int i, j;
3045
399
    uint8_t ad;
3046
3047
3.57k
    for (i = j = 0; i < 8; i++) {
3048
3.17k
        ad = tvb_get_uint8(tvb, offset + i);
3049
3.17k
        bits8to5 = hi_nibble(ad);
3050
3.17k
        bits4to1 = lo_nibble(ad);
3051
3.17k
        if (bits4to1 <= 9)
3052
2.26k
            str[j++] = BCD2CHAR(bits4to1);
3053
904
        else
3054
904
            str[j++] = ' ';
3055
3.17k
        if (bits8to5 <= 9)
3056
2.61k
            str[j++] = BCD2CHAR(bits8to5);
3057
562
        else
3058
562
            str[j++] = ' ';
3059
3.17k
    }
3060
399
    str[j] = '\0';
3061
399
    return str;
3062
399
}
3063
3064
3065
/* Next definitions and function check_field_presence_and_decoder checks if given field
3066
 * in GTP packet is compliant with ETSI
3067
 */
3068
typedef int (ie_decoder) (tvbuff_t *, int, packet_info *, proto_tree *, session_args_t *);
3069
3070
typedef struct {
3071
    uint8_t code;
3072
    uint8_t presence;
3073
    ie_decoder *alt_decoder;
3074
} ext_header;
3075
3076
typedef struct {
3077
    uint8_t code;
3078
    ext_header fields[46];
3079
} _gtp_mess_items;
3080
3081
/* ---------------------
3082
 * GPRS messages
3083
 * ---------------------*/
3084
static const _gtp_mess_items gprs_mess_items[] = {
3085
3086
    {
3087
        GTP_MSG_ECHO_REQ, {
3088
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3089
            {0, 0, NULL}
3090
        }
3091
    },
3092
    {
3093
        GTP_MSG_ECHO_RESP, {
3094
            {GTP_EXT_RECOVER, GTP_MANDATORY, NULL},
3095
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3096
            {0, 0, NULL}
3097
        }
3098
    },
3099
    {
3100
        GTP_MSG_VER_NOT_SUPP, {
3101
            {0, 0, NULL}
3102
        }
3103
    },
3104
    {
3105
        GTP_MSG_NODE_ALIVE_REQ, {
3106
            {GTP_EXT_NODE_ADDR, GTP_MANDATORY, NULL},
3107
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3108
            {0, 0, NULL}
3109
        }
3110
    },
3111
    {
3112
        GTP_MSG_NODE_ALIVE_RESP, {
3113
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3114
            {0, 0, NULL}
3115
        }
3116
    },
3117
    {
3118
        GTP_MSG_REDIR_REQ, {
3119
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3120
            {GTP_EXT_NODE_ADDR, GTP_OPTIONAL, NULL},
3121
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3122
            {0, 0, NULL}
3123
        }
3124
    },
3125
    {
3126
        GTP_MSG_REDIR_RESP, {
3127
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3128
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3129
            {0, 0, NULL}
3130
        }
3131
    },
3132
    {
3133
        GTP_MSG_CREATE_PDP_REQ, {
3134
            {GTP_EXT_QOS_GPRS, GTP_MANDATORY, NULL},
3135
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3136
            {GTP_EXT_SEL_MODE, GTP_MANDATORY, NULL},
3137
            {GTP_EXT_FLOW_LABEL, GTP_MANDATORY, NULL},
3138
            {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3139
            {GTP_EXT_MSISDN, GTP_MANDATORY, NULL},
3140
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3141
            {GTP_EXT_APN, GTP_MANDATORY, NULL},
3142
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3143
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3144
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3145
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3146
            {0, 0, NULL}
3147
        }
3148
    },
3149
    {
3150
        GTP_MSG_CREATE_PDP_RESP, {
3151
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3152
            {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL, NULL},
3153
            {GTP_EXT_REORDER, GTP_CONDITIONAL, NULL},
3154
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3155
            {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL, NULL},
3156
            {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3157
            {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3158
            {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3159
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3160
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3161
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3162
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3163
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3164
            {0, 0, NULL}
3165
        }
3166
    },
3167
    {
3168
        GTP_MSG_UPDATE_PDP_REQ, {
3169
            {GTP_EXT_QOS_GPRS, GTP_MANDATORY, NULL},
3170
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3171
            {GTP_EXT_FLOW_LABEL, GTP_MANDATORY, NULL},
3172
            {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3173
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3174
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3175
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3176
            {0, 0, NULL},
3177
        }
3178
    },
3179
    {
3180
        GTP_MSG_UPDATE_PDP_RESP, {
3181
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3182
            {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL, NULL},
3183
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3184
            {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL, NULL},
3185
            {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3186
            {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3187
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3188
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3189
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3190
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3191
            {0, 0, NULL}
3192
        }
3193
    },
3194
    {
3195
        GTP_MSG_DELETE_PDP_REQ, {
3196
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3197
            {0, 0, NULL}
3198
        }
3199
    },
3200
    {
3201
        GTP_MSG_DELETE_PDP_RESP, {
3202
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3203
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3204
            {0, 0, NULL},
3205
        }
3206
    },
3207
    {
3208
        GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, {
3209
            {GTP_EXT_QOS_GPRS, GTP_MANDATORY, NULL},
3210
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3211
            {GTP_EXT_SEL_MODE, GTP_MANDATORY, NULL},
3212
            {GTP_EXT_FLOW_LABEL, GTP_MANDATORY, NULL},
3213
            {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3214
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3215
            {GTP_EXT_APN, GTP_MANDATORY, NULL},
3216
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3217
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3218
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3219
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3220
            {0, 0, NULL}
3221
        }
3222
    },
3223
    {
3224
        GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, {
3225
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3226
            {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL, NULL},
3227
            {GTP_EXT_REORDER, GTP_CONDITIONAL, NULL},
3228
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3229
            {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL, NULL},
3230
            {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3231
            {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3232
            {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3233
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3234
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3235
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3236
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3237
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3238
            {0, 0, NULL}
3239
        }
3240
    },
3241
    {
3242
        GTP_MSG_DELETE_AA_PDP_REQ, {
3243
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3244
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3245
            {0, 0, NULL}
3246
        }
3247
    },
3248
    {
3249
        GTP_MSG_DELETE_AA_PDP_RESP, {
3250
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3251
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3252
            {0, 0, NULL}
3253
        }
3254
    },
3255
    {
3256
        GTP_MSG_ERR_IND, {
3257
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3258
            {0, 0, NULL}
3259
        }
3260
    },
3261
    {
3262
        GTP_MSG_PDU_NOTIFY_REQ, {
3263
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3264
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3265
            {0, 0, NULL}
3266
        }
3267
    },
3268
    {
3269
        GTP_MSG_PDU_NOTIFY_RESP, {
3270
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3271
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3272
            {0, 0, NULL}
3273
        }
3274
    },
3275
    {
3276
        GTP_MSG_PDU_NOTIFY_REJ_REQ, {
3277
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3278
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3279
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3280
            {0, 0, NULL}
3281
        }
3282
    },
3283
    {
3284
        GTP_MSG_PDU_NOTIFY_REJ_RESP, {
3285
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3286
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3287
            {0, 0, NULL}
3288
        }
3289
    },
3290
    {
3291
        GTP_MSG_SEND_ROUT_INFO_REQ, {
3292
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3293
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3294
            {0, 0, NULL}
3295
        }
3296
    },
3297
    {
3298
        GTP_MSG_SEND_ROUT_INFO_RESP, {
3299
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3300
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3301
            {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3302
            {GTP_EXT_MS_REASON, GTP_OPTIONAL, NULL},
3303
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},
3304
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3305
            {0, 0, NULL}
3306
        }
3307
    },
3308
    {
3309
        GTP_MSG_FAIL_REP_REQ, {
3310
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3311
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3312
            {0, 0, NULL}
3313
        }
3314
    },
3315
    {
3316
        GTP_MSG_FAIL_REP_RESP, {
3317
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3318
            {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3319
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3320
            {0, 0, NULL}
3321
        }
3322
    },
3323
    {
3324
        GTP_MSG_MS_PRESENT_REQ, {
3325
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3326
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3327
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3328
            {0, 0, NULL}
3329
        }
3330
    },
3331
    {
3332
        GTP_MSG_MS_PRESENT_RESP, {
3333
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3334
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3335
            {0, 0, NULL}
3336
        }
3337
    },
3338
    {
3339
        GTP_MSG_IDENT_REQ, {
3340
            {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3341
            {GTP_EXT_PTMSI, GTP_MANDATORY, NULL},
3342
            {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL, NULL},
3343
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3344
            {0, 0, NULL}
3345
        }
3346
    },
3347
    {
3348
        GTP_MSG_IDENT_RESP, {
3349
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3350
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3351
            {GTP_EXT_AUTH_TRI, GTP_OPTIONAL, NULL},
3352
            {GTP_EXT_AUTH_QUI, GTP_OPTIONAL, NULL},
3353
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3354
            {0, 0, NULL}
3355
        }
3356
    },
3357
    {
3358
        GTP_MSG_SGSN_CNTXT_REQ, {
3359
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3360
            {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3361
            {GTP_EXT_TLLI, GTP_MANDATORY, NULL},
3362
            {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL, NULL},
3363
            {GTP_EXT_MS_VALID, GTP_OPTIONAL, NULL},
3364
            {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3365
            {0, 0, NULL}
3366
        }
3367
    },
3368
    {
3369
        GTP_MSG_SGSN_CNTXT_RESP, {
3370
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3371
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3372
            {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3373
            {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL, NULL},
3374
            {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL, NULL},
3375
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3376
            {0, 0, NULL}
3377
        }
3378
    },
3379
    {
3380
        GTP_MSG_SGSN_CNTXT_ACK, {
3381
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3382
            {GTP_EXT_FLOW_II, GTP_CONDITIONAL, NULL},
3383
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3384
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3385
            {0, 0, NULL}
3386
        }
3387
    },
3388
    {
3389
        GTP_MSG_DATA_TRANSF_REQ, {
3390
            {GTP_EXT_TR_COMM, GTP_MANDATORY, NULL},
3391
            {GTP_EXT_DATA_REQ, GTP_CONDITIONAL, NULL},
3392
            {GTP_EXT_REL_PACK, GTP_CONDITIONAL, NULL},
3393
            {GTP_EXT_CAN_PACK, GTP_CONDITIONAL, NULL},
3394
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3395
            {0, 0, NULL}
3396
        }
3397
    },
3398
    {
3399
        GTP_MSG_DATA_TRANSF_RESP, {
3400
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3401
            {GTP_EXT_DATA_RESP, GTP_MANDATORY, NULL},
3402
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3403
            {0, 0, NULL}
3404
        }
3405
    },
3406
    {
3407
        0, {
3408
            {0, 0, NULL}
3409
        }
3410
    }
3411
};
3412
3413
/* -----------------------------
3414
 * UMTS messages
3415
 * -----------------------------*/
3416
static const _gtp_mess_items umts_mess_items[] = {
3417
    /* 7.2 Path Management Messages */
3418
    {
3419
        GTP_MSG_ECHO_REQ, {
3420
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3421
            {0, 0, NULL}
3422
        }
3423
    },
3424
    {
3425
        GTP_MSG_ECHO_RESP, {
3426
            {GTP_EXT_RECOVER, GTP_MANDATORY, NULL},
3427
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3428
            {0, 0, NULL}
3429
        }
3430
    },
3431
    {
3432
        GTP_MSG_VER_NOT_SUPP, {
3433
            {0, 0, NULL}
3434
        }
3435
    },
3436
    {
3437
        GTP_MSG_SUPP_EXT_HDR, {
3438
            {GTP_EXT_HDR_LIST, GTP_MANDATORY, NULL},
3439
            {0, 0, NULL}
3440
        }
3441
    },
3442
    /* ??? */
3443
    {
3444
        GTP_MSG_NODE_ALIVE_REQ, {
3445
            {GTP_EXT_NODE_ADDR, GTP_MANDATORY, NULL},
3446
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3447
            {0, 0, NULL}
3448
        }
3449
    },
3450
    {
3451
        GTP_MSG_NODE_ALIVE_RESP, {
3452
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3453
            {0, 0, NULL}
3454
        }
3455
    },
3456
    {
3457
        GTP_MSG_REDIR_REQ, {
3458
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3459
            {GTP_EXT_NODE_ADDR, GTP_OPTIONAL, NULL},
3460
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3461
            {0, 0, NULL}
3462
        }
3463
    },
3464
    {
3465
        GTP_MSG_REDIR_REQ, {
3466
            {0, 0, NULL}
3467
        }
3468
    },
3469
    /* 7.3 Tunnel Management Messages */
3470
    {
3471
        GTP_MSG_CREATE_PDP_REQ, {
3472
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3473
            /* RAI is in TS 29.060 V6.11.0 */
3474
            {GTP_EXT_RAI, GTP_OPTIONAL, NULL},        /* Routeing Area Identity (RAI) Optional 7.7.3 */
3475
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3476
            {GTP_EXT_SEL_MODE, GTP_CONDITIONAL, NULL},
3477
            {GTP_EXT_TEID, GTP_MANDATORY, NULL},
3478
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3479
            {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},
3480
            {GTP_EXT_NSAPI, GTP_CONDITIONAL, NULL}, /* Linked NSAPI Conditional */
3481
            {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL, NULL},
3482
            {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL},
3483
            {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL},
3484
            {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3485
            {GTP_EXT_APN, GTP_CONDITIONAL, NULL},
3486
            {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL, NULL},
3487
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},
3488
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_user_plane},
3489
            {GTP_EXT_MSISDN, GTP_CONDITIONAL, NULL},
3490
            {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL},
3491
            {GTP_EXT_TFT, GTP_CONDITIONAL, NULL},
3492
            {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL},
3493
            {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL},
3494
            {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Optional 7.7.48 */
3495
            {GTP_EXT_APN_RES, GTP_OPTIONAL, NULL},
3496
            {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL},
3497
            {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL},
3498
            {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL},
3499
            {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL},
3500
            {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL, NULL},
3501
            {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL},
3502
            /* Updated to TS 29.060 V16.0.0 */
3503
            {GTP_EXT_CORRELATION_ID, GTP_OPTIONAL, NULL}, /* 7.7.82 */
3504
            {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3505
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3506
            {GTP_EXT_UCI, GTP_OPTIONAL, NULL}, /* 7.7.94 */
3507
            {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3508
            {GTP_EXT_SIG_PRI_IND, GTP_OPTIONAL, NULL}, /* 7.7.103 */
3509
            {GTP_EXT_CN_OP_SEL_ENTITY, GTP_OPTIONAL, NULL}, /* 7.7.116 */
3510
            {GTP_EXT_MAPPED_UE_USAGE_TYPE, GTP_OPTIONAL, NULL},  /* 7.7.123 */
3511
            {GTP_EXT_UP_FUN_SEL_IND_FLAGS, GTP_OPTIONAL, NULL},  /* 7.7.124 */
3512
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3513
            {0, 0, NULL}
3514
        }
3515
    },
3516
    {
3517
        GTP_MSG_CREATE_PDP_RESP, {
3518
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3519
            {GTP_EXT_REORDER, GTP_CONDITIONAL, NULL},
3520
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3521
            {GTP_EXT_TEID, GTP_CONDITIONAL, NULL},
3522
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3523
            {GTP_EXT_NSAPI, GTP_CONDITIONAL, NULL},
3524
            {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3525
            {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3526
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3527
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_control_plane},
3528
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_user_plane},
3529
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Addresses for Control Plane 7.7.32 */
3530
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Address for user traffic 7.7.32 */
3531
            {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL, NULL},
3532
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3533
            /* TS 29.060 V6.11.0 */
3534
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},   /* Alternative Charging Gateway Address Optional 7.7.44 */
3535
            {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Optional 7.7.48 */
3536
            {GTP_EXT_APN_RES, GTP_OPTIONAL, NULL},     /* APN Restriction Optional 7.7.49 */
3537
            {GTP_EXT_MS_INF_CHG_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.80 */
3538
            {GTP_EXT_BEARER_CONTROL_MODE, GTP_OPTIONAL, NULL}, /* 7.7.83 */
3539
            {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3540
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3541
            {GTP_EXT_CSG_INF_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.95 */
3542
            {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3543
            {GTP_EXT_GGSN_BACK_OFF_TIME, GTP_OPTIONAL, NULL}, /* 7.7.102 */
3544
            {GTP_EXT_EXT_COMMON_FLGS_II, GTP_OPTIONAL, NULL}, /* 7.7.118 */
3545
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3546
            {0, 0, NULL}
3547
        }
3548
    },
3549
    {                           /* checked, SGSN -> GGSN */
3550
        GTP_MSG_UPDATE_PDP_REQ, {
3551
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3552
            {GTP_EXT_RAI, GTP_OPTIONAL, NULL},         /* Routeing Area Identity (RAI) Optional 7.7.3 */
3553
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3554
            {GTP_EXT_TEID, GTP_MANDATORY, NULL},
3555
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3556
            {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},
3557
            {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL},
3558
            {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL},
3559
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},  /* Protocol Configuration Options Optional 7.7.31 */
3560
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},   /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
3561
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_user_plane},      /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
3562
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},    /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
3563
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},    /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
3564
            {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL},
3565
            {GTP_EXT_TFT, GTP_OPTIONAL, NULL},
3566
            {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL},
3567
            {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL},
3568
            {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL},        /* Common Flags Optional 7.7.48 */
3569
            {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL},           /* RAT Type Optional 7.7.50 */
3570
            {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL},        /* User Location Information Optional 7.7.51 */
3571
            {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL},       /* MS Time Zone Optional 7.7.52 */
3572
            {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL},        /* Additional Trace Info Optional 7.7.62 */
3573
            {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL, NULL}, /* Direct Tunnel Flags     7.7.81 */
3574
            {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3575
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3576
            {GTP_EXT_UCI, GTP_OPTIONAL, NULL}, /* 7.7.94 */
3577
            {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3578
            {GTP_EXT_SIG_PRI_IND, GTP_OPTIONAL, NULL}, /* 7.7.103 */
3579
            {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3580
            {GTP_EXT_IMEISV, GTP_OPTIONAL, NULL}, /* 7.7.53 */
3581
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3582
            {0, 0, NULL}
3583
        }
3584
    },
3585
    {                           /* checked, GGSN -> SGSN */
3586
        GTP_MSG_UPDATE_PDP_RESP, {
3587
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3588
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3589
            {GTP_EXT_TEID, GTP_CONDITIONAL, NULL},
3590
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3591
            {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3592
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},  /* Protocol Configuration Options Optional 7.7.31 */
3593
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_control_plane},
3594
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_user_plane},
3595
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},    /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
3596
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},    /* Alternative GGSN Address for User Traffic Conditional GSN Address 7.7.32 */
3597
            {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL, NULL},
3598
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3599
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},   /* Alternative Charging Gateway Address Optional 7.7.44 */
3600
            {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Optional 7.7.48 */
3601
            {GTP_EXT_APN_RES, GTP_OPTIONAL, NULL},     /* APN Restriction Optional 7.7.49 */
3602
            {GTP_EXT_BEARER_CONTROL_MODE, GTP_OPTIONAL, NULL}, /* 7.7.83 */
3603
            {GTP_EXT_MS_INF_CHG_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.80 */
3604
            {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3605
            {GTP_EXT_CSG_INF_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.95 */
3606
            {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3607
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3608
            {0, 0, NULL}
3609
        }
3610
    },
3611
    {
3612
        GTP_MSG_DELETE_PDP_REQ, {
3613
            {GTP_EXT_CAUSE, GTP_OPTIONAL, NULL},
3614
            {GTP_EXT_TEAR_IND, GTP_CONDITIONAL, NULL},
3615
            {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},
3616
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3617
            {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL}, /* User Location Information Optional 7.7.51 */
3618
            {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL}, /* MS Time Zone Optional 7.7.52 */
3619
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3620
            {GTP_EXT_ULI_TIMESTAMP, GTP_OPTIONAL, NULL}, /* 7.7.114 */
3621
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3622
            {0, 0, NULL}
3623
        }
3624
    },
3625
    {
3626
        GTP_MSG_DELETE_PDP_RESP, {
3627
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3628
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3629
            {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL}, /* User Location Information Optional 7.7.51 */
3630
            {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL}, /* MS Time Zone Optional 7.7.52 */
3631
            {GTP_EXT_ULI_TIMESTAMP, GTP_OPTIONAL, NULL}, /* 7.7.114 */
3632
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3633
            {0, 0, NULL}
3634
        }
3635
    },
3636
    {
3637
        GTP_MSG_ERR_IND, {
3638
            {GTP_EXT_TEID, GTP_MANDATORY, NULL},
3639
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_ggsn_addr_for_control_plane},  /* GSN Address Mandatory 7.7.32 */
3640
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3641
            {0, 0, NULL}
3642
        }
3643
    },
3644
    {
3645
        GTP_MSG_PDU_NOTIFY_REQ, {
3646
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3647
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3648
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3649
            {GTP_EXT_APN, GTP_MANDATORY, NULL},
3650
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3651
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_ggsn_addr_for_control_plane},
3652
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3653
            {0, 0, NULL}
3654
        }
3655
    },
3656
    {
3657
        GTP_MSG_PDU_NOTIFY_RESP, {
3658
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3659
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3660
            {0, 0, NULL}
3661
        }
3662
    },
3663
    {
3664
        GTP_MSG_PDU_NOTIFY_REJ_REQ, {
3665
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3666
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3667
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3668
            {GTP_EXT_APN, GTP_MANDATORY, NULL},
3669
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3670
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3671
            {0, 0, NULL}
3672
        }
3673
    },
3674
    {
3675
        GTP_MSG_PDU_NOTIFY_REJ_RESP, {
3676
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3677
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3678
            {0, 0, NULL}
3679
        }
3680
    },
3681
    {
3682
        GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, {
3683
            {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},  /* NSAPI Mandatory 7.7.17 */
3684
            {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3685
            {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL}, /* Quality of Service Profile Mandatory 7.7.34 */
3686
            {GTP_EXT_TFT, GTP_CONDITIONAL, NULL}, /* TFT Conditional 7.7.36 */
3687
            {GTP_EXT_CORRELATION_ID, GTP_MANDATORY, NULL}, /* 7.7.82 */
3688
            {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3689
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3690
        }
3691
    },
3692
    {
3693
        GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, {
3694
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3695
            {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL, NULL}, /* Protocol Configuration Options Conditional 7.7.31 */
3696
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3697
        }
3698
    },
3699
    /* 7.4 Location Management Messages */
3700
    {
3701
        GTP_MSG_SEND_ROUT_INFO_REQ, {
3702
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3703
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3704
            {0, 0, NULL}
3705
        }
3706
    },
3707
    {
3708
        GTP_MSG_SEND_ROUT_INFO_RESP, {
3709
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3710
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3711
            {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3712
            {GTPv1_EXT_MS_REASON, GTP_OPTIONAL, NULL},
3713
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},
3714
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3715
            {0, 0, NULL}
3716
        }
3717
    },
3718
    {
3719
        GTP_MSG_FAIL_REP_REQ, {
3720
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3721
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3722
            {0, 0, NULL}
3723
        }
3724
    },
3725
    {
3726
        GTP_MSG_FAIL_REP_RESP, {
3727
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3728
            {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3729
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3730
            {0, 0, NULL}
3731
        }
3732
    },
3733
    {
3734
        GTP_MSG_MS_PRESENT_REQ, {
3735
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3736
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3737
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3738
            {0, 0, NULL}
3739
        }
3740
    },
3741
    {
3742
        GTP_MSG_MS_PRESENT_RESP, {
3743
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3744
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3745
            {0, 0, NULL}
3746
        }
3747
    },
3748
    /* 7.5 Mobility Management Messages */
3749
    {
3750
        GTP_MSG_IDENT_REQ, {
3751
            {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3752
            {GTP_EXT_PTMSI, GTP_MANDATORY, NULL},
3753
            {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL, NULL},
3754
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, decode_gtp_sgsn_addr_for_control_plane},   /* SGSN Address for Control Plane Optional 7.7.32 */
3755
            {GTP_EXT_HOP_COUNT, GTP_OPTIONAL, NULL},  /* Hop Counter Optional 7.7.63 */
3756
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3757
            {0, 0, NULL}
3758
        }
3759
    },
3760
    {
3761
        GTP_MSG_IDENT_RESP, {
3762
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3763
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3764
            {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL, NULL},
3765
            {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL, NULL},
3766
            {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3767
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3768
            {0, 0, NULL}
3769
        }
3770
    },
3771
    {
3772
        GTP_MSG_SGSN_CNTXT_REQ, {
3773
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3774
            {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3775
            {GTP_EXT_TLLI, GTP_CONDITIONAL, NULL},
3776
            {GTP_EXT_PTMSI, GTP_CONDITIONAL, NULL},
3777
            {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL, NULL},
3778
            {GTP_EXT_MS_VALID, GTP_OPTIONAL, NULL},
3779
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3780
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},
3781
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, decode_gtp_sgsn_addr_for_control_plane},   /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
3782
            {GTP_EXT_SGSN_NO, GTP_OPTIONAL, NULL},    /* SGSN Number Optional 7.7.47 */
3783
            {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL},   /* RAT Type Optional 7.7.50 */
3784
            {GTP_EXT_HOP_COUNT, GTP_OPTIONAL, NULL},  /* Hop Counter Optional 7.7.63 */
3785
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3786
            {0, 0, NULL}
3787
        }
3788
    },
3789
    {
3790
        GTP_MSG_SGSN_CNTXT_RESP, {
3791
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3792
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3793
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3794
            {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL, NULL},  /* RAB Context Conditional 7.7.19 */
3795
            {GTP_EXT_RP_SMS, GTP_OPTIONAL, NULL},
3796
            {GTP_EXT_RP, GTP_OPTIONAL, NULL},
3797
            {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL, NULL},
3798
            {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL, NULL},     /* CharingCharacteristics Optional 7.7.23 */
3799
            {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL, NULL},   /* Radio Priority LCS Optional 7.7.25B */
3800
            {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL, NULL},
3801
            {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL, NULL},
3802
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_sgsn_addr_for_control_plane},
3803
            {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL, NULL}, /* PDP Context Prioritization Optional 7.7.45 */
3804
            {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL, NULL},   /* MBMS UE Context Optional 7.7.55 */
3805
            {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* Subscribed RFSP Index 7.7.88 */
3806
            {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* RFSP Index in use 7.7.88 */
3807
            {GTP_EXT_FQDN, GTP_OPTIONAL, NULL}, /* Co-located GGSN-PGW FQDN 7.7.90 */
3808
            {GTP_EXT_EVO_ALLO_RETE_P2, GTP_OPTIONAL, NULL}, /* 7.7.92 */
3809
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3810
            {GTP_EXT_UE_NETWORK_CAP, GTP_OPTIONAL, NULL}, /* 7.7.99 */
3811
            {GTP_EXT_UE_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.100 */
3812
            {GTP_EXT_APN_AMBR_WITH_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.101 */
3813
            {GTP_EXT_SIG_PRI_IND_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.104 */
3814
            {GTP_EXT_HIGHER_BR_16MB_FLG, GTP_OPTIONAL, NULL}, /* 7.7.105 */
3815
            {GTP_EXT_SEL_MODE_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.113 */
3816
            {GTP_EXT_LHN_ID_W_SAPI, GTP_OPTIONAL, NULL }, /* 7.7.115 */
3817
            {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3818
            {GTP_EXT_EXT_COMMON_FLGS_II, GTP_OPTIONAL, NULL}, /* 7.7.118 */
3819
            {GTP_EXT_SCEF_PDN_CONNECTION, GTP_OPTIONAL, NULL }, /* 7.7.121 */
3820
            {GTP_EXT_IOV_UPDATES_COUNTER, GTP_OPTIONAL, NULL }, /* 7.7.122 */
3821
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},    /* Alternative GGSN Address for Control Plane 7.7.32 */
3822
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},    /* Alternative GGSN Address for User Traffic 7.7.32 */
3823
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3824
            {0, 0, NULL}
3825
        }
3826
    },
3827
    {
3828
        GTP_MSG_SGSN_CNTXT_ACK, {
3829
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3830
            {GTP_EXT_TEID_II, GTP_CONDITIONAL, NULL},
3831
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_sgsn_addr_for_user_plane},
3832
            {GTP_EXT_SGSN_NO, GTP_OPTIONAL, NULL},    /* SGSN Number Optional 7.7.47 */
3833
            {GTP_EXT_NODE_IDENTIFIER, GTP_OPTIONAL, NULL}, /* 7.7.119 */
3834
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3835
            {0, 0, NULL}
3836
        }
3837
    },
3838
    {
3839
        GTP_MSG_FORW_RELOC_REQ, {
3840
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* The IMSI shall not be included in the message if the MS is emergency attached and the MS is UICCless */
3841
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3842
            {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY, NULL},
3843
            {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL, NULL},
3844
            {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL, NULL},     /* ChargingCharacteristics Optional 7.7.23 */
3845
            {GTP_EXT_MM_CNTXT, GTP_MANDATORY, NULL},
3846
            {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL, NULL},
3847
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},
3848
            {GTP_EXT_TARGET_ID, GTP_MANDATORY, NULL},
3849
            {GTP_EXT_UTRAN_CONT, GTP_MANDATORY, NULL},
3850
            {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL, NULL}, /* PDP Context Prioritization Optional 7.7.45 */
3851
            {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL, NULL},   /* MBMS UE Context Optional 7.7.55 */
3852
            {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL, NULL},   /* Selected PLMN ID Optional 7.7.64 */
3853
            {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL, NULL}, /* PS Handover Request Context Optional 7.7.71 */
3854
            {GTP_EXT_BSS_CONT, GTP_OPTIONAL, NULL},      /* BSS Container Optional 7.7.72 */
3855
            {GTP_EXT_CELL_ID, GTP_OPTIONAL, NULL},       /* Cell Identification Optional 7.7.73 */
3856
            {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL, NULL},   /* BSSGP Cause Optional 7.7.75 */
3857
            {GTP_EXT_PS_HANDOVER_XIP_PAR, GTP_OPTIONAL, NULL}, /* 7.7.79 */
3858
            {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL, NULL}, /* Direct Tunnel Flags     7.7.81 */
3859
            {GTP_EXT_RELIABLE_IRAT_HO_INF, GTP_OPTIONAL, NULL},    /* 7.7.87 */
3860
            {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* Subscribed RFSP Index 7.7.88 */
3861
            {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* RFSP Index in use 7.7.88 */
3862
            {GTP_EXT_FQDN, GTP_OPTIONAL, NULL}, /* Co-located GGSN-PGW FQDN 7.7.90 */
3863
            {GTP_EXT_EVO_ALLO_RETE_P2, GTP_OPTIONAL, NULL}, /* 7.7.92 */
3864
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3865
            {GTP_EXT_CSG_ID, GTP_OPTIONAL, NULL}, /* 7.7.96 */
3866
            {GTP_EXT_CMI, GTP_OPTIONAL, NULL}, /* 7.7.97 */
3867
            {GTP_EXT_UE_NETWORK_CAP, GTP_OPTIONAL, NULL}, /* 7.7.99 */
3868
            {GTP_EXT_UE_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.100 */
3869
            {GTP_EXT_APN_AMBR_WITH_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.101 */
3870
            {GTP_EXT_SIG_PRI_IND_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.104 */
3871
            {GTP_EXT_HIGHER_BR_16MB_FLG, GTP_OPTIONAL, NULL}, /* 7.7.105 */
3872
            {GTP_EXT_ADD_MM_CTX_SRVCC, GTP_OPTIONAL, NULL}, /* 7.7.107 */
3873
            {GTP_EXT_ADD_FLGS_SRVCC, GTP_OPTIONAL, NULL}, /* 7.7.108 */
3874
            {GTP_EXT_STN_SR, GTP_OPTIONAL, NULL}, /* 7.7.109 */
3875
            {GTP_EXT_C_MSISDN, GTP_OPTIONAL, NULL}, /* 7.7.110 */
3876
            {GTP_EXT_EXT_RANAP_CAUSE, GTP_OPTIONAL, NULL}, /* 7.7.111 */
3877
            {GTP_EXT_ENODEB_ID, GTP_OPTIONAL, NULL}, /* 7.7.112 */
3878
            {GTP_EXT_SEL_MODE_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.113 */
3879
            {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3880
            {GTP_EXT_EXT_COMMON_FLGS_II, GTP_OPTIONAL, NULL}, /* 7.7.118 */
3881
            {GTP_EXT_SCEF_PDN_CONNECTION, GTP_OPTIONAL, NULL }, /* 7.7.121 */
3882
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},    /* Alternative GGSN Address for Control Plane 7.7.32 */
3883
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},    /* Alternative GGSN Address for User Traffic 7.7.32 */
3884
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3885
            {0, 0, NULL}
3886
        }
3887
    },
3888
    {
3889
        GTP_MSG_FORW_RELOC_RESP, {
3890
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3891
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3892
            {GTP_EXT_TEID_II, GTP_CONDITIONAL, NULL},           /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
3893
            {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL, NULL},
3894
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* SGSN Address for Control plane */
3895
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* SGSN Address for User Traffic - cannot appear without above Address for Control plane */
3896
            {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL, NULL},
3897
            {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL, NULL},
3898
            {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL, NULL}, /* Additional RAB Setup Information Conditional 7.7.45A */
3899
            {GTP_EXT_SGSN_NO, GTP_OPTIONAL, NULL},    /* SGSN Number Optional 7.7.47 */
3900
            {GTP_EXT_BSS_CONT, GTP_OPTIONAL, NULL},      /* BSS Container Optional 7.7.72 */
3901
            {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL, NULL},   /* BSSGP Cause Optional 7.7.75 */
3902
            {GTP_EXT_LIST_OF_SETUP_PFCS, GTP_OPTIONAL, NULL}, /* 7.7.78 */
3903
            {GTP_EXT_EXT_RANAP_CAUSE, GTP_OPTIONAL, NULL}, /* 7.7.111 */
3904
            {GTP_EXT_NODE_IDENTIFIER, GTP_OPTIONAL, NULL}, /* 7.7.119 */
3905
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3906
            {0, 0, NULL}
3907
        }
3908
    },
3909
    {
3910
        GTP_MSG_FORW_RELOC_COMP, {
3911
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3912
            {0, 0, NULL}
3913
        }
3914
    },
3915
    {
3916
        GTP_MSG_RELOC_CANCEL_REQ, {
3917
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* If MS is emergency attached and the MS is UICCless, the IMSI cannot be included. */
3918
            {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL}, /* 7.7.53 */
3919
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3920
            {GTP_EXT_EXT_RANAP_CAUSE, GTP_OPTIONAL, NULL}, /* 7.7.111 */
3921
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3922
            {0, 0, NULL}
3923
        }
3924
    },
3925
    {
3926
        GTP_MSG_RELOC_CANCEL_RESP, {
3927
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3928
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3929
            {0, 0, NULL}
3930
        }
3931
    },
3932
    {
3933
        GTP_MSG_FORW_RELOC_ACK, {
3934
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3935
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3936
            {0, 0, NULL}
3937
        }
3938
    },
3939
    {
3940
        GTP_MSG_FORW_SRNS_CNTXT_ACK, {
3941
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3942
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3943
            {0, 0, NULL}
3944
        }
3945
    },
3946
    {
3947
        GTP_MSG_FORW_SRNS_CNTXT, {
3948
            {GTP_EXT_RAB_CNTXT, GTP_MANDATORY, NULL},
3949
            {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL, NULL}, /* Source RNC PDCP context info Optional 7.7.61 */
3950
            {GTP_EXT_PDU_NO, GTP_OPTIONAL, NULL},              /* PDU Numbers Optional 7.7.74 */
3951
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3952
            {0, 0, NULL}
3953
        }
3954
    },
3955
3956
/*      7.5.14 RAN Information Management Messages */
3957
    {
3958
        GTP_MSG_RAN_INFO_RELAY, {
3959
            {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY, NULL},        /* RAN Transparent Container Mandatory 7.7.43 */
3960
            {GTP_EXT_RIM_RA, GTP_OPTIONAL, NULL},              /* RIM Routing Address Optional 7.7.57 */
3961
            {GTP_EXT_RIM_ROUTING_ADDR_DISC, GTP_OPTIONAL, NULL}, /* 7.7.77 */
3962
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3963
            {0, 0, NULL}
3964
        }
3965
    },
3966
/*      7.5.15 UE Registration Query Request */
3967
    {
3968
        GTP_MSG_UE_REG_QUERY_REQ, {
3969
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3970
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3971
            {0, 0, NULL}
3972
        }
3973
    },
3974
/*      7.5.16 UE Registration Query Response */
3975
    {
3976
        GTP_MSG_UE_REG_QUERY_RESP, {
3977
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3978
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3979
            {GTP_EXT_SEL_PLMN_ID, GTP_CONDITIONAL, NULL}, /* Selected PLMN ID 7.7.64 */
3980
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3981
            {0, 0, NULL}
3982
        }
3983
    },
3984
/* 7.5A MBMS Messages
3985
 * 7.5A.1 UE Specific MBMS Messages
3986
 */
3987
    {
3988
        GTP_MBMS_NOTIFY_REQ, {
3989
            {GTP_EXT_IMSI, GTP_MANDATORY, NULL},              /* IMSI Mandatory 7.7.2 */
3990
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},           /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
3991
            {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},             /* NSAPI Mandatory 7.7.17 */
3992
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},         /* End User Address Mandatory 7.7.27 */
3993
            {GTP_EXT_APN, GTP_MANDATORY, NULL},               /* Access Point Name Mandatory 7.7.30 */
3994
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_ggsn_addr_for_control_plane},          /* GGSN Address for Control Plane Mandatory 7.7.32 */
3995
            {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
3996
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},           /* Private Extension Optional 7.7.46 */
3997
            {0, 0, NULL}
3998
        }
3999
    },
4000
    {
4001
        GTP_MBMS_NOTIFY_RES, {
4002
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},     /* Cause Mandatory 7.7.1 */
4003
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4004
            {0, 0, NULL}
4005
        }
4006
    },
4007
    {
4008
        GTP_MBMS_NOTIFY_REJ_REQ, {
4009
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},     /* Cause Mandatory 7.7.1 */
4010
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},   /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
4011
            {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},     /* NSAPI Mandatory 7.7.17 */
4012
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4013
            {GTP_EXT_APN, GTP_MANDATORY, NULL},       /* Access Point Name Mandatory 7.7.30 */
4014
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, decode_gtp_sgsn_addr_for_control_plane},          /* SGSN Address for Control Plane Optional 7.7.32 */
4015
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4016
            {0, 0, NULL}
4017
        }
4018
    },
4019
    {
4020
        GTP_MBMS_NOTIFY_REJ_RES, {
4021
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},     /* Cause Mandatory 7.7.1 */
4022
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4023
            {0, 0, NULL}
4024
        }
4025
    },
4026
    {
4027
        GTP_CREATE_MBMS_CNTXT_REQ, {
4028
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},            /* IMSI Conditional 7.7.2 */
4029
            {GTP_EXT_RAI, GTP_MANDATORY, NULL},               /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
4030
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},            /* Recovery Optional 7.7.11 */
4031
            {GTP_EXT_SEL_MODE, GTP_CONDITIONAL, NULL},        /* Selection mode Conditional 7.7.12 */
4032
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},         /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4033
            {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL},          /* Trace Reference Optional 7.7.24 */
4034
            {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL},         /* Trace Type Optional 7.7.25 */
4035
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},         /* End User Address Mandatory 7.7.27 */
4036
            {GTP_EXT_APN, GTP_MANDATORY, NULL},               /* Access Point Name Mandatory 7.7.30 */
4037
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},          /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
4038
            {GTP_EXT_MSISDN, GTP_CONDITIONAL, NULL},          /* MSISDN Conditional 7.7.33 */
4039
            {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL},         /* Trigger Id Optional 7.7.41 */
4040
            {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL},             /* OMC Identity Optional 7.7.42 */
4041
            {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL},           /* RAT Type Optional 7.7.50 */
4042
            {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL},        /* User Location Information Optional 7.7.51 */
4043
            {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL},       /* MS Time Zone Optional 7.7.52 */
4044
            {GTP_EXT_IMEISV, GTP_OPTIONAL, NULL},             /* IMEI(SV) Optional 7.7.53 */
4045
            {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4046
            {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL},        /* Additional Trace Info Optional 7.7.62 */
4047
            {GTP_EXT_ENH_NSAPI, GTP_MANDATORY, NULL},         /* Enhanced NSAPI Mandatory 7.7.67 */
4048
            {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL, NULL},   /* Additional MBMS Trace Info Optional 7.7.68 */
4049
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4050
            {0, 0, NULL}
4051
        }
4052
    },
4053
    {
4054
        GTP_CREATE_MBMS_CNTXT_RES, {
4055
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},             /* Cause Mandatory 7.7.1 */
4056
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},            /* Recovery Optional 7.7.11 */
4057
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},         /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4058
            {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},         /* Charging ID Conditional 7.7.26 */
4059
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},        /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4060
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},        /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4061
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},          /* Charging Gateway Address Optional 7.7.44 */
4062
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},          /* Alternative Charging Gateway Address Optional 7.7.44 */
4063
            {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4064
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4065
            {0, 0, NULL}
4066
        }
4067
    },
4068
    {
4069
        GTP_UPD_MBMS_CNTXT_REQ, {
4070
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},          /* IMSI Conditional 7.7.2 */
4071
            {GTP_EXT_RAI, GTP_MANDATORY, NULL},             /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
4072
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},          /* Recovery Optional 7.7.11 */
4073
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},       /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4074
            {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL},        /* Trace Reference Optional 7.7.24 */
4075
            {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL},       /* Trace Type Optional 7.7.25 */
4076
            {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},        /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
4077
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},      /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4078
            {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL},       /* Trigger Id Optional 7.7.41 */
4079
            {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL},           /* OMC Identity Optional 7.7.42 */
4080
            {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL},         /* RAT Type Optional 7.7.50 */
4081
            {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL},      /* User Location Information Optional 7.7.51 */
4082
            {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL},     /* MS Time Zone Optional 7.7.52 */
4083
            {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL},      /* Additional Trace Info Optional 7.7.62 */
4084
            {GTP_EXT_ENH_NSAPI, GTP_MANDATORY, NULL},       /* Enhanced NSAPI Mandatory 7.7.67 */
4085
            {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL, NULL}, /* Additional MBMS Trace Info Optional 7.7.68 */
4086
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4087
            {0, 0, NULL}
4088
        }
4089
    },
4090
    {
4091
        GTP_UPD_MBMS_CNTXT_RES, {
4092
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},      /* Cause Mandatory 7.7.1 */
4093
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},     /* Recovery Optional 7.7.11 */
4094
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},    /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4095
            {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},  /* Charging ID Conditional 7.7.26 */
4096
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4097
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4098
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},   /* Charging Gateway Address Optional 7.7.44 */
4099
            {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},   /* Alternative Charging Gateway Address Optional 7.7.44 */
4100
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},    /* Private Extension Optional 7.7.46 */
4101
            {0, 0, NULL}
4102
        }
4103
    },
4104
    {
4105
        GTP_DEL_MBMS_CNTXT_REQ, {
4106
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},            /* IMSI Conditional 7.7.2 */
4107
            {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},           /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4108
            {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},       /* End User Address Conditional 7.7.27 */
4109
            {GTP_EXT_APN, GTP_CONDITIONAL, NULL},             /* Access Point Name Conditional 7.7.30 */
4110
            {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4111
            {GTP_EXT_ENH_NSAPI, GTP_MANDATORY, NULL},         /* Enhanced NSAPI Conditional 7.7.67 */
4112
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},           /* Private Extension Optional 7.7.46 */
4113
            {0, 0, NULL}
4114
        }
4115
    },
4116
    {
4117
        GTP_DEL_MBMS_CNTXT_RES, {
4118
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},             /* Cause Mandatory 7.7.1 */
4119
            {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4120
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4121
            {0, 0, NULL}
4122
        }
4123
    },
4124
    {
4125
        GTP_MBMS_REG_REQ, {
4126
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},           /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4127
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4128
            {GTP_EXT_APN, GTP_MANDATORY, NULL},       /* Access Point Name Mandatory 7.7.30 */
4129
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_sgsn_addr_for_control_plane},        /* SGSN Address for Control Plane GSN Address 7.7.32 */
4130
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},      /* Alternative SGSN Address for Control Plane GSN Address 7.7.32 */
4131
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4132
            {0, 0, NULL}
4133
        }
4134
    },
4135
    {
4136
        GTP_MBMS_REG_RES, {
4137
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},     /* Cause Mandatory 7.7.1 */
4138
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},           /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4139
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4140
            {GTP_EXT_TMGI, GTP_CONDITIONAL, NULL},      /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
4141
            {GTP_EXT_REQ_MBMS_BEARER_CAP, GTP_CONDITIONAL, NULL}, /* 7.7.76 */
4142
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4143
            {0, 0, NULL}
4144
        }
4145
    },
4146
    {
4147
        GTP_MBMS_DE_REG_REQ, {
4148
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4149
            {GTP_EXT_APN, GTP_MANDATORY, NULL},       /* Access Point Name Mandatory 7.7.30 */
4150
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4151
            {0, 0, NULL}
4152
        }
4153
    },
4154
    {
4155
        GTP_MBMS_DE_REG_RES, {
4156
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},     /* Cause Mandatory 7.7.1 */
4157
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4158
            {0, 0, NULL}
4159
        }
4160
    },
4161
    {
4162
        GTP_MBMS_SES_START_REQ, {
4163
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},               /* Recovery Optional 7.7.11 */
4164
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},            /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4165
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},            /* End User Address Mandatory 7.7.27 */
4166
            {GTP_EXT_APN, GTP_MANDATORY, NULL},                  /* Access Point Name Mandatory 7.7.30 */
4167
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},           /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4168
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},              /* Alternative GGSN Address for Control Plane GSN Address 7.7.32 */
4169
            {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL},             /* Quality of Service Profile Mandatory 7.7.34 */
4170
            {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL},           /* Common Flags Mandatory 7.7.48 */
4171
            {GTP_EXT_TMGI, GTP_MANDATORY, NULL},                 /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
4172
            {GTP_EXT_MBMS_SA, GTP_MANDATORY, NULL},              /* MBMS Service Area Mandatory 7.7.60 */
4173
            {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL, NULL},           /* MBMS Session Identifier Optional 7.7.65 */
4174
            {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY, NULL},       /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
4175
            {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY, NULL},         /* MBMS Session Duration Mandatory 7.7.59 */ /* V16.0.0 has it here. */
4176
            {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL, NULL},    /* MBMS Session Identity Repetition Number Optional 7.7.69 */
4177
            {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY, NULL}, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
4178
            {GTP_EXT_MBMS_FLOW_ID, GTP_OPTIONAL, NULL}, /* 7.7.84 */
4179
            {GTP_EXT_MBMS_IP_MCAST_DIST, GTP_OPTIONAL, NULL}, /* 7.7.85 */
4180
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},              /* Private Extension Optional 7.7.46 */
4181
            {0, 0, NULL}
4182
        }
4183
    },
4184
    {
4185
        GTP_MBMS_SES_START_RES, {
4186
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},      /* Cause Mandatory 7.7.1 */
4187
            {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},     /* Recovery Optional 7.7.11 */
4188
            {GTP_EXT_TEID, GTP_CONDITIONAL, NULL},     /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
4189
            {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},  /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4190
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4191
            {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
4192
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative SGSN Address for user traffic GSN Address 7.7.32 */
4193
            {GTP_EXT_MBMS_DIST_ACK, GTP_OPTIONAL, NULL}, /* 7.7.86 */
4194
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},    /* Private Extension Optional 7.7.46 */
4195
            {0, 0, NULL}
4196
        }
4197
    },
4198
    {
4199
        GTP_MBMS_SES_STOP_REQ, {
4200
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4201
            {GTP_EXT_APN, GTP_MANDATORY, NULL},       /* Access Point Name Mandatory 7.7.30 */
4202
            {GTP_EXT_MBMS_FLOW_ID, GTP_OPTIONAL, NULL}, /* 7.7.84 */
4203
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4204
            {0, 0, NULL}
4205
        }
4206
    },
4207
    {
4208
        GTP_MBMS_SES_STOP_RES, {
4209
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},     /* Cause Mandatory 7.7.1 */
4210
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4211
            {0, 0, NULL}
4212
        }
4213
    },
4214
    {
4215
        GTP_MBMS_SES_UPD_REQ, {
4216
            {GTP_EXT_TEID_CP, GTP_OPTIONAL, NULL},  /* Tunnel Endpoint Identifier Control Plane 7.7.14 */
4217
            {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4218
            {GTP_EXT_APN, GTP_MANDATORY, NULL},       /* Access Point Name Mandatory 7.7.30 */
4219
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},           /* GGSN Address for Control Plane GSN Address 7.7.32 */
4220
            {GTP_EXT_TMGI, GTP_MANDATORY, NULL},                 /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
4221
            {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY, NULL},         /* MBMS Session Duration Mandatory 7.7.59 */ /* V16.0.0 has it here. */
4222
            {GTP_EXT_MBMS_SA, GTP_MANDATORY, NULL},              /* MBMS Service Area Mandatory 7.7.60 */
4223
            {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL, NULL},           /* MBMS Session Identifier Optional 7.7.65 */
4224
            {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL, NULL},    /* MBMS Session Identity Repetition Number Optional 7.7.69 */
4225
            {GTP_EXT_MBMS_FLOW_ID, GTP_OPTIONAL, NULL}, /* 7.7.84 */
4226
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4227
            {0, 0, NULL}
4228
        }
4229
    },
4230
    {
4231
        GTP_MBMS_SES_UPD_RES, {
4232
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},     /* Cause Mandatory 7.7.1 */
4233
            {GTP_EXT_TEID, GTP_OPTIONAL, NULL},     /* Tunnel Endpoint Identifier Data I 7.7.13 */
4234
            {GTP_EXT_TEID_CP, GTP_OPTIONAL, NULL},  /* Tunnel Endpoint Identifier Control Plane 7.7.14 */
4235
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* SGSN Address for Data I GSN Address 7.7.32 */
4236
            {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* SGSN Address for Control Plane GSN Address 7.7.32 */
4237
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4238
            {0, 0, NULL}
4239
        }
4240
    },
4241
    {
4242
        GTP_MS_INFO_CNG_NOT_REQ, {
4243
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* IMSI Conditional 7.7.2 */
4244
            {GTP_EXT_NSAPI, GTP_OPTIONAL, NULL}, /* Linked NSAPI Optional 7.7.17 */
4245
            {GTP_EXT_RAT_TYPE, GTP_MANDATORY, NULL}, /* RAT Type 7.7.50 */
4246
            {GTP_EXT_USR_LOC_INF, GTP_CONDITIONAL, NULL},/* User Location Information 7.7.51 */
4247
            {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL}, /* IMEI(SV) 7.7.53 */
4248
            {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
4249
            {GTP_EXT_UCI, GTP_OPTIONAL, NULL}, /* 7.7.94 */
4250
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4251
            {0, 0, NULL}
4252
        }
4253
    },
4254
    {
4255
        GTP_MS_INFO_CNG_NOT_RES, {
4256
            {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},  /* Cause Mandatory 7.7.1 */
4257
            {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* IMSI Conditional 7.7.2 */
4258
            {GTP_EXT_NSAPI, GTP_OPTIONAL, NULL}, /* Linked NSAPI Optional 7.7.17 */
4259
            {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL}, /* IMEI(SV) 7.7.53 */
4260
            {GTP_EXT_MS_INF_CHG_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.80 */
4261
            {GTP_EXT_CSG_INF_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.95 */
4262
            {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},   /* Private Extension Optional 7.7.46 */
4263
            {0, 0, NULL}
4264
        }
4265
    },
4266
    {
4267
        0, {
4268
            {0, 0, NULL}
4269
        }
4270
    }
4271
};
4272
4273
/* Data structure attached to a  conversation,
4274
        to keep track of request/response-pairs
4275
 */
4276
typedef struct gtp_conv_info_t {
4277
    wmem_map_t             *unmatched;
4278
    wmem_map_t             *matched;
4279
} gtp_conv_info_t;
4280
4281
static unsigned
4282
gtp_sn_hash(const void *k)
4283
3.71k
{
4284
3.71k
    const gtp_msg_hash_t *key = (const gtp_msg_hash_t *)k;
4285
4286
3.71k
    return key->seq_nr;
4287
3.71k
}
4288
4289
static int
4290
gtp_sn_equal_matched(const void *k1, const void *k2)
4291
415
{
4292
415
    const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
4293
415
    const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
4294
415
    double diff;
4295
415
    nstime_t delta;
4296
4297
415
    if ( key1->req_frame && key2->req_frame && (key1->req_frame != key2->req_frame) ) {
4298
30
        return 0;
4299
30
    }
4300
4301
385
    if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame != key2->rep_frame) ) {
4302
271
        return 0;
4303
271
    }
4304
4305
114
    if (pref_pair_matching_max_interval_ms) {
4306
0
        nstime_delta(&delta, &key1->req_time, &key2->req_time);
4307
0
        diff = fabs(nstime_to_msec(&delta));
4308
4309
0
        return key1->seq_nr == key2->seq_nr && diff < pref_pair_matching_max_interval_ms;
4310
0
    }
4311
4312
114
    return key1->seq_nr == key2->seq_nr;
4313
114
}
4314
4315
static int
4316
gtp_sn_equal_unmatched(const void *k1, const void *k2)
4317
325
{
4318
325
    const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
4319
325
    const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
4320
325
    double diff;
4321
325
    nstime_t delta;
4322
4323
325
    if (pref_pair_matching_max_interval_ms) {
4324
0
        nstime_delta(&delta, &key1->req_time, &key2->req_time);
4325
0
        diff = fabs(nstime_to_msec(&delta));
4326
4327
0
        return key1->seq_nr == key2->seq_nr && diff < pref_pair_matching_max_interval_ms;
4328
0
    }
4329
4330
325
    return key1->seq_nr == key2->seq_nr;
4331
325
}
4332
4333
static gtp_conv_info_t *
4334
find_or_create_gtp_conv_info(packet_info *pinfo, conversation_t *conversation)
4335
2.02k
{
4336
2.02k
    gtp_conv_info_t *gtp_info;
4337
4338
2.02k
    if (conversation == NULL) {
4339
        /* XXX - Note 3GPP TS 29.060 10.1 UDP/IP that the destination address
4340
         * of the request and the source address of the response do NOT have
4341
         * to match (unlike the source of request and destination of response,
4342
         * and both sets of ports). So ideally this should be a conversation
4343
         * that matches on three parameters but not all four. We might have to
4344
         * use the msg_type to know whether it's a request or response, though,
4345
         * which might mean doing this inside gtp_match_response.
4346
         */
4347
2.02k
        conversation = find_or_create_conversation(pinfo);
4348
2.02k
    }
4349
4350
    /*
4351
    * Do we already know this conversation?
4352
    */
4353
2.02k
    gtp_info = (gtp_conv_info_t *)conversation_get_proto_data(conversation, proto_gtp);
4354
2.02k
    if (gtp_info == NULL) {
4355
        /* No.  Attach that information to the conversation, and add
4356
        * it to the list of information structures.
4357
        */
4358
450
        gtp_info = wmem_new(wmem_file_scope(), gtp_conv_info_t);
4359
        /*Request/response matching tables*/
4360
450
        gtp_info->matched = wmem_map_new(wmem_file_scope(), gtp_sn_hash, gtp_sn_equal_matched);
4361
450
        gtp_info->unmatched = wmem_map_new(wmem_file_scope(), gtp_sn_hash, gtp_sn_equal_unmatched);
4362
4363
450
        conversation_add_proto_data(conversation, proto_gtp, gtp_info);
4364
450
    }
4365
4366
2.02k
    return gtp_info;
4367
2.02k
}
4368
4369
static gtp_msg_hash_t *
4370
gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int seq_nr, unsigned msgtype, gtp_conv_info_t *gtp_info, uint8_t last_cause)
4371
3.35k
{
4372
3.35k
    gtp_msg_hash_t   gcr, *gcrp = NULL;
4373
3.35k
    uint32_t session;
4374
4375
3.35k
    gcr.seq_nr=seq_nr;
4376
3.35k
    gcr.req_time = pinfo->abs_ts;
4377
4378
3.35k
    switch (msgtype) {
4379
21
    case GTP_MSG_ECHO_REQ:
4380
29
    case GTP_MSG_CREATE_PDP_REQ:
4381
52
    case GTP_MSG_UPDATE_PDP_REQ:
4382
59
    case GTP_MSG_DELETE_PDP_REQ:
4383
77
    case GTP_MSG_FORW_RELOC_REQ:
4384
80
    case GTP_MSG_DATA_TRANSF_REQ:
4385
114
    case GTP_MSG_SGSN_CNTXT_REQ:
4386
116
    case GTP_MS_INFO_CNG_NOT_REQ:
4387
128
    case GTP_MSG_IDENT_REQ:
4388
128
        gcr.is_request=true;
4389
128
        gcr.req_frame=pinfo->num;
4390
128
        gcr.rep_frame=0;
4391
128
        break;
4392
31
    case GTP_MSG_ECHO_RESP:
4393
41
    case GTP_MSG_CREATE_PDP_RESP:
4394
57
    case GTP_MSG_UPDATE_PDP_RESP:
4395
66
    case GTP_MSG_DELETE_PDP_RESP:
4396
108
    case GTP_MSG_FORW_RELOC_RESP:
4397
3.04k
    case GTP_MSG_DATA_TRANSF_RESP:
4398
3.05k
    case GTP_MSG_SGSN_CNTXT_RESP:
4399
3.06k
    case GTP_MS_INFO_CNG_NOT_RES:
4400
3.07k
    case GTP_MSG_IDENT_RESP:
4401
3.07k
        gcr.is_request=false;
4402
3.07k
        gcr.req_frame=0;
4403
3.07k
        gcr.rep_frame=pinfo->num;
4404
3.07k
        break;
4405
150
    default:
4406
150
        gcr.is_request=false;
4407
150
        gcr.req_frame=0;
4408
150
        gcr.rep_frame=0;
4409
150
        break;
4410
3.35k
    }
4411
4412
3.35k
    gcrp = (gtp_msg_hash_t *)wmem_map_lookup(gtp_info->matched, &gcr);
4413
4414
3.35k
    if (gcrp) {
4415
4416
93
        gcrp->is_request=gcr.is_request;
4417
4418
3.25k
    } else {
4419
4420
        /*no match, let's try to make one*/
4421
3.25k
        switch (msgtype) {
4422
21
        case GTP_MSG_ECHO_REQ:
4423
29
        case GTP_MSG_CREATE_PDP_REQ:
4424
52
        case GTP_MSG_UPDATE_PDP_REQ:
4425
59
        case GTP_MSG_DELETE_PDP_REQ:
4426
77
        case GTP_MSG_FORW_RELOC_REQ:
4427
80
        case GTP_MSG_DATA_TRANSF_REQ:
4428
114
        case GTP_MSG_SGSN_CNTXT_REQ:
4429
116
        case GTP_MS_INFO_CNG_NOT_REQ:
4430
128
        case GTP_MSG_IDENT_REQ:
4431
128
            gcr.seq_nr=seq_nr;
4432
4433
128
            gcrp=(gtp_msg_hash_t *)wmem_map_lookup(gtp_info->unmatched, &gcr);
4434
128
            if (gcrp) {
4435
51
                wmem_map_remove(gtp_info->unmatched, gcrp);
4436
51
            }
4437
            /* if we can't reuse the old one, grab a new chunk */
4438
128
            if (!gcrp) {
4439
77
                gcrp = wmem_new(wmem_file_scope(), gtp_msg_hash_t);
4440
77
            }
4441
128
            gcrp->seq_nr=seq_nr;
4442
128
            gcrp->req_frame = pinfo->num;
4443
128
            gcrp->req_time = pinfo->abs_ts;
4444
128
            gcrp->rep_frame = 0;
4445
128
            gcrp->msgtype = msgtype;
4446
128
            gcrp->is_request = true;
4447
128
            wmem_map_insert(gtp_info->unmatched, gcrp, gcrp);
4448
128
            return NULL;
4449
31
        case GTP_MSG_ECHO_RESP:
4450
41
        case GTP_MSG_CREATE_PDP_RESP:
4451
57
        case GTP_MSG_UPDATE_PDP_RESP:
4452
66
        case GTP_MSG_DELETE_PDP_RESP:
4453
108
        case GTP_MSG_FORW_RELOC_RESP:
4454
2.95k
        case GTP_MSG_DATA_TRANSF_RESP:
4455
2.96k
        case GTP_MSG_SGSN_CNTXT_RESP:
4456
2.97k
        case GTP_MS_INFO_CNG_NOT_RES:
4457
2.98k
        case GTP_MSG_IDENT_RESP:
4458
2.98k
            gcr.seq_nr=seq_nr;
4459
2.98k
            gcrp=(gtp_msg_hash_t *)wmem_map_lookup(gtp_info->unmatched, &gcr);
4460
4461
2.98k
            if (gcrp) {
4462
13
                if (!gcrp->rep_frame) {
4463
13
                    wmem_map_remove(gtp_info->unmatched, gcrp);
4464
13
                    gcrp->rep_frame=pinfo->num;
4465
13
                    gcrp->is_request=false;
4466
13
                    wmem_map_insert(gtp_info->matched, gcrp, gcrp);
4467
13
                }
4468
13
            }
4469
2.98k
            break;
4470
148
        default:
4471
148
            break;
4472
3.25k
        }
4473
3.25k
    }
4474
4475
    /* we have found a match */
4476
3.22k
    if (gcrp) {
4477
106
        proto_item *it;
4478
4479
4480
106
        if (gcrp->is_request) {
4481
0
            it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
4482
0
            proto_item_set_generated(it);
4483
106
        } else {
4484
106
            nstime_t ns;
4485
4486
106
            it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
4487
106
            proto_item_set_generated(it);
4488
106
            nstime_delta(&ns, &pinfo->abs_ts, &gcrp->req_time);
4489
106
            it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
4490
106
            proto_item_set_generated(it);
4491
106
            if (g_gtp_session) {
4492
0
                if (!PINFO_FD_VISITED(pinfo) && gtp_version == 1) {
4493
                    /* GTP session */
4494
                    /* If it does not have any session assigned yet */
4495
0
                    session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
4496
0
                    if (!session) {
4497
0
                        session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(gcrp->req_frame)));
4498
0
                        if (session) {
4499
0
                            add_gtp_session(pinfo->num, session);
4500
0
                        }
4501
0
                    }
4502
4503
0
                    if (!is_cause_accepted(last_cause, gtp_version)){
4504
                        /* If the cause is not accepted then we have to remove all the session information about its corresponding request */
4505
0
                        remove_frame_info(gcrp->req_frame);
4506
0
                    }
4507
0
                }
4508
0
            }
4509
106
        }
4510
106
    }
4511
3.22k
    return gcrp;
4512
3.35k
}
4513
4514
4515
static int
4516
check_field_presence_and_decoder(uint8_t version, uint8_t message, uint8_t field, int *position, ie_decoder **alt_decoder)
4517
0
{
4518
4519
0
    unsigned i = 0;
4520
0
    const _gtp_mess_items *mess_items;
4521
4522
0
    switch (version) {
4523
0
    case 0:
4524
0
        mess_items = gprs_mess_items;
4525
0
        break;
4526
0
    case 1:
4527
0
        mess_items = umts_mess_items;
4528
0
        break;
4529
0
    default:
4530
0
        return -2;
4531
0
    }
4532
4533
0
    while (mess_items[i].code) {
4534
0
        if (mess_items[i].code == message) {
4535
4536
0
            while (mess_items[i].fields[*position].code) {
4537
0
                if (mess_items[i].fields[*position].code == field) {
4538
0
                    *alt_decoder = mess_items[i].fields[*position].alt_decoder;
4539
0
                    (*position)++;
4540
0
                    return 0;
4541
0
                } else {
4542
0
                    if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
4543
0
                        return mess_items[i].fields[(*position)++].code;
4544
0
                    } else {
4545
0
                        (*position)++;
4546
0
                    }
4547
0
                }
4548
0
            }
4549
0
            return -1;
4550
0
        }
4551
0
        i++;
4552
0
    }
4553
4554
0
    return -2;
4555
0
}
4556
4557
/* Decoders of fields in extension headers, each function returns no of bytes from field */
4558
4559
/* GPRS:        9.60 v7.6.0, chapter
4560
 * UMTS:        29.060 v4.0, chapter
4561
 * 7.7.1 Cause
4562
 */
4563
static int
4564
decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args)
4565
360
{
4566
360
    uint8_t cause;
4567
4568
360
    cause = tvb_get_uint8(tvb, offset + 1);
4569
360
    if (g_gtp_session) {
4570
0
        args->last_cause = cause;
4571
0
    }
4572
360
    proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
4573
4574
360
    return 2;
4575
360
}
4576
4577
/* GPRS:        9.60 v7.6.0, chapter 7.9.2
4578
 * UMTS:        29.060 v4.0, chapter 7.7.2
4579
 */
4580
static int
4581
decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4582
202
{
4583
    /* const char *imsi_str; */
4584
4585
    /* Octets 2 - 9 IMSI */
4586
202
    /* imsi_str = */ dissect_e212_imsi(tvb, pinfo, tree,  offset+1, 8, false);
4587
4588
202
    return 9;
4589
202
}
4590
4591
/* GPRS:        9.60 v7.6.0, chapter 7.9.3
4592
 * UMTS:        29.060 v4.0, chapter 7.7.3 Routeing Area Identity (RAI)
4593
 */
4594
static int
4595
decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4596
123
{
4597
4598
123
    proto_tree *ext_tree_rai;
4599
4600
123
    ext_tree_rai = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ies[GTP_EXT_RAI], NULL,
4601
123
                            val_to_str_ext_const(GTP_EXT_RAI, &gtp_val_ext, "Unknown message"));
4602
4603
123
    dissect_e212_mcc_mnc(tvb, pinfo, ext_tree_rai, offset+1, E212_RAI, true);
4604
123
    proto_tree_add_item(ext_tree_rai, hf_gtp_lac, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
4605
123
    proto_tree_add_item(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
4606
4607
123
    return 7;
4608
123
}
4609
4610
/* GPRS:        9.60 v7.6.0, chapter 7.9.4, page 39
4611
 * UMTS:        29.060 v4.0, chapter 7.7.4 Temporary Logical Link Identity (TLLI)
4612
 */
4613
static int
4614
decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4615
104
{
4616
4617
104
    uint32_t tlli;
4618
4619
104
    tlli = tvb_get_ntohl(tvb, offset + 1);
4620
104
    proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
4621
4622
104
    return 5;
4623
104
}
4624
4625
/* GPRS:        9.60 v7.6.0, chapter 7.9.5, page 39
4626
 * UMTS:        29.060 v4.0, chapter 7.7.5 Packet TMSI (P-TMSI)
4627
 */
4628
static int
4629
decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4630
78
{
4631
78
    proto_item* ti;
4632
4633
78
    proto_tree_add_item(tree, hf_gtp_ptmsi, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
4634
78
    ti = proto_tree_add_item(tree, hf_3gpp_tmsi, tvb, offset+1, 4, ENC_BIG_ENDIAN);
4635
78
    proto_item_set_hidden(ti);
4636
4637
78
    return 5;
4638
78
}
4639
4640
/*
4641
 * adjust - how many bytes before offset should be highlighted
4642
 */
4643
static int
4644
decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const char * qos_str, uint8_t adjust)
4645
262
{
4646
4647
262
    uint8_t     spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
4648
262
    proto_tree *ext_tree_qos;
4649
4650
262
    spare1      = tvb_get_uint8(tvb, offset)     & GTP_EXT_QOS_SPARE1_MASK;
4651
262
    delay       = tvb_get_uint8(tvb, offset)     & GTP_EXT_QOS_DELAY_MASK;
4652
262
    reliability = tvb_get_uint8(tvb, offset)     & GTP_EXT_QOS_RELIABILITY_MASK;
4653
262
    peak        = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
4654
262
    spare2      = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
4655
262
    precedence  = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
4656
262
    spare3      = tvb_get_uint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
4657
262
    mean        = tvb_get_uint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
4658
4659
262
    ext_tree_qos = proto_tree_add_subtree_format(tree, tvb, offset - adjust, 3 + adjust, ett_gtp_qos, NULL,
4660
262
                             "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
4661
262
                             qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
4662
4663
262
    if (adjust != 0) {
4664
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1,      tvb, offset,     1, spare1);
4665
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay,       tvb, offset,     1, delay);
4666
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset,     1, reliability);
4667
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak,        tvb, offset + 1, 1, peak);
4668
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2,      tvb, offset + 1, 1, spare2);
4669
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence,  tvb, offset + 1, 1, precedence);
4670
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3,      tvb, offset + 2, 1, spare3);
4671
233
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean,        tvb, offset + 2, 1, mean);
4672
233
    }
4673
4674
262
    return 3;
4675
262
}
4676
4677
/* GPRS:        9.60 v7.6.0, chapter 7.9.6, page 39
4678
 *              4.08
4679
 *              3.60
4680
 * UMTS:        not present
4681
 * TODO:        check if length is included: ETSI 4.08 vs 9.60
4682
 */
4683
static int
4684
decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4685
233
{
4686
4687
233
    return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
4688
4689
233
}
4690
4691
/* GPRS:        9.60 v7.6.0, chapter 7.9.7, page 39
4692
 * UMTS:        29.060 v4.0, chapter 7.7.6 Reordering Required
4693
 */
4694
static int
4695
decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4696
274
{
4697
4698
274
    uint8_t reorder;
4699
4700
274
    reorder = tvb_get_uint8(tvb, offset + 1) & 0x01;
4701
274
    proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
4702
4703
274
    return 2;
4704
274
}
4705
4706
/* GPRS:        9.60 v7.6.0, chapter 7.9.8, page 40
4707
 *              4.08 v7.1.2, chapter 10.5.3.1+
4708
 * UMTS:        29.060 v4.0, chapter 7.7.7
4709
 * TODO: Add blurb support by registering items in the protocol registration
4710
 */
4711
static int
4712
decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4713
30
{
4714
4715
30
    proto_tree *ext_tree_auth_tri;
4716
4717
30
    ext_tree_auth_tri = proto_tree_add_subtree(tree, tvb, offset, 29, ett_gtp_ies[GTP_EXT_AUTH_TRI], NULL,
4718
30
                            val_to_str_ext_const(GTP_EXT_AUTH_TRI, &gtp_val_ext, "Unknown message"));
4719
4720
30
    proto_tree_add_item(ext_tree_auth_tri, hf_gtp_rand, tvb, offset + 1, 16, ENC_NA);
4721
30
    proto_tree_add_item(ext_tree_auth_tri, hf_gtp_sres, tvb, offset + 17, 4, ENC_NA);
4722
30
    proto_tree_add_item(ext_tree_auth_tri, hf_gtp_kc, tvb, offset + 21, 8, ENC_NA);
4723
4724
30
    return 1 + 16 + 4 + 8;
4725
30
}
4726
4727
/* GPRS:        9.60 v7.6.0, chapter 7.9.9, page 40
4728
 *              9.02 v7.7.0, page 1090
4729
 * UMTS:        29.060 v4.0, chapter 7.7.8, page 48
4730
 *              29.002 v4.2.1, chapter 17.5, page 268
4731
 */
4732
static int
4733
decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4734
36
{
4735
4736
36
    uint8_t map_cause;
4737
4738
36
    map_cause = tvb_get_uint8(tvb, offset + 1);
4739
36
    proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
4740
4741
36
    return 2;
4742
36
}
4743
4744
/* GPRS:        9.60 v7.6.0, chapter 7.9.10, page 41
4745
 * UMTS:        29.060 v4.0, chapter 7.7.9, page 48
4746
 */
4747
static int
4748
decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4749
88
{
4750
4751
88
    uint32_t ptmsi_sig;
4752
4753
88
    ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
4754
88
    proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
4755
4756
88
    return 4;
4757
88
}
4758
4759
/* GPRS:        9.60 v7.6.0, chapter 7.9.11, page 41
4760
 * UMTS:        29.060 v4.0, chapter 7.7.10, page 49
4761
 */
4762
static int
4763
decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4764
110
{
4765
4766
110
    uint8_t ms_valid;
4767
4768
110
    ms_valid = tvb_get_uint8(tvb, offset + 1) & 0x01;
4769
110
    proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
4770
4771
110
    return 2;
4772
110
}
4773
4774
/* GPRS:        9.60 v7.6.0, chapter 7.9.12, page 41
4775
 * UMTS:        29.060 v4.0, chapter 7.7.11 Recovery
4776
 */
4777
static int
4778
decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4779
69
{
4780
4781
69
    uint8_t recovery;
4782
4783
69
    recovery = tvb_get_uint8(tvb, offset + 1);
4784
69
    proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
4785
4786
69
    return 2;
4787
69
}
4788
4789
/* GPRS:        9.60 v7.6.0, chapter 7.9.13, page 42
4790
 * UMTS:        29.060 v4.0, chapter 7.7.12 Selection Mode
4791
 */
4792
4793
4794
static const char *
4795
dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
4796
0
{
4797
0
    uint8_t sel_mode;
4798
4799
    /* Value in ASCII(UTF-8) */
4800
0
    sel_mode = tvb_get_uint8(tvb, 0) - 0x30;
4801
0
    proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
4802
4803
0
    return val_to_str_const(sel_mode, gtp_sel_mode_vals, "Unknown");
4804
0
}
4805
4806
static int
4807
decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4808
103
{
4809
103
    proto_tree *ext_tree;
4810
103
    proto_item *te;
4811
103
    uint8_t sel_mode;
4812
4813
103
    sel_mode = tvb_get_uint8(tvb, offset + 1) & 0x03;
4814
4815
103
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_gtp_ies[GTP_EXT_SEL_MODE], &te,
4816
103
                            val_to_str_ext_const(GTP_EXT_SEL_MODE, &gtp_val_ext, "Unknown message"));
4817
103
    proto_item_append_text(te, ": %s", val_to_str_const(sel_mode, gtp_sel_mode_vals, "Unknown"));
4818
103
    proto_tree_add_item(ext_tree, hf_gtp_sel_mode, tvb, offset+1, 1, ENC_BIG_ENDIAN);
4819
4820
103
    return 2;
4821
103
}
4822
4823
/* GPRS:        9.60 v7.6.0, chapter 7.9.14, page 42
4824
 * UMTS:        29.060 v4.0, chapter 7.7.13, page 50
4825
 */
4826
static int
4827
decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
4828
94
{
4829
4830
94
    uint16_t ext_flow_label;
4831
94
    uint32_t teid_data, *teid;
4832
4833
94
    switch (gtp_version) {
4834
34
    case 0:
4835
34
        ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
4836
34
        proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
4837
4838
34
        return 3;
4839
60
    case 1:
4840
60
        teid_data = tvb_get_ntohl(tvb, offset + 1);
4841
        /* We save the teid_data so that we could assignate its corresponding session ID later */
4842
60
        if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) {
4843
0
            args->last_teid = teid_data; /* We save it to track the error indication */
4844
0
            if (!teid_exists(teid_data, args->teid_list)) {
4845
0
                teid = wmem_new(pinfo->pool, uint32_t);
4846
0
                *teid = teid_data;
4847
0
                wmem_list_prepend(args->teid_list, teid);
4848
0
            }
4849
0
        }
4850
60
        proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset+1, 4, teid_data);
4851
4852
60
        return 5;
4853
0
    default:
4854
0
        proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4855
0
                    tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
4856
4857
0
        return 3;
4858
94
    }
4859
94
}
4860
4861
/* GPRS:        9.60 v7.6.0, chapter 7.9.15, page 42
4862
 * UMTS:        29.060 v4.0, chapter 7.7.14, page 42
4863
 */
4864
static int
4865
decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
4866
93
{
4867
4868
93
    uint32_t teid_cp;
4869
93
    uint32_t *teid;
4870
4871
93
    switch (gtp_version) {
4872
82
    case 0:
4873
82
        proto_tree_add_item(tree, hf_gtp_flow_sig, tvb, offset+1, 2, ENC_BIG_ENDIAN);
4874
82
        return 3;
4875
11
    case 1:
4876
11
        proto_tree_add_item_ret_uint(tree, hf_gtp_teid_cp, tvb, offset+1 , 4, ENC_BIG_ENDIAN, &teid_cp);
4877
        /* We save the teid_cp so that we could assignate its corresponding session ID later */
4878
11
        if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) {
4879
0
            if (!teid_exists(teid_cp, args->teid_list)) {
4880
0
                teid = wmem_new(pinfo->pool, uint32_t);
4881
0
                *teid = teid_cp;
4882
0
                wmem_list_prepend(args->teid_list, teid);
4883
0
            }
4884
0
        }
4885
11
        return 5;
4886
0
    default:
4887
0
        proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4888
0
            tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
4889
0
        return 3;
4890
93
    }
4891
93
}
4892
4893
/* GPRS:        9.60 v7.6.0, chapter 7.9.16, page 42
4894
 * UMTS:        29.060 v4.0, chapter 7.7.15, page 51
4895
 */
4896
static int
4897
decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4898
178
{
4899
4900
178
    uint16_t    flow_ii;
4901
178
    uint32_t    teid_ii;
4902
178
    proto_tree *ext_tree_flow_ii;
4903
4904
178
    switch (gtp_version) {
4905
97
    case 0:
4906
97
        ext_tree_flow_ii = proto_tree_add_subtree(tree, tvb, offset, 4, ett_gtp_ies[GTP_EXT_FLOW_II], NULL,
4907
97
                        val_to_str_ext_const(GTP_EXT_FLOW_II, &gtp_val_ext, "Unknown message"));
4908
4909
97
        proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4910
4911
97
        flow_ii = tvb_get_ntohs(tvb, offset + 2);
4912
97
        proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
4913
4914
97
        return 4;
4915
81
    case 1:
4916
81
        ext_tree_flow_ii = proto_tree_add_subtree(tree, tvb, offset, 6, ett_gtp_flow_ii, NULL,
4917
81
                val_to_str_ext_const(GTP_EXT_TEID_II, &gtpv1_val_ext, "Unknown message"));
4918
4919
81
        proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4920
4921
81
        teid_ii = tvb_get_ntohl(tvb, offset + 2);
4922
81
        proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
4923
4924
81
        return 6;
4925
0
    default:
4926
0
        proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4927
0
            tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
4928
4929
0
        return 4;
4930
178
    }
4931
178
}
4932
4933
/* GPRS:        9.60 v7.6.0, chapter 7.9.16A, page 43
4934
 * UMTS:        29.060 v4.0, chapter 7.7.16, page 51
4935
 * Check if all ms_reason types are included
4936
 */
4937
static int
4938
decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4939
430
{
4940
4941
430
    uint8_t field19;
4942
4943
430
    field19 = tvb_get_uint8(tvb, offset + 1);
4944
4945
430
    switch (gtp_version) {
4946
392
    case 0:
4947
392
        proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
4948
392
        break;
4949
38
    case 1:
4950
38
        proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
4951
38
        break;
4952
0
    default:
4953
0
        proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4954
0
            tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
4955
0
        break;
4956
430
    }
4957
4958
430
    return 2;
4959
430
}
4960
4961
/* GPRS:        not present
4962
 * UMTS:        29.060 v4.0, chapter 7.7.17, page 51
4963
 */
4964
static int
4965
decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4966
207
{
4967
207
    uint8_t     nsapi;
4968
207
    proto_tree *ext_tree;
4969
207
    proto_item *te;
4970
4971
207
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_gtp_ies[GTP_EXT_NSAPI], &te,
4972
207
                            val_to_str_ext_const(GTP_EXT_NSAPI, &gtp_val_ext, "Unknown message"));
4973
4974
207
    nsapi = tvb_get_uint8(tvb, offset + 1) & 0x0F;
4975
207
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4976
207
    proto_item_append_text(te, ": %u",nsapi);
4977
4978
207
    return 2;
4979
207
}
4980
4981
/* GPRS:        not present
4982
 * UMTS:        29.060 v4.0, chapter 7.7.18, page 52
4983
 */
4984
static int
4985
decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4986
257
{
4987
4988
257
    uint8_t ranap;
4989
4990
257
    ranap = tvb_get_uint8(tvb, offset + 1);
4991
4992
257
    if ((ranap > 0) && (ranap <= 64))
4993
234
        proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
4994
234
                                   ranap, "%s (Radio Network Layer Cause) : %s (%u)",
4995
234
                                   val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
4996
234
                                   val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
4997
4998
257
    if ((ranap > 64) && (ranap <= 80))
4999
1
        proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
5000
1
                                   ranap, "%s (Transport Layer Cause) : %s (%u)",
5001
1
                                   val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5002
1
                                   val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5003
5004
257
    if ((ranap > 80) && (ranap <= 96))
5005
4
        proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
5006
4
                                   ranap, "%s (NAS Cause) : %s (%u)",
5007
4
                                   val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5008
4
                                   val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5009
5010
257
    if ((ranap > 96) && (ranap <= 112))
5011
1
        proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
5012
1
                                   "%s (Protocol Cause) : %s (%u)",
5013
1
                                   val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5014
1
                                   val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5015
5016
257
    if ((ranap > 112) && (ranap <= 128))
5017
7
        proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
5018
7
                                   "%s (Miscellaneous Cause) : %s (%u)",
5019
7
                                   val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5020
7
                                   val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5021
5022
257
    if ((ranap > 128) /* && (ranap <= 255) */ )
5023
6
        proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
5024
6
                                   "%s (Non-standard Cause) : %s (%u)",
5025
6
                                   val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5026
6
                                   val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5027
5028
257
    return 2;
5029
257
}
5030
5031
/* GPRS:        not present
5032
 * UMTS:        29.060 v4.0, chapter 7.7.19, page 52
5033
 */
5034
static int
5035
decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5036
63
{
5037
63
    proto_tree *ext_tree_rab_cntxt;
5038
5039
63
    ext_tree_rab_cntxt = proto_tree_add_subtree(tree, tvb, offset, 10, ett_gtp_ies[GTP_EXT_RAB_CNTXT], NULL,
5040
63
                        val_to_str_ext_const(GTP_EXT_RAB_CNTXT, &gtp_val_ext, "Unknown message"));
5041
5042
63
    proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_nsapi,       tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5043
63
    proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5044
63
    proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
5045
63
    proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn,  tvb, offset + 6, 2, ENC_BIG_ENDIAN);
5046
63
    proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up,  tvb, offset + 8, 2, ENC_BIG_ENDIAN);
5047
5048
63
    return 10;
5049
63
}
5050
5051
5052
/* GPRS:        not present
5053
 * UMTS:        29.060 v4.0, chapter 7.7.20, page 53
5054
 */
5055
static int
5056
decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5057
163
{
5058
5059
163
    uint8_t rp_sms;
5060
5061
163
    rp_sms = tvb_get_uint8(tvb, offset + 1) & 0x07;
5062
163
    proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
5063
5064
163
    return 2;
5065
163
}
5066
5067
/* GPRS:        not present
5068
 * UMTS:        29.060 v4.0, chapter 7.7.21, page 53
5069
 */
5070
static int
5071
decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5072
357
{
5073
5074
357
    proto_tree *ext_tree_rp;
5075
357
    proto_item *te;
5076
357
    uint8_t     nsapi, rp;
5077
5078
357
    nsapi = (tvb_get_uint8(tvb, offset + 1) & 0xF0) >> 4;
5079
357
    rp = tvb_get_uint8(tvb, offset + 1) & 0x07;
5080
5081
    /* TODO: shouldn't really use int item as tree root.. */
5082
357
    te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
5083
357
    ext_tree_rp = proto_item_add_subtree(te, ett_gtp_rp);
5084
5085
357
    proto_tree_add_item(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, ENC_NA);
5086
357
    proto_tree_add_item(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, ENC_NA);
5087
357
    proto_tree_add_item(ext_tree_rp, hf_gtp_rp,       tvb, offset + 1, 1, ENC_NA);
5088
5089
357
    return 2;
5090
357
}
5091
5092
/* GPRS:        not present
5093
 * UMTS:        29.060 v4.0, chapter 7.7.22, page 53
5094
 */
5095
static int
5096
decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5097
62
{
5098
5099
62
    proto_tree *ext_tree_pkt_flow_id;
5100
62
    proto_item *te;
5101
62
    uint8_t     nsapi, pkt_flow_id;
5102
5103
62
    nsapi = tvb_get_uint8(tvb, offset + 1) & 0x0F;
5104
62
    pkt_flow_id = tvb_get_uint8(tvb, offset + 2);
5105
5106
62
    te = proto_tree_add_uint_format(tree, hf_gtp_pkt_flow_id, tvb, offset, 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi, pkt_flow_id);
5107
62
    ext_tree_pkt_flow_id = proto_item_add_subtree(te, ett_gtp_pkt_flow_id);
5108
5109
62
    proto_tree_add_item(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5110
62
    proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
5111
62
                               offset + 2, 1, pkt_flow_id, "%s : %u", val_to_str_ext_const(GTP_EXT_PKT_FLOW_ID, &gtp_val_ext, "Unknown message"), pkt_flow_id);
5112
5113
62
    return 3;
5114
62
}
5115
5116
/* GPRS:        not present
5117
 * UMTS:        29.060 v4.0, chapter 7.7.23, page 53
5118
 * TODO: Differenciate these uints?
5119
 */
5120
static int
5121
decode_gtp_chrg_char(tvbuff_t* tvb, int offset, packet_info* pinfo _U_, proto_tree* tree, session_args_t* args _U_)
5122
306
{
5123
5124
306
    static int* const gtp_charg_flags[] = {
5125
306
        &hf_gtp_chrg_char_s,
5126
306
        &hf_gtp_chrg_char_n,
5127
306
        &hf_gtp_chrg_char_p,
5128
306
        &hf_gtp_chrg_char_f,
5129
306
        &hf_gtp_chrg_char_h,
5130
306
        &hf_gtp_chrg_char_r,
5131
306
        NULL
5132
306
    };
5133
5134
306
    proto_tree_add_bitmask(tree, tvb, offset + 1, hf_gtp_chrg_char, ett_gtp_ies[GTP_EXT_CHRG_CHAR], gtp_charg_flags, ENC_BIG_ENDIAN);
5135
5136
306
    return 3;
5137
306
}
5138
5139
/* GPRS:        not present
5140
 * UMTS:        29.060 v4.0, chapter 7.7.24, page
5141
 */
5142
static int
5143
decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5144
50
{
5145
5146
50
    uint16_t trace_ref;
5147
5148
50
    trace_ref = tvb_get_ntohs(tvb, offset + 1);
5149
5150
50
    proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
5151
5152
50
    return 3;
5153
50
}
5154
5155
/* GPRS:        not present
5156
 * UMTS:        29.060 v4.0, chapter 7.7.25, page
5157
 */
5158
static int
5159
decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5160
307
{
5161
5162
307
    uint16_t trace_type;
5163
5164
307
    trace_type = tvb_get_ntohs(tvb, offset + 1);
5165
5166
307
    proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
5167
5168
307
    return 3;
5169
307
}
5170
5171
/* GPRS:        9.60 v7.6.0, chapter 7.9.16A
5172
 * UMTS:        29.060 v4.0, chapter 7.7.25A, page
5173
 */
5174
static int
5175
decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5176
145
{
5177
5178
145
    uint8_t reason;
5179
5180
145
    reason = tvb_get_uint8(tvb, offset + 1);
5181
5182
    /* Reason for Absence is defined in 3GPP TS 23.040  */
5183
145
    proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
5184
5185
145
    return 2;
5186
145
}
5187
5188
/* GPRS:        ?
5189
 * UMTS:        29.060 v6.11.0, chapter 7.7.25B
5190
 * Radio Priority LCS
5191
 */
5192
static int
5193
decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5194
13
{
5195
5196
13
    uint16_t    length;
5197
13
    proto_tree *ext_tree;
5198
5199
13
    length = tvb_get_ntohs(tvb, offset + 1);
5200
13
    ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RA_PRIO_LCS], NULL,
5201
13
                    "%s : ", val_to_str_ext_const(GTP_EXT_RA_PRIO_LCS, &gtp_val_ext, "Unknown"));
5202
5203
13
    offset++;
5204
13
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
5205
13
    offset = offset + 2;
5206
5207
13
    proto_tree_add_item(ext_tree, hf_gtp_ra_prio_lcs, tvb, offset, 1, ENC_BIG_ENDIAN);
5208
5209
13
    return 3 + length;
5210
5211
13
}
5212
5213
/* TS 32.295, chapter 6.2.4.5.2, page 29 */
5214
static int
5215
decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5216
113
{
5217
5218
113
    uint8_t tr_command;
5219
5220
113
    tr_command = tvb_get_uint8(tvb, offset + 1);
5221
5222
113
    proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
5223
5224
113
    return 2;
5225
113
}
5226
5227
/* GPRS:        9.60 v7.6.0, chapter 7.9.17, page 43
5228
 * UMTS:        29.060 v4.0, chapter 7.7.26, page 55
5229
 */
5230
static int
5231
decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5232
34
{
5233
5234
34
    uint32_t chrg_id;
5235
5236
34
    chrg_id = tvb_get_ntohl(tvb, offset + 1);
5237
34
    proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
5238
5239
34
    return 5;
5240
34
}
5241
5242
/* GPRS:        9.60 v7.6.0, chapter 7.9.18, page 43
5243
 * UMTS:        29.060 v4.0, chapter 7.7.27, page 55
5244
 */
5245
static int
5246
decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5247
20
{
5248
5249
20
    uint16_t           length;
5250
20
    uint8_t            pdp_typ, pdp_org;
5251
20
    proto_tree        *ext_tree_user;
5252
20
    proto_item        *te;
5253
5254
5255
20
    length = tvb_get_ntohs(tvb, offset + 1);
5256
20
    pdp_org = tvb_get_uint8(tvb, offset + 3) & 0x0F;
5257
20
    pdp_typ = tvb_get_uint8(tvb, offset + 4);
5258
5259
20
    ext_tree_user = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length,
5260
20
                             ett_gtp_ies[GTP_EXT_USER_ADDR], &te, "%s (%s/%s)",
5261
20
                             val_to_str_ext_const(GTP_EXT_USER_ADDR, &gtp_val_ext, "Unknown message"),
5262
20
                             val_to_str_const(pdp_org, pdp_org_type, "Unknown PDP Organization"),
5263
20
                             val_to_str_const(pdp_typ, pdp_type, "Unknown PDP Type"));
5264
5265
20
    proto_tree_add_item(ext_tree_user, hf_gtp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
5266
20
    proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org,  tvb, offset + 3, 1, pdp_org);
5267
20
    proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
5268
5269
20
    if (length == 2) {
5270
0
        if ((pdp_org == 0) && (pdp_typ == 1))
5271
0
            proto_item_append_text(te, " (Point to Point Protocol)");
5272
0
        else if (pdp_typ == 2)
5273
0
            proto_item_append_text(te, " (Octet Stream Protocol)");
5274
20
    } else if (length > 2) {
5275
18
        switch (pdp_typ) {
5276
0
        case 0x21:
5277
0
            proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5278
0
            proto_item_append_text(te, " : %s", tvb_ip_to_str(pinfo->pool, tvb, offset + 5));
5279
0
            break;
5280
0
        case 0x57:
5281
0
            proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, ENC_NA);
5282
0
            proto_item_append_text(te, " : %s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 5));
5283
0
            break;
5284
0
        case 0x8d:
5285
0
            if (length == 6) {
5286
0
                ws_in6_addr ipv6;
5287
0
                memset(&ipv6, 0, sizeof(ws_in6_addr));
5288
0
                proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5289
0
                proto_tree_add_ipv6_format_value(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 0, &ipv6, "dynamic");
5290
0
                proto_item_append_text(te, " : %s / dynamic", tvb_ip_to_str(pinfo->pool, tvb, offset + 5));
5291
0
            } else if (length == 18) {
5292
0
                proto_tree_add_ipv4_format_value(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 0, 0, "dynamic");
5293
0
                proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, ENC_NA);
5294
0
                proto_item_append_text(te, " : dynamic / %s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 5));
5295
0
            } else if (length == 22) {
5296
0
                proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5297
0
                proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 16, ENC_NA);
5298
0
                proto_item_append_text(te, " : %s / %s", tvb_ip_to_str(pinfo->pool, tvb, offset + 5),
5299
0
                                       tvb_ip6_to_str(pinfo->pool, tvb, offset + 9));
5300
0
            } else {
5301
0
                proto_tree_add_expert_format(ext_tree_user, pinfo, &ei_gtp_ext_length_mal, tvb, offset + 3, length, "Wrong length indicated. Expected 6, 18 or 22, got %u", length);
5302
0
            }
5303
0
            break;
5304
18
        }
5305
18
    } else
5306
2
        proto_item_append_text(te, " : empty PDP Address");
5307
5308
20
    return 3 + length;
5309
20
}
5310
5311
static int
5312
decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, uint16_t count)
5313
15
{
5314
5315
15
    proto_tree *ext_tree_trip;
5316
15
    uint16_t    i;
5317
5318
64
    for (i = 0; i < count; i++) {
5319
49
        ext_tree_trip = proto_tree_add_subtree_format(tree, tvb, offset + i * 28, 28, ett_gtp_trip, NULL, "Triplet no%x", i);
5320
5321
49
        proto_tree_add_item(ext_tree_trip, hf_gtp_rand, tvb, offset + (i * 28),       16, ENC_NA);
5322
49
        proto_tree_add_item(ext_tree_trip, hf_gtp_sres, tvb, offset + (i * 28) + 16,  4,  ENC_NA);
5323
49
        proto_tree_add_item(ext_tree_trip, hf_gtp_kc, tvb,   offset + (i * 28) + 20,  8,  ENC_NA);
5324
49
    }
5325
5326
15
    return count * 28;
5327
15
}
5328
5329
/* adjust - how many bytes before quintuplet should be highlighted
5330
 */
5331
static int
5332
decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, uint16_t count)
5333
7
{
5334
5335
7
    proto_tree *ext_tree_quint;
5336
7
    proto_item *te_quint;
5337
7
    uint16_t    q_offset, i;
5338
7
    uint8_t     xres_len, auth_len;
5339
5340
7
    q_offset = 0;
5341
5342
18
    for (i = 0; i < count; i++) {
5343
5344
11
        ext_tree_quint = proto_tree_add_subtree_format(tree, tvb, offset, -1,
5345
11
                                ett_gtp_quint, &te_quint, "Quintuplet #%x", i + 1);
5346
5347
11
        proto_tree_add_item(ext_tree_quint, hf_gtp_rand, tvb, offset + q_offset, 16, ENC_NA);
5348
11
        q_offset = q_offset + 16;
5349
11
        xres_len = tvb_get_uint8(tvb, offset + q_offset);
5350
11
        proto_tree_add_item(ext_tree_quint, hf_gtp_xres_length, tvb, offset + q_offset, 1, ENC_BIG_ENDIAN);
5351
11
        q_offset++;
5352
11
        proto_tree_add_item(ext_tree_quint, hf_gtp_xres, tvb, offset + q_offset, xres_len, ENC_NA);
5353
11
        q_offset = q_offset + xres_len;
5354
11
        proto_tree_add_item(ext_tree_quint, hf_gtp_quintuplet_ciphering_key, tvb, offset + q_offset, 16, ENC_NA);
5355
11
        q_offset = q_offset + 16;
5356
11
        proto_tree_add_item(ext_tree_quint, hf_gtp_quintuplet_integrity_key, tvb, offset + q_offset, 16, ENC_NA);
5357
11
        q_offset = q_offset + 16;
5358
11
        auth_len = tvb_get_uint8(tvb, offset + q_offset);
5359
11
        proto_tree_add_item(ext_tree_quint, hf_gtp_authentication_length, tvb, offset + q_offset, 1, ENC_BIG_ENDIAN);
5360
11
        q_offset++;
5361
11
        proto_tree_add_item(ext_tree_quint, hf_gtp_auth, tvb, offset + q_offset, auth_len, ENC_NA);
5362
5363
11
        q_offset = q_offset + auth_len;
5364
11
        proto_item_set_end(te_quint, tvb, offset + q_offset);
5365
5366
11
    }
5367
5368
7
    return q_offset;
5369
7
}
5370
5371
/* GPRS:        9.60 v7.6.0, chapter 7.9.19 page
5372
 * UMTS:        29.060 v4.0, chapter 7.7.28 page 57
5373
 * TODO:        - check if for quintuplets first 2 bytes are length, according to AuthQuint
5374
 *              - finish displaying last 3 parameters
5375
 */
5376
static int
5377
decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
5378
26
{
5379
5380
26
    uint16_t    length, con_len;
5381
26
    uint8_t     count, sec_mode, len, iei;
5382
26
    proto_tree *ext_tree_mm;
5383
26
    proto_tree *tf_tree = NULL, *con_tree;
5384
5385
26
    ext_tree_mm = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ies[GTP_EXT_MM_CNTXT], NULL,
5386
26
                        val_to_str_ext_const(GTP_EXT_MM_CNTXT, &gtp_val_ext, "Unknown message"));
5387
5388
    /* Octet 2 - 3 */
5389
26
    length = tvb_get_ntohs(tvb, offset + 1);
5390
26
    if (length < 1)
5391
3
        return 3;
5392
5393
    /* Octet 4 (cksn)*/
5394
5395
    /* Octet 5 */
5396
23
    sec_mode = (tvb_get_uint8(tvb, offset + 4) >> 6) & 0x03;
5397
23
    count = (tvb_get_uint8(tvb, offset + 4) >> 3) & 0x07;
5398
5399
23
    proto_tree_add_item(ext_tree_mm, hf_gtp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
5400
23
    if (gtp_version == 0)
5401
12
        sec_mode = 1;
5402
5403
5404
23
    switch (sec_mode) {
5405
3
    case 0:                     /* Used cipher value, UMTS keys and Quintuplets */
5406
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi,         tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5407
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode,    tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5408
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors,    tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5409
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5410
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_ck, tvb, offset + 5, 16, ENC_NA);
5411
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_integrity_key_ik, tvb, offset + 21, 16, ENC_NA);
5412
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 37, 2, ENC_BIG_ENDIAN);
5413
5414
3
        offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
5415
5416
5417
3
        break;
5418
15
    case 1:                     /* GSM key and triplets */
5419
15
        proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5420
15
        if (gtp_version != 0)
5421
3
            proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5422
5423
15
        proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors,    tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5424
15
        proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5425
15
        proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_kc, tvb, offset + 5, 8, ENC_NA);
5426
5427
15
        offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
5428
5429
15
        break;
5430
3
    case 2:                     /* UMTS key and quintuplets */
5431
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5432
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5433
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5434
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_ck, tvb, offset + 5, 16, ENC_NA);
5435
3
        proto_tree_add_item(ext_tree_mm, hf_gtp_integrity_key_ik, tvb, offset + 21, 16, ENC_NA);
5436
3
       proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 37, 2, ENC_BIG_ENDIAN);
5437
5438
3
        offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
5439
5440
3
        break;
5441
2
    case 3:                     /* GSM key and quintuplets */
5442
2
        proto_tree_add_item(ext_tree_mm, hf_gtp_cksn,             tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5443
2
        proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode,    tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5444
2
        proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors,    tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5445
2
        proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5446
2
        proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_kc, tvb, offset + 5, 8, ENC_NA);
5447
2
        proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 13, 2, ENC_BIG_ENDIAN);
5448
5449
2
        offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
5450
5451
2
        break;
5452
0
    default:
5453
0
        break;
5454
23
    }
5455
5456
/*
5457
 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
5458
 */
5459
13
    tf_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, 2, ett_gtp_drx, NULL, "DRX Parameter");
5460
13
    de_gmm_drx_param(tvb, tf_tree, pinfo, offset, 2, NULL, 0);
5461
13
    offset = offset + 2;
5462
5463
13
    len = tvb_get_uint8(tvb, offset);
5464
13
    tf_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, len + 1, ett_gtp_net_cap, NULL, "MS Network Capability");
5465
5466
13
    proto_tree_add_uint(tf_tree, hf_gtp_ms_network_cap_content_len, tvb, offset, 1, len);
5467
5468
13
    offset++;
5469
/*
5470
 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
5471
 */
5472
13
    if (len > 0) {
5473
11
        de_gmm_ms_net_cap(tvb, tf_tree, pinfo, offset, len, NULL, 0);
5474
11
        offset = offset + len;
5475
11
    }
5476
5477
/* 3GPP TS 29.060 version 9.4.0 Release 9
5478
 *  The two octets Container Length holds the length of the Container, excluding the Container Length octets.
5479
 * Container contains one or several optional information elements as described in the clause "Overview", from the clause
5480
 * "General message format and information elements coding" in 3GPP TS 24.008 [5]. For the definition of the IEI see
5481
 * table 47a, "IEIs for information elements used in the container". The IMEISV shall, if available, be included in the
5482
 * Container. The IMEISV is included in the Mobile identity IE. If Container is not included, its Length field value shall
5483
 * be set to 0. If the MS is emergency attached and the MS is UICCless or the IMSI is unauthenticated, the International
5484
 * Mobile Equipment Identity (IMEI) shall be used as the MS identity.
5485
 *
5486
 * Table 47A: IEIs for information elements used in the container
5487
 * IEI            Information element
5488
 * 0x23           Mobile identity
5489
 *
5490
 * NOTE: In 3GPP TS 24.008 [5] the IEI definition is
5491
 * message dependent. The table is added to
5492
 * have a unique definition in the present
5493
 * document for the used IEI in the MMcontext.
5494
 */
5495
5496
13
    con_len = tvb_get_ntohs(tvb, offset);
5497
13
    proto_tree_add_item(ext_tree_mm, hf_gtp_container_length, tvb, offset, 2, ENC_BIG_ENDIAN);
5498
13
    offset = offset + 2;
5499
5500
13
    if (con_len > 0) {
5501
4
        proto_item* ti;
5502
5503
4
        con_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, con_len, ett_gtp_mm_cntxt, NULL, "Container");
5504
5505
4
        iei = tvb_get_uint8(tvb,offset);
5506
4
        ti = proto_tree_add_uint(con_tree, hf_gtp_iei, tvb, offset, 1, iei);
5507
4
        if (iei == 0x23) {
5508
1
            proto_item_append_text(ti, " (Mobile identity)");
5509
1
            offset++;
5510
1
            len = tvb_get_uint8(tvb,offset);
5511
1
            proto_tree_add_uint(con_tree, hf_gtp_iei_mobile_id_len, tvb, offset, 1, len);
5512
1
            offset++;
5513
1
            de_mid(tvb, con_tree, pinfo, offset, len, NULL, 0);
5514
3
        } else {
5515
3
            expert_add_info(pinfo, ti, &ei_gtp_iei);
5516
3
        }
5517
4
    }
5518
5519
13
    return 3 + length;
5520
23
}
5521
5522
/* Function to extract the value of an hexadecimal octet. Only the lower
5523
 * nybble will be non-zero in the output.
5524
 * */
5525
static uint8_t
5526
hex2dec(uint8_t x)
5527
0
{
5528
    /* XXX, ws_xton() */
5529
0
    if ((x >= 'a') && (x <= 'f'))
5530
0
        x = x - 'a' + 10;
5531
0
    else if ((x >= 'A') && (x <= 'F'))
5532
0
        x = x - 'A' + 10;
5533
0
    else if ((x >= '0') && (x <= '9'))
5534
0
        x = x - '0';
5535
0
    else
5536
0
        x = 0;
5537
0
    return x;
5538
0
}
5539
5540
/* Wrapper function to add UTF-8 decoding for QoS attributes in
5541
 * RADIUS messages.
5542
 * */
5543
static uint8_t
5544
wrapped_tvb_get_uint8(tvbuff_t * tvb, int offset, int type)
5545
12.5k
{
5546
12.5k
    if (type == 2)
5547
0
        return (hex2dec(tvb_get_uint8(tvb, offset)) << 4 | hex2dec(tvb_get_uint8(tvb, offset + 1)));
5548
12.5k
    else
5549
12.5k
        return tvb_get_uint8(tvb, offset);
5550
12.5k
}
5551
5552
 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
5553
  * so type means length of length :-)
5554
  *
5555
  * WARNING :) type does not mean length of length any more... see below for
5556
  * type = 3!
5557
  */
5558
int
5559
decode_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, const char * qos_str, uint8_t type)
5560
503
{
5561
5562
503
    unsigned    length;
5563
503
    uint8_t     al_ret_priority;
5564
503
    uint8_t     delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
5565
503
    uint8_t     traf_class, del_order, del_err_sdu;
5566
503
    uint8_t     max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext, max_ul_ext2 = 0, max_dl_ext2 = 0;
5567
503
    uint8_t     res_ber, sdu_err_ratio;
5568
503
    uint8_t     trans_delay, traf_handl_prio;
5569
503
    uint8_t     guar_ul, guar_dl, guar_ul_ext, guar_dl_ext, guar_ul_ext2 = 0, guar_dl_ext2 = 0;
5570
503
    uint8_t     src_stat_desc, sig_ind, spare4;
5571
503
    proto_tree *ext_tree_qos;
5572
503
    int         mss, mu, md, gu, gd;
5573
503
    uint8_t     arp, qci;
5574
503
    uint32_t    apn_ambr;
5575
503
    uint64_t    br;
5576
5577
    /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
5578
     * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
5579
     * to one byte to be dissected).
5580
     * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
5581
     * corresponds to one byte to be dissected)
5582
     * */
5583
503
    uint8_t utf8_type = 1;
5584
5585
    /* Will keep the release indicator as indicated in the RADIUS message */
5586
503
    uint8_t rel_ind = 0;
5587
5588
    /* In RADIUS messages the QoS has a version field of two octets prepended.
5589
     * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
5590
     * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
5591
     * inconsistent and unuseful, I will check hyphen presence here and
5592
     * will signal its presence.
5593
     * */
5594
503
    uint8_t hyphen;
5595
5596
    /* Will keep the value that will be returned
5597
     * */
5598
503
    int retval = 0;
5599
5600
503
    switch (type) {
5601
0
    case 0:
5602
        /* For QoS inside GPRS-CDR messages from GGSN/P-GW */
5603
0
        length = tvb_reported_length(tvb);
5604
0
        ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length, ett_gtp_qos, NULL, qos_str);
5605
0
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset, 1, length);
5606
        /* QoS inside GPRS-CDR has no length octet, so no extra offset needed */
5607
0
        retval = length;
5608
0
        break;
5609
491
    case 1:
5610
491
        length = tvb_get_uint8(tvb, offset);
5611
491
        ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length + 1, ett_gtp_qos, NULL, qos_str);
5612
491
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset, 1, length);
5613
491
        offset++;
5614
491
        retval = length + 1;
5615
491
        break;
5616
12
    case 2:
5617
12
        length = tvb_get_ntohs(tvb, offset + 1);
5618
12
        ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_qos, NULL, qos_str);
5619
12
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset + 1, 2, length);
5620
12
        offset += 3;            /* +1 because of first 0x86 byte for UMTS QoS */
5621
12
        retval = length + 3;
5622
12
        break;
5623
0
    case 3:
5624
        /* For QoS inside RADIUS Client messages from GGSN/P-GW */
5625
0
        utf8_type = 2;
5626
5627
        /* The field in the RADIUS message is the length of the tvb we were given */
5628
0
        length = tvb_reported_length(tvb);
5629
0
        ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length, ett_gtp_qos, NULL, qos_str);
5630
5631
0
        rel_ind = wrapped_tvb_get_uint8(tvb, offset, 2);
5632
0
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, rel_ind);
5633
5634
        /* Hyphen handling */
5635
0
        hyphen = tvb_get_uint8(tvb, offset + 2);
5636
0
        if (hyphen == ((uint8_t) '-')) {
5637
            /* Hyphen is present, put in protocol tree */
5638
0
            proto_tree_add_item(ext_tree_qos, hf_gtp_hyphen_separator, tvb, offset + 2, 1, ENC_NA);
5639
0
            offset++;           /* "Get rid" of hyphen */
5640
0
        }
5641
5642
        /* Now, we modify offset here and in order to use type later
5643
         * effectively.*/
5644
0
        offset++;
5645
5646
0
        length -= offset;
5647
0
        length /= 2; /* Binary length of encoded data. */
5648
5649
        /* Fake the length of the IE including the IE id and length octets
5650
         * we are actually using it to determine presence of Octet n as counted
5651
         * in  TS 24.008
5652
         */
5653
5654
0
        retval = length + 2;    /* Actually, will be ignored. */
5655
0
        break;
5656
0
    default:
5657
        /* XXX - what should we do with the length here? */
5658
0
        length = 0;
5659
0
        retval = 0;
5660
0
        ext_tree_qos = NULL;
5661
0
        break;
5662
503
    }
5663
5664
490
    if ((type == 3) && (rel_ind >= 8) && (rel_ind < 98)) {
5665
        /* Release 8 or higher P-GW QoS profile */
5666
0
        static int * const arp_flags[] = {
5667
0
            &hf_gtp_qos_arp_pci,
5668
0
            &hf_gtp_qos_arp_pl,
5669
0
            &hf_gtp_qos_arp_pvi,
5670
0
            NULL
5671
0
        };
5672
5673
0
        offset++;
5674
0
        arp = wrapped_tvb_get_uint8(tvb, offset, 2);
5675
0
        proto_tree_add_bitmask_value_with_flags(ext_tree_qos, tvb, offset, hf_gtp_qos_arp,
5676
0
                    ett_gtp_qos_arp, arp_flags, arp, BMT_NO_APPEND);
5677
0
        offset += 2;
5678
5679
0
        qci = wrapped_tvb_get_uint8(tvb, offset, 2);
5680
0
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_qci, tvb, offset, 2, qci);
5681
0
        offset += 2;
5682
0
        if (qci <= 4) {
5683
            /* GBR QCI */
5684
0
            br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset  , 2) << 32) |
5685
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5686
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5687
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) <<  8) |
5688
0
                  (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5689
0
            proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_mbr, tvb, offset, 10, br);
5690
0
            offset += 10;
5691
0
            br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset  , 2) << 32) |
5692
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5693
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5694
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) <<  8) |
5695
0
                  (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5696
0
            proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_mbr, tvb, offset, 10, br);
5697
0
            offset += 10;
5698
0
            br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset  , 2) << 32) |
5699
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5700
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5701
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) <<  8) |
5702
0
                  (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5703
0
            proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_gbr, tvb, offset, 10, br);
5704
0
            offset += 10;
5705
0
            br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset  , 2) << 32) |
5706
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5707
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5708
0
                 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) <<  8) |
5709
0
                  (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5710
0
            proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_gbr, tvb, offset, 10, br);
5711
0
        } else {
5712
            /* non GBR QCI */
5713
0
            apn_ambr = (wrapped_tvb_get_uint8(tvb, offset  , 2) << 24) |
5714
0
                       (wrapped_tvb_get_uint8(tvb, offset+2, 2) << 16) |
5715
0
                       (wrapped_tvb_get_uint8(tvb, offset+4, 2) <<  8) |
5716
0
                        wrapped_tvb_get_uint8(tvb, offset+6, 2);
5717
0
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_ul_apn_ambr, tvb, offset, 8, apn_ambr);
5718
0
            offset += 8;
5719
0
            apn_ambr = (wrapped_tvb_get_uint8(tvb, offset  , 2) << 24) |
5720
0
                       (wrapped_tvb_get_uint8(tvb, offset+2, 2) << 16) |
5721
0
                       (wrapped_tvb_get_uint8(tvb, offset+4, 2) <<  8) |
5722
0
                        wrapped_tvb_get_uint8(tvb, offset+6, 2);
5723
0
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_dl_apn_ambr, tvb, offset, 8, apn_ambr);
5724
0
        }
5725
0
        return retval;
5726
0
    }
5727
5728
    /* In RADIUS messages there is no allocation-retention priority
5729
     * so I don't need to wrap the following call to tvb_get_uint8
5730
     * */
5731
490
    al_ret_priority = tvb_get_uint8(tvb, offset);
5732
5733
    /* All calls are wrapped to take into account the possibility that the
5734
     * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
5735
     * of the offset will be the same as in the previous version of this
5736
     * dissector, and the wrapped function will serve as a dumb wrapper;
5737
     * otherwise, if utf_8_type is 2, the offset is correctly shifted by
5738
     * two bytes for needed shift, and the wrapped function will unencode
5739
     * two values from the input.
5740
     * */
5741
490
    spare1      = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE1_MASK;
5742
490
    delay       = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DELAY_MASK;
5743
490
    reliability = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RELIABILITY_MASK;
5744
490
    peak        = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PEAK_MASK;
5745
490
    spare2      = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE2_MASK;
5746
490
    precedence  = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PRECEDENCE_MASK;
5747
490
    spare3      = wrapped_tvb_get_uint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE3_MASK;
5748
490
    mean        = wrapped_tvb_get_uint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_MEAN_MASK;
5749
5750
    /* In RADIUS messages there is no allocation-retention priority */
5751
490
    if (type != 3) {
5752
486
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
5753
486
    } else {
5754
        /* Add an octet to the binary data length to account for the
5755
         * missing ARP so that the length tests below are correct.
5756
         */
5757
4
        length += 1;
5758
4
    }
5759
5760
    /* All additions must take care of the fact that QoS fields in RADIUS
5761
     * messages are UTF-8 encoded, so we have to use the same trick as above.
5762
     * */
5763
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1,      tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
5764
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay,       tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
5765
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
5766
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak,        tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
5767
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2,      tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
5768
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence,  tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
5769
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3,      tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
5770
490
    proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean,        tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
5771
5772
    /* TS 24.008 V 7.8.0 10.5.6.5 Quality of service
5773
     * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
5774
     * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
5775
     * attributes specified in octets 6-14.
5776
     * In the MS to network direction and in the network to MS direction the following applies:
5777
     * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
5778
     * be included.
5779
     * - If octet 17 is included, then octet 18 shall also be included.
5780
     * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
5781
     * be accepted by the receiving entity.
5782
     */
5783
5784
490
    if (length > 4) {
5785
5786
        /* See above for the need of wrapping
5787
         *
5788
         */
5789
        /* Octet 6 */
5790
396
        traf_class      = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_CLASS_MASK;
5791
396
        del_order       = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ORDER_MASK;
5792
396
        del_err_sdu     = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ERR_SDU_MASK;
5793
396
        max_sdu_size    = wrapped_tvb_get_uint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
5794
396
        max_ul          = wrapped_tvb_get_uint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
5795
396
        max_dl          = wrapped_tvb_get_uint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
5796
396
        res_ber         = wrapped_tvb_get_uint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RES_BER_MASK;
5797
396
        sdu_err_ratio   = wrapped_tvb_get_uint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SDU_ERR_RATIO_MASK;
5798
396
        trans_delay     = wrapped_tvb_get_uint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRANS_DELAY_MASK;
5799
396
        traf_handl_prio = wrapped_tvb_get_uint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK;
5800
396
        guar_ul         = wrapped_tvb_get_uint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
5801
        /* Octet 13 */
5802
396
        guar_dl         = wrapped_tvb_get_uint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
5803
5804
396
        spare4        = 0;
5805
396
        sig_ind       = 0;
5806
396
        src_stat_desc = 0;
5807
396
        max_dl_ext    = 0;
5808
396
        guar_dl_ext   = 0;
5809
396
        max_ul_ext    = 0;
5810
396
        guar_ul_ext   = 0;
5811
5812
396
        if (length > 13 ||((type == 2) && (length == 13))) {
5813
374
            spare4        = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE4_MASK;
5814
374
            sig_ind       = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SIG_IND_MASK;
5815
374
            src_stat_desc = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SRC_STAT_DESC_MASK;
5816
374
        }
5817
396
        if (length > 14) {
5818
373
            max_dl_ext  = wrapped_tvb_get_uint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
5819
373
            guar_dl_ext = wrapped_tvb_get_uint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
5820
373
        }
5821
396
        if (length > 16) {
5822
350
            max_ul_ext = wrapped_tvb_get_uint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
5823
350
            guar_ul_ext = wrapped_tvb_get_uint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
5824
350
        }
5825
396
        if (length > 18) {
5826
333
            max_dl_ext2 = wrapped_tvb_get_uint8(tvb, offset + (17 - 1) * utf8_type + 1, utf8_type);
5827
333
            guar_dl_ext2 = wrapped_tvb_get_uint8(tvb, offset + (18 - 1) * utf8_type + 1, utf8_type);
5828
333
        }
5829
396
        if (length > 20) {
5830
313
            max_ul_ext2 = wrapped_tvb_get_uint8(tvb, offset + (19 - 1) * utf8_type + 1, utf8_type);
5831
313
            guar_ul_ext2 = wrapped_tvb_get_uint8(tvb, offset + (20 - 1) * utf8_type + 1, utf8_type);
5832
313
        }
5833
5834
        /*
5835
         * See above comments for the changes
5836
         */
5837
396
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class,  tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
5838
396
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order,   tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
5839
396
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_err_sdu, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_err_sdu);
5840
396
        if (max_sdu_size == 0 || max_sdu_size > 150)
5841
144
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, max_sdu_size);
5842
396
        if ((max_sdu_size > 0) && (max_sdu_size <= 150)) {
5843
250
            mss = max_sdu_size * 10;
5844
250
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss,
5845
250
                                       "%u octets", mss);
5846
250
        }
5847
5848
396
        if (max_ul == 0 || max_ul == 255)
5849
152
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
5850
396
        if ((max_ul > 0) && (max_ul <= 63))
5851
106
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul,
5852
106
                                       "%u kbps", max_ul);
5853
396
        if ((max_ul > 63) && (max_ul <= 127)) {
5854
64
            mu = 64 + (max_ul - 64) * 8;
5855
64
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
5856
64
                                       "%u kbps", mu);
5857
64
        }
5858
5859
396
        if ((max_ul > 127) && (max_ul <= 254)) {
5860
72
            mu = 576 + (max_ul - 128) * 64;
5861
72
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
5862
72
                                       "%u kbps", mu);
5863
72
        }
5864
5865
396
        if (max_dl == 0 || max_dl == 255)
5866
143
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
5867
396
        if ((max_dl > 0) && (max_dl <= 63))
5868
114
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl,
5869
114
                                       "%u kbps", max_dl);
5870
396
        if ((max_dl > 63) && (max_dl <= 127)) {
5871
71
            md = 64 + (max_dl - 64) * 8;
5872
71
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
5873
71
                                       "%u kbps", md);
5874
71
        }
5875
396
        if ((max_dl > 127) && (max_dl <= 254)) {
5876
66
            md = 576 + (max_dl - 128) * 64;
5877
66
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
5878
66
                                       "%u kbps", md);
5879
66
        }
5880
5881
396
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber,         tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
5882
396
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_sdu_err_ratio,   tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, sdu_err_ratio);
5883
396
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay,     tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
5884
396
        proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_handl_prio, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, traf_handl_prio);
5885
5886
396
        if (guar_ul == 0 || guar_ul == 255)
5887
141
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
5888
396
        if ((guar_ul > 0) && (guar_ul <= 63))
5889
97
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul,
5890
97
                                       "%u kbps", guar_ul);
5891
396
        if ((guar_ul > 63) && (guar_ul <= 127)) {
5892
85
            gu = 64 + (guar_ul - 64) * 8;
5893
85
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
5894
85
                                       "%u kbps", gu);
5895
85
        }
5896
396
        if ((guar_ul > 127) && (guar_ul <= 254)) {
5897
71
            gu = 576 + (guar_ul - 128) * 64;
5898
71
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
5899
71
                                       "%u kbps", gu);
5900
71
        }
5901
5902
        /* Octet 13 */
5903
396
        if (guar_dl == 0 || guar_dl == 255)
5904
150
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
5905
396
        if ((guar_dl > 0) && (guar_dl <= 63))
5906
115
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl,
5907
115
                                       "%u kbps", guar_dl);
5908
396
        if ((guar_dl > 63) && (guar_dl <= 127)) {
5909
70
            gd = 64 + (guar_dl - 64) * 8;
5910
70
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
5911
70
                                       "%u kbps", gd);
5912
70
        }
5913
396
        if ((guar_dl > 127) && (guar_dl <= 254)) {
5914
59
            gd = 576 + (guar_dl - 128) * 64;
5915
59
            proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
5916
59
                                       "%u kbps", gd);
5917
59
        }
5918
5919
396
        if(length > 13 ||((type == 2) && (length == 13))) {
5920
373
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare4, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, spare4);
5921
373
            proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
5922
373
            proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_src_stat_desc, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, src_stat_desc);
5923
373
        }
5924
5925
5926
396
        if(length > 14) {
5927
            /* Octet 15 */
5928
372
            if(max_dl_ext == 0)
5929
99
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type,
5930
99
                                           "Ext Maximum bit rate for downlink: Use the value in octet 9");
5931
372
            if ((max_dl_ext > 0) && (max_dl_ext <= 0x4a)) {
5932
104
                md = 8600 + max_dl_ext * 100;
5933
104
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5934
104
                                           "Ext Maximum bit rate for downlink: %u kbps", md);
5935
104
            }
5936
372
            if ((max_dl_ext > 0x4a) && (max_dl_ext <= 0xba)) {
5937
87
                md = 16 + (max_dl_ext-0x4a);
5938
87
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5939
87
                                           "Ext Maximum bit rate for downlink: %u Mbps", md);
5940
87
            }
5941
372
            if ((max_dl_ext > 0xba) && (max_dl_ext <= 0xfa)) {
5942
38
                md = 128 + (max_dl_ext-0xba)*2;
5943
38
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5944
38
                                           "Ext Maximum bit rate for downlink: %u Mbps", md);
5945
38
            }
5946
            /* Octet 16 */
5947
372
            if(guar_dl_ext == 0)
5948
107
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_guaranteed_bit_rate_value, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type,
5949
107
                                           "Ext Guaranteed bit rate for downlink: Use the value in octet 13");
5950
372
            if ((guar_dl_ext > 0) && (guar_dl_ext <= 0x4a)) {
5951
120
                gd = 8600 + guar_dl_ext * 100;
5952
120
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5953
120
                                           "Ext Guaranteed bit rate for downlink: %u kbps", gd);
5954
120
            }
5955
372
            if ((guar_dl_ext > 0x4a) && (guar_dl_ext <= 0xba)) {
5956
57
                gd = 16 + (guar_dl_ext-0x4a);
5957
57
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5958
57
                                           "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
5959
57
            }
5960
372
            if ((guar_dl_ext > 0xba) && (guar_dl_ext <= 0xfa)) {
5961
49
                gd = 128 + (guar_dl_ext-0xba)*2;
5962
49
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5963
49
                                           "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
5964
49
            }
5965
5966
372
        }
5967
396
        if(length > 16) {
5968
            /* Octet 17
5969
             * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
5970
             * rate for downlink (extended).
5971
             */
5972
349
            if (max_ul_ext == 0)
5973
97
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type,
5974
97
                                             "Ext Maximum bit rate for uplink: Use the value indicated in octet 8");
5975
349
            if ((max_ul_ext > 0) && (max_ul_ext <= 0x4a)) {
5976
119
                md = 8600 + max_ul_ext * 100;
5977
119
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5978
119
                                           "Ext Maximum bit rate for uplink: %u kbps", md);
5979
119
            }
5980
349
            if ((max_ul_ext > 0x4a) && (max_ul_ext <= 0xba)) {
5981
61
                md = 16 + (max_ul_ext-0x4a);
5982
61
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5983
61
                                           "Ext Maximum bit rate for uplink: %u Mbps", md);
5984
61
            }
5985
349
            if ((max_ul_ext > 0xba) && (max_ul_ext <= 0xfa)) {
5986
32
                md = 128 + (max_ul_ext-0xba)*2;
5987
32
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5988
32
                                           "Ext Maximum bit rate for uplink: %u Mbps", md);
5989
32
            }
5990
            /* Octet 18 */
5991
349
            if (guar_ul_ext == 0)
5992
72
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_guaranteed_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
5993
72
                                           "Ext Guaranteed bit rate for uplink: Use the value indicated in octet 12");
5994
349
            if ((guar_ul_ext > 0) && (guar_ul_ext <= 0x4a)) {
5995
138
                gd = 8600 + guar_ul_ext * 100;
5996
138
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
5997
138
                                           "Ext Guaranteed bit rate for uplink: %u kbps", gd);
5998
138
            }
5999
349
            if ((guar_ul_ext > 0x4a) && (guar_ul_ext <= 0xba)) {
6000
60
                gd = 16 + (guar_ul_ext-0x4a);
6001
60
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6002
60
                                           "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
6003
60
            }
6004
349
            if ((guar_ul_ext > 0xba) && (guar_ul_ext <= 0xfa)) {
6005
32
                gd = 128 + (guar_ul_ext-0xba)*2;
6006
32
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6007
32
                                           "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
6008
32
            }
6009
349
        }
6010
6011
396
        if(length > 18) {
6012
            /* Octet 19 Maximum bit rate for downlink (extended-2)
6013
             * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
6014
             * rate for downlink (extended).
6015
             */
6016
332
            if (max_dl_ext2 == 0)
6017
100
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (17 - 1) * utf8_type + 1, utf8_type,
6018
100
                                           "Ext2 Maximum bit rate for downlink: Use the value in octet 9 and octet 15.");
6019
6020
332
            if ((max_dl_ext2 > 0) && (max_dl_ext2 <= 0x3d)) {
6021
100
                md = 256 + max_dl_ext2 * 4;
6022
100
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6023
100
                                           "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6024
100
            }
6025
332
            if ((max_dl_ext2 > 0x3d) && (max_dl_ext2 <= 0xa1)) {
6026
65
                md = 500 + (max_dl_ext2-0x3d) * 10;
6027
65
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6028
65
                                           "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6029
65
            }
6030
332
            if ((max_dl_ext2 > 0xa1) && (max_dl_ext2 <= 0xf6)) {
6031
27
                md = 1500 + (max_dl_ext2-0xa1)*10;
6032
27
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6033
27
                                           "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6034
27
            }
6035
            /* Octet 20 Guaranteed bit rate for downlink (extended-2) */
6036
332
            if (guar_dl_ext2 == 0)
6037
74
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
6038
74
                                           "Ext2 Guaranteed bit rate for downlink: Use the value in octet 13 and octet 16.");
6039
332
            if ((guar_dl_ext2 > 0) && (guar_dl_ext2 <= 0x3d)) {
6040
107
                gd = 256 + guar_dl_ext2 * 4;
6041
107
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6042
107
                                           "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6043
107
            }
6044
332
            if ((guar_dl_ext2 > 0x3d) && (guar_dl_ext2 <= 0xa1)) {
6045
59
                gd = 500 + (guar_dl_ext2-0x3d) * 10;
6046
59
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6047
59
                                           "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6048
59
            }
6049
332
            if ((guar_dl_ext2 > 0xba) && (guar_dl_ext2 <= 0xfa)) {
6050
48
                gd = 1500 + (guar_dl_ext2-0xa1) * 10;
6051
48
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6052
48
                                           "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6053
48
            }
6054
332
        }
6055
6056
396
        if(length > 20) {
6057
            /* Maximum bit rate for uplink (extended-2), octet 21
6058
             * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
6059
             * rate for downlink (extended).
6060
             */
6061
312
            if (max_ul_ext2 == 0)
6062
61
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (17 - 1) * utf8_type + 1, utf8_type,
6063
61
                                           "Ext2 Maximum bit rate for uplink: Use the value in octet 8 and octet 17.");
6064
6065
312
            if ((max_ul_ext2 > 0) && (max_ul_ext2 <= 0x3d)) {
6066
111
                md = 256 + max_ul_ext2 * 4;
6067
111
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6068
111
                                           "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6069
111
            }
6070
312
            if ((max_ul_ext2 > 0x3d) && (max_ul_ext2 <= 0xa1)) {
6071
59
                md = 500 + (max_ul_ext2-0x3d) * 10;
6072
59
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6073
59
                                           "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6074
59
            }
6075
312
            if ((max_ul_ext2 > 0xa1) && (max_ul_ext2 <= 0xf6)) {
6076
44
                md = 1500 + (max_ul_ext2-0xa1)*10;
6077
44
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6078
44
                                           "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6079
44
            }
6080
            /* Guaranteed bit rate for uplink (extended-2), octet 22 */
6081
312
            if (guar_ul_ext2 == 0)
6082
77
                proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
6083
77
                                           "Ext2 Guaranteed bit rate for uplink: Use the value in octet 13 and octet 16.");
6084
312
            if ((guar_ul_ext2 > 0) && (guar_ul_ext2 <= 0x3d)) {
6085
92
                gd = 256 + guar_ul_ext2 * 4;
6086
92
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6087
92
                                           "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6088
92
            }
6089
312
            if ((guar_ul_ext2 > 0x3d) && (guar_ul_ext2 <= 0xa1)) {
6090
54
                gd = 500 + (guar_ul_ext2-0x3d) * 10;
6091
54
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6092
54
                                           "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6093
54
            }
6094
312
            if ((guar_ul_ext2 > 0xba) && (guar_ul_ext2 <= 0xfa)) {
6095
52
                gd = 1500 + (guar_ul_ext2-0xa1) * 10;
6096
52
                proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6097
52
                                           "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6098
52
            }
6099
312
        }
6100
396
    }
6101
6102
490
    return retval;
6103
490
}
6104
6105
/* Diameter 3GPP AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
6106
static int
6107
0
dissect_diameter_3gpp_qosprofile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
6108
6109
0
    decode_qos_umts(tvb, 0, pinfo, tree, "UMTS GTP QoS Profile", 3);
6110
0
    return tvb_reported_length(tvb);
6111
0
}
6112
6113
static const char *
6114
dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo)
6115
0
{
6116
0
    decode_qos_umts(tvb, 0, pinfo, tree, "UMTS GTP QoS Profile", 3);
6117
0
    return tvb_get_string_enc(pinfo->pool, tvb, 0, tvb_reported_length(tvb), ENC_UTF_8|ENC_NA);
6118
0
}
6119
6120
static void
6121
decode_apn(packet_info *pinfo, tvbuff_t * tvb, int offset, uint16_t length, proto_tree * tree, proto_item *item)
6122
132
{
6123
132
    const uint8_t *apn = NULL;
6124
6125
    /*
6126
     * This is "a domain name represented as a sequence of labels, where
6127
     * each label consists of a length octet followed by that number of
6128
     * octets.", DNS-style.
6129
     *
6130
     * XXX - does it involve compression?
6131
     */
6132
6133
    /* Highlight bytes including the first length byte */
6134
132
    proto_tree_add_item_ret_string(tree, hf_gtp_apn, tvb, offset, length, ENC_APN_STR, pinfo->pool, &apn);
6135
132
    if(item){
6136
4
        proto_item_append_text(item, ": %s", apn);
6137
4
    }
6138
6139
132
}
6140
6141
static void
6142
decode_fqdn(tvbuff_t * tvb, int offset, uint16_t length, proto_tree * tree, session_args_t * args _U_)
6143
2
{
6144
2
    int     name_len;
6145
6146
    /* "The FQDN field encoding shall be identical to the encoding of a FQDN
6147
     * within a DNS message of clause 3.1 of IETF RFC 1035 [45] but excluding
6148
     * the trailing zero byte"
6149
     *
6150
     * XXX: is compression possible?
6151
     */
6152
2
    if (length > 0) {
6153
2
        name_len = tvb_get_uint8(tvb, offset);
6154
6155
        /* "NOTE 1: The FQDN field in the IE is not encoded as a dotted string"
6156
         * but if the first byte is large (in the letter range or higher),
6157
         * assume that it is so encoded incorrectly.
6158
         */
6159
2
        if (name_len < 0x40) {
6160
1
            proto_tree_add_item(tree, hf_gtp_fqdn, tvb, offset, length, ENC_APN_STR);
6161
1
        } else
6162
1
            proto_tree_add_item(tree, hf_gtp_fqdn, tvb, offset, length, ENC_ASCII);
6163
2
    }
6164
2
}
6165
6166
/*
6167
 * GPRS:        9.60 v7.6.0, chapter 7.9.20
6168
 * UMTS:        29.060 v4.0, chapter 7.7.29 PDP Context
6169
 * TODO:        unify addr functions
6170
 */
6171
static int
6172
decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6173
176
{
6174
6175
176
    uint8_t            ggsn_addr_len, apn_len, trans_id, ea;
6176
176
    uint8_t            pdp_type_num, pdp_addr_len;
6177
176
    uint16_t           length;
6178
176
    proto_tree        *ext_tree_pdp;
6179
6180
176
    length = tvb_get_ntohs(tvb, offset + 1);
6181
6182
176
    ext_tree_pdp = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_PDP_CNTXT], NULL,
6183
176
                    val_to_str_ext_const(GTP_EXT_PDP_CNTXT, &gtp_val_ext, "Unknown message"));
6184
6185
176
    ea = (tvb_get_uint8(tvb, offset + 3) >> 7) & 0x01;
6186
6187
176
    proto_tree_add_item(ext_tree_pdp, hf_gtp_extended_end_user_address, tvb, offset + 3, 1, ENC_NA);
6188
176
    proto_tree_add_item(ext_tree_pdp, hf_gtp_vplmn_address_allowed, tvb, offset + 3, 1, ENC_NA);
6189
176
    proto_tree_add_item(ext_tree_pdp, hf_gtp_activity_status_indicator, tvb, offset + 3, 1, ENC_NA);
6190
176
    proto_tree_add_item(ext_tree_pdp, hf_gtp_reordering_required, tvb, offset + 3, 1, ENC_NA);
6191
176
    proto_tree_add_item(ext_tree_pdp, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6192
176
    proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_cntxt_sapi, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6193
6194
176
    switch (gtp_version) {
6195
10
    case 0:
6196
10
        decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
6197
10
        decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
6198
10
        decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
6199
10
        offset = offset + 14;
6200
10
        break;
6201
166
    case 1:
6202
166
        offset = offset + 5;
6203
166
        offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS subscribed", 1);
6204
166
        offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS requested", 1);
6205
166
        offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS negotiated", 1);
6206
166
        break;
6207
0
    default:
6208
0
        break;
6209
176
    }
6210
6211
156
    proto_tree_add_item(ext_tree_pdp, hf_gtp_sequence_number_down, tvb, offset, 2, ENC_BIG_ENDIAN);
6212
156
    proto_tree_add_item(ext_tree_pdp, hf_gtp_sequence_number_up, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6213
156
    proto_tree_add_item(ext_tree_pdp, hf_gtp_send_n_pdu_number, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6214
156
    proto_tree_add_item(ext_tree_pdp, hf_gtp_receive_n_pdu_number, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6215
6216
156
    switch (gtp_version) {
6217
9
    case 0:
6218
9
        proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_flow_label_signalling, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6219
9
        offset = offset + 8;
6220
9
        break;
6221
126
    case 1:
6222
126
        proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_teid_cp,   tvb, offset + 6, 4, ENC_BIG_ENDIAN);
6223
126
        proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_teid_data, tvb, offset + 10, 4, ENC_BIG_ENDIAN);
6224
126
        proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_context_identifier, tvb, offset + 14, 1, ENC_BIG_ENDIAN);
6225
126
        offset = offset + 15;
6226
126
        break;
6227
0
    default:
6228
0
        break;
6229
156
    }
6230
6231
129
    pdp_type_num = tvb_get_uint8(tvb, offset + 1);
6232
129
    pdp_addr_len = tvb_get_uint8(tvb, offset + 2);
6233
6234
129
    proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_organization, tvb, offset, 1, ENC_BIG_ENDIAN);
6235
129
    proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
6236
129
    proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_length, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6237
6238
129
    if (pdp_addr_len > 0) {
6239
73
        switch (pdp_type_num) {
6240
2
        case 0x21:
6241
2
            proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6242
2
            break;
6243
1
        case 0x57:
6244
1
            proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv6, tvb, offset + 3, 16, ENC_NA);
6245
1
            break;
6246
70
        default:
6247
70
            break;
6248
73
        }
6249
73
    }
6250
6251
129
    offset = offset + 3 + pdp_addr_len;
6252
6253
129
    ggsn_addr_len = tvb_get_uint8(tvb, offset);
6254
129
    proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6255
6256
129
    switch (ggsn_addr_len) {
6257
3
    case 4:
6258
3
        proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_control_plane_ipv4, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
6259
3
        break;
6260
1
    case 16:
6261
1
        proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_control_plane_ipv6, tvb, offset + 1, 16, ENC_NA);
6262
1
        break;
6263
114
    default:
6264
114
        break;
6265
129
    }
6266
6267
118
    offset = offset + 1 + ggsn_addr_len;
6268
6269
118
    if (gtp_version == 1) {
6270
6271
110
        ggsn_addr_len = tvb_get_uint8(tvb, offset);
6272
110
        proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6273
6274
110
        switch (ggsn_addr_len) {
6275
5
        case 4:
6276
5
            proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_user_traffic_ipv4, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
6277
5
            break;
6278
4
        case 16:
6279
4
            proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_user_traffic_ipv6, tvb, offset + 1, 16, ENC_NA);
6280
4
            break;
6281
97
        default:
6282
97
            break;
6283
110
        }
6284
105
        offset = offset + 1 + ggsn_addr_len;
6285
6286
105
    }
6287
6288
113
    apn_len = tvb_get_uint8(tvb, offset);
6289
113
    proto_tree_add_item(ext_tree_pdp, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6290
113
    decode_apn(pinfo, tvb, offset + 1, apn_len, ext_tree_pdp, NULL);
6291
6292
113
    offset = offset + 1 + apn_len;
6293
    /*
6294
     * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
6295
     * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
6296
     * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
6297
     * MS is stored in the PDP context IE.
6298
     * NOTE: Bit 5-8 of the first octet in the encoding defined in 3GPP TS 24.007 [3] is mapped into bit 1-4 of the first
6299
     * octet in this field.
6300
     */
6301
113
    trans_id = tvb_get_uint8(tvb, offset);
6302
113
    proto_tree_add_uint(ext_tree_pdp, hf_gtp_transaction_identifier, tvb, offset, 2, trans_id);
6303
113
    offset += 2;
6304
6305
113
    if (ea) {
6306
63
        pdp_type_num = tvb_get_uint8(tvb, offset);
6307
63
        pdp_addr_len = tvb_get_uint8(tvb, offset + 1);
6308
6309
63
        proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_type, tvb, offset, 1, ENC_BIG_ENDIAN);
6310
63
        proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_length, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
6311
6312
63
        if (pdp_addr_len > 0) {
6313
22
            switch (pdp_type_num) {
6314
1
            case 0x21:
6315
1
                proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv4, tvb, offset + 2, 4, ENC_NA);
6316
1
                break;
6317
1
            case 0x57:
6318
1
                proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv6, tvb, offset + 2, 16, ENC_NA);
6319
1
                break;
6320
20
            default:
6321
20
                break;
6322
22
            }
6323
22
        }
6324
63
    }
6325
6326
112
    return 3 + length;
6327
113
}
6328
6329
/* GPRS:        9.60, v7.6.0, chapter 7.9.21
6330
 * UMTS:        29.060, v4.0, chapter 7.7.30
6331
 */
6332
static int
6333
decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6334
9
{
6335
6336
9
    uint16_t    length;
6337
9
    proto_tree *ext_tree_apn;
6338
9
    proto_item *te;
6339
6340
9
    length = tvb_get_ntohs(tvb, offset + 1);
6341
6342
9
    ext_tree_apn = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_APN], &te,
6343
9
                                val_to_str_ext_const(GTP_EXT_APN, &gtp_val_ext, "Unknown field"));
6344
6345
9
    proto_tree_add_item(ext_tree_apn, hf_gtp_apn_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6346
9
    decode_apn(pinfo, tvb, offset + 3, length, ext_tree_apn, te);
6347
6348
9
    return 3 + length;
6349
9
}
6350
6351
/* GPRS:        9.60 v7.6.0, chapter 7.9.22
6352
 *              4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
6353
 * UMTS:        29.060 v4.0, chapter 7.7.31 Protocol Configuration Options
6354
 *              24.008, v4.2, chapter 10.5.6.3
6355
 */
6356
int
6357
decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6358
429
{
6359
6360
429
    uint16_t    length;
6361
429
    tvbuff_t   *next_tvb;
6362
429
    proto_tree *ext_tree_proto;
6363
6364
429
    length = tvb_get_ntohs(tvb, offset + 1);
6365
6366
429
    ext_tree_proto = proto_tree_add_subtree(tree, tvb, offset, length + 3,
6367
429
                ett_gtp_proto, NULL, val_to_str_ext_const(GTP_EXT_PROTO_CONF, &gtp_val_ext, "Unknown message"));
6368
6369
429
    proto_tree_add_uint(ext_tree_proto, hf_gtp_length, tvb, offset + 1, 2, length);
6370
6371
429
    if (length < 1)
6372
2
        return 3;
6373
6374
    /* The Protocol Configuration Options contains external network protocol options that may be necessary to transfer
6375
     * between the GGSN and the MS. The content and the coding of the Protocol Configuration are defined in octet 3-z of the
6376
     * Protocol Configuration Options in3GPP TS 24.008 [5].
6377
     */
6378
427
    next_tvb = tvb_new_subset_length(tvb, offset + 3, length);
6379
427
    de_sm_pco(next_tvb, ext_tree_proto, pinfo, 0, length, NULL, 0);
6380
6381
427
    return 3 + length;
6382
429
}
6383
6384
/* GPRS:        9.60 v7.6.0, chapter 7.9.23
6385
 * UMTS:        29.060 v4.0, chapter 7.7.32
6386
 */
6387
static int
6388
decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args, const char * tree_name, int hf_ipv4, int hf_ipv6)
6389
2
{
6390
6391
2
    uint8_t            addr_type, addr_len;
6392
2
    uint16_t           length;
6393
2
    proto_tree        *ext_tree_gsn_addr;
6394
2
    proto_item        *te;
6395
2
    address           *gsn_address;
6396
6397
2
    length = tvb_get_ntohs(tvb, offset + 1);
6398
6399
2
    ext_tree_gsn_addr = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_gsn_addr, &te, "%s : ", tree_name);
6400
2
    gsn_address = wmem_new0(pinfo->pool, address);
6401
2
    switch (length) {
6402
0
    case 4:
6403
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6404
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6405
0
        if (hf_ipv4 != hf_gtp_gsn_ipv4)
6406
0
            proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN));
6407
0
        proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
6408
0
        set_address_tvb(gsn_address, AT_IPv4, 4, tvb, offset + 3);
6409
0
        break;
6410
0
    case 5:
6411
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_information_element_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6412
0
        addr_type = tvb_get_uint8(tvb, offset + 3) & 0xC0;
6413
0
        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
6414
0
        addr_len = tvb_get_uint8(tvb, offset + 3) & 0x3F;
6415
0
        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
6416
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_ipv4, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6417
0
        if (hf_ipv4 != hf_gtp_gsn_ipv4)
6418
0
            proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, ENC_BIG_ENDIAN));
6419
0
        proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 4));
6420
0
        set_address_tvb(gsn_address, AT_IPv6, 16, tvb, offset + 4);
6421
0
        break;
6422
0
    case 16:
6423
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6424
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_ipv6, tvb, offset + 3, 16, ENC_NA);
6425
0
        if (hf_ipv6 != hf_gtp_gsn_ipv6)
6426
0
            proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, ENC_NA));
6427
0
        proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
6428
0
        set_address_tvb(gsn_address, AT_IPv4, 4, tvb, offset + 3);
6429
0
        break;
6430
0
    case 17:
6431
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_information_element_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6432
0
        addr_type = tvb_get_uint8(tvb, offset + 3) & 0xC0;
6433
0
        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
6434
0
        addr_len = tvb_get_uint8(tvb, offset + 3) & 0x3F;
6435
0
        proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
6436
0
        proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 4));
6437
0
        proto_tree_add_item(ext_tree_gsn_addr, hf_ipv6, tvb, offset + 4, 16, ENC_NA);
6438
0
        if (hf_ipv6 != hf_gtp_gsn_ipv6)
6439
0
            proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, ENC_NA));
6440
0
        set_address_tvb(gsn_address, AT_IPv6, 16, tvb, offset + 4);
6441
0
        break;
6442
2
    default:
6443
2
        proto_item_append_text(te, "unknown type or wrong length");
6444
2
        break;
6445
2
    }
6446
6447
2
    if (g_gtp_session && gtp_version == 1 && !PINFO_FD_VISITED(pinfo)) {
6448
0
        if (!ip_exists(*gsn_address, args->ip_list)) {
6449
0
            copy_address_wmem(pinfo->pool, &args->last_ip, gsn_address);
6450
0
            wmem_list_prepend(args->ip_list, gsn_address);
6451
0
        }
6452
0
    }
6453
2
    return 3 + length;
6454
2
}
6455
6456
static int
6457
2
decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args) {
6458
2
    return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args, "GSN address", hf_gtp_gsn_ipv4, hf_gtp_gsn_ipv6);
6459
2
}
6460
6461
static int
6462
decode_gtp_sgsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6463
0
{
6464
0
    return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6465
0
        "SGSN Address for control plane", hf_gtp_sgsn_address_for_control_plane_ipv4, hf_gtp_sgsn_address_for_control_plane_ipv6);
6466
0
}
6467
6468
static int
6469
decode_gtp_sgsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6470
0
{
6471
0
    return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6472
0
        "SGSN Address for user traffic", hf_gtp_sgsn_address_for_user_traffic_ipv4, hf_gtp_sgsn_address_for_user_traffic_ipv6);
6473
0
}
6474
6475
static int
6476
decode_gtp_ggsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6477
0
{
6478
0
    return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6479
0
        "GGSN Address for control plane", hf_gtp_ggsn_address_for_control_plane_ipv4, hf_gtp_ggsn_address_for_control_plane_ipv6);
6480
0
}
6481
6482
static int
6483
decode_gtp_ggsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6484
0
{
6485
0
    return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6486
0
        "GGSN Address for user traffic", hf_gtp_ggsn_address_for_user_traffic_ipv4, hf_gtp_ggsn_address_for_user_traffic_ipv6);
6487
0
}
6488
6489
/* GPRS:        9.60 v7.6.0, chapter 7.9.24
6490
 * UMTS:        29.060 v4.0, chapter 7.7.33
6491
 */
6492
static int
6493
decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6494
4
{
6495
4
    uint16_t    length;
6496
4
    tvbuff_t   *next_tvb;
6497
4
    proto_tree *ext_tree_proto;
6498
6499
4
    length = tvb_get_ntohs(tvb, offset + 1);
6500
6501
4
    ext_tree_proto = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_proto, NULL,
6502
4
                            val_to_str_ext_const(GTP_EXT_MSISDN, &gtp_val_ext, "Unknown message"));
6503
6504
4
    proto_tree_add_uint(ext_tree_proto, hf_gtp_length, tvb, offset + 1, 2, length);
6505
6506
4
    length = tvb_get_ntohs(tvb, offset + 1);
6507
6508
4
    if (length < 1)
6509
2
        return 3;
6510
6511
2
    next_tvb = tvb_new_subset_length(tvb, offset+3, length);
6512
2
    dissect_gsm_map_msisdn(next_tvb, pinfo, ext_tree_proto);
6513
6514
2
    return 3 + length;
6515
4
}
6516
6517
/* GPRS:        not present
6518
 * UMTS:        29.060 v4.0, chapter 7.7.34
6519
 *              24.008 v4.2, chapter 10.5.6.5
6520
 */
6521
static int
6522
decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6523
12
{
6524
6525
12
    return decode_qos_umts(tvb, offset, pinfo, tree, "Quality of Service", 2);
6526
12
}
6527
6528
/* GPRS:        not present
6529
 * UMTS:        29.060 v4.0, chapter 7.7.35
6530
 */
6531
static int
6532
decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6533
5
{
6534
6535
5
    proto_tree *ext_tree;
6536
5
    uint16_t    length;
6537
5
    uint8_t     xres_len, auth_len;
6538
6539
6540
5
    length = tvb_get_ntohs(tvb, offset + 1);
6541
6542
5
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, length + 1, ett_gtp_quint, NULL, "Quintuplet");
6543
5
    offset++;
6544
6545
5
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6546
5
    offset = offset + 2;
6547
6548
5
    proto_tree_add_item(ext_tree, hf_gtp_rand, tvb, offset, 16, ENC_NA);
6549
5
    offset = offset + 16;
6550
5
    xres_len = tvb_get_uint8(tvb, offset);
6551
5
    proto_tree_add_item(ext_tree, hf_gtp_xres_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6552
5
    offset++;
6553
5
    proto_tree_add_item(ext_tree, hf_gtp_xres, tvb, offset, xres_len, ENC_NA);
6554
5
    offset = offset + xres_len;
6555
5
    proto_tree_add_item(ext_tree, hf_gtp_quintuplet_ciphering_key, tvb, offset, 16, ENC_NA);
6556
5
    offset = offset + 16;
6557
5
    proto_tree_add_item(ext_tree, hf_gtp_quintuplet_integrity_key, tvb, offset, 16, ENC_NA);
6558
5
    offset = offset + 16;
6559
5
    auth_len = tvb_get_uint8(tvb, offset);
6560
5
    proto_tree_add_item(ext_tree, hf_gtp_authentication_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6561
5
    offset++;
6562
5
    proto_tree_add_item(ext_tree, hf_gtp_auth, tvb, offset, auth_len, ENC_NA);
6563
6564
5
    return (3 + length);
6565
6566
5
}
6567
6568
/* GPRS:        not present
6569
 * UMTS:        29.060 v4.0, chapter 7.7.36
6570
 *              24.008 v4.2, chapter 10.5.6.12
6571
 */
6572
static int
6573
decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6574
111
{
6575
111
    proto_tree     *ext_tree_tft;
6576
111
    unsigned       length;
6577
6578
111
    length = tvb_get_ntohs(tvb, offset + 1);
6579
6580
111
    ext_tree_tft = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_tft, NULL, "Traffic flow template");
6581
111
    proto_tree_add_item(ext_tree_tft, hf_gtp_tft_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6582
6583
    /* The detailed coding of Traffic Flow Template
6584
    * Description is specified in 3GPP TS 24.008 [5] ,
6585
    * clause 10.5.6.12, beginning with octet 3..
6586
    * Use the decoding in packet-gsm_a_gm.c
6587
    */
6588
111
    de_sm_tflow_temp(tvb, ext_tree_tft, pinfo, offset + 3, length, NULL, 0);
6589
6590
111
    return 3 + length;
6591
111
}
6592
6593
/* GPRS:        not present
6594
 * UMTS:        3GPP TS 29.060 version 10.4.0 Release 10, chapter 7.7.37
6595
 * Type = 138 (Decimal)
6596
 *              25.413(RANAP) TargetID
6597
 * There are several CRs to this IE make sure to check with a recent spec if dissection is questioned.
6598
 */
6599
static int
6600
decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6601
2
{
6602
6603
2
    uint16_t        length;
6604
2
    proto_tree      *ext_tree;
6605
6606
6607
2
    length = tvb_get_ntohs(tvb, offset + 1);
6608
6609
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_TARGET_ID], NULL, "Target Identification");
6610
2
    offset = offset + 1;
6611
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6612
2
    offset = offset + 2;
6613
2
    if (length == 0){
6614
0
        return 3 + length;
6615
0
    }
6616
6617
    /* Quote from specification:
6618
     * The Target Identification information element contains the identification of a target RNC. Octets 4-n shall contain a
6619
     * non-transparent copy of the corresponding IEs (see subclause 7.7.2) and be encoded as specified in Figure 51 below.
6620
     * The "Target RNC-ID" part of the "Target ID" parameter is specified in 3GPP TS 25.413 [7].
6621
     * NOTE 1: The ASN.1 parameter "Target ID" is forwarded non-transparently in order to maintain backward compatibility.
6622
     * NOTE 2: The preamble of the "Target RNC-ID" (numerical value of e.g. 0x20) however shall not be included in
6623
     *         octets 4-n. Also the optional "iE-Extensions" parameter shall not be included into the GTP IE.
6624
     */
6625
    /* Octet 4-6 MCC + MNC */
6626
2
    if (length == 9) {
6627
        /* Patch for systems still not following NOTE 2 */
6628
0
        proto_tree_add_expert_format(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, 1, "Not Compliant with 3GPP TS 29.060 7.7.37: The preamble of the \"Target RNC-ID\" (numerical value of e.g. 0x20) however shall not be included in octets 4-n.");
6629
0
        offset+=1;
6630
0
        dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, false);
6631
2
    } else {
6632
        /* Following Standards */
6633
2
        dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
6634
2
    }
6635
2
    offset+=3;
6636
6637
    /* Octet 7-8 LAC */
6638
2
    proto_tree_add_item(ext_tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
6639
2
    offset+=2;
6640
    /* Octet 9 RAC */
6641
2
    proto_tree_add_item(ext_tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
6642
2
    offset++;
6643
    /* Octet 10-11 RNC-ID*/
6644
2
    proto_tree_add_item(ext_tree, hf_gtp_target_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
6645
2
    offset+=2;
6646
    /* If the optional Extended RNC-ID is not included, then the length variable 'n' = 8 and the overall length of the IE is 11
6647
     * octets. Otherwise, 'n' = 10 and the overall length of the IE is 13 octets
6648
     */
6649
2
    if(length == 10){
6650
0
        proto_tree_add_item(ext_tree, hf_gtp_target_ext_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
6651
0
    }
6652
6653
2
    return 3 + length;
6654
2
}
6655
6656
6657
/* GPRS:        not present
6658
 * UMTS:        29.060 v4.0, chapter 7.7.38
6659
 */
6660
static int
6661
decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6662
6
{
6663
6664
6
    uint16_t    length;
6665
6
    proto_tree *ext_tree;
6666
6
    tvbuff_t   *new_tvb;
6667
6
    proto_tree *sub_tree;
6668
6669
6
    length = tvb_get_ntohs(tvb, offset + 1);
6670
6671
6
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UTRAN_CONT], NULL, "UTRAN transparent Container");
6672
6673
6
    offset = offset + 1;
6674
6
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6675
6
    offset = offset + 2;
6676
6
    proto_tree_add_item(ext_tree, hf_gtp_utran_field, tvb, offset, length, ENC_NA);
6677
6
    if (length == 0) {
6678
4
        return 3;
6679
4
    }
6680
6681
2
    switch (pinfo->link_dir) {
6682
0
    case P2P_DIR_UL:
6683
0
        sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_utran_cont, NULL, "Source RNC to Target RNC Transparent Container");
6684
0
        new_tvb = tvb_new_subset_length(tvb, offset, length);
6685
0
        dissect_ranap_SourceRNC_ToTargetRNC_TransparentContainer_PDU(new_tvb, pinfo, sub_tree, NULL);
6686
0
        break;
6687
0
    case P2P_DIR_DL:
6688
0
        sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_utran_cont, NULL, "Target RNC to Source RNC Transparent Container");
6689
0
        new_tvb = tvb_new_subset_length(tvb, offset, length);
6690
0
        dissect_ranap_TargetRNC_ToSourceRNC_TransparentContainer_PDU(new_tvb, pinfo, sub_tree, NULL);
6691
0
        break;
6692
1
    default:
6693
1
        break;
6694
2
    }
6695
6696
1
    return 3 + length;
6697
6698
2
}
6699
6700
6701
/* GPRS:        not present
6702
 * UMTS:        29.060 v4.0, chapter 7.7.39
6703
 */
6704
static int
6705
decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6706
3
{
6707
6708
3
    uint32_t           teid;
6709
3
    uint16_t           length;
6710
3
    proto_tree        *ext_tree_rab_setup;
6711
6712
3
    length = tvb_get_ntohs(tvb, offset + 1);
6713
6714
3
    ext_tree_rab_setup = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_rab_setup, NULL, "Radio Access Bearer Setup Information");
6715
6716
3
    proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rab_setup_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6717
3
    proto_tree_add_item(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6718
6719
3
    if (length > 1) {
6720
6721
3
        teid = tvb_get_ntohl(tvb, offset + 4);
6722
6723
3
        proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
6724
6725
3
        switch (length) {
6726
0
        case 9:
6727
0
            proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6728
0
            break;
6729
0
        case 21:
6730
0
            proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, ENC_NA);
6731
0
            break;
6732
3
        default:
6733
3
            break;
6734
3
        }
6735
3
    }
6736
6737
3
    return 3 + length;
6738
3
}
6739
6740
6741
/* GPRS:        not present
6742
 * UMTS:        29.060 v4.0, chapter 7.7.40
6743
 */
6744
static int
6745
decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6746
24
{
6747
6748
24
    int         i;
6749
24
    uint8_t     length, hdr;
6750
24
    proto_tree *ext_tree_hdr_list;
6751
6752
24
    length = tvb_get_uint8(tvb, offset + 1);
6753
6754
24
    ext_tree_hdr_list = proto_tree_add_subtree(tree, tvb, offset, 2 + length, ett_gtp_hdr_list, NULL,
6755
24
                            val_to_str_ext_const(GTP_EXT_HDR_LIST, &gtp_val_ext, "Unknown"));
6756
6757
24
    proto_tree_add_item(ext_tree_hdr_list, hf_gtp_num_ext_hdr_types, tvb, offset + 1, 1, ENC_NA);
6758
6759
1.64k
    for (i = 0; i < length; i++) {
6760
1.62k
        hdr = tvb_get_uint8(tvb, offset + 2 + i);
6761
6762
1.62k
        proto_tree_add_uint_format(ext_tree_hdr_list, hf_gtp_ext_hdr_type, tvb, offset + 2 + i, 1, hdr, "No. %u --> Extension Header Type value : %s (0x%02x)", i + 1,
6763
1.62k
                            val_to_str_const(hdr, next_extension_header_fieldvals, "Unknown Extension Header Type"), hdr);
6764
1.62k
    }
6765
6766
24
    return 2 + length;
6767
24
}
6768
6769
/* GPRS:        not present
6770
 * UMTS:        29.060 v4.0, chapter 7.7.41
6771
 * TODO:        find TriggerID description
6772
 */
6773
static int
6774
decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6775
1
{
6776
1
    uint16_t length;
6777
1
    proto_item* ti;
6778
6779
1
    length = tvb_get_ntohs(tvb, offset + 1);
6780
6781
1
    ti = proto_tree_add_uint_format(tree, hf_gtp_ext_length, tvb, offset, 2, length, "%s length : %u",
6782
1
                                  val_to_str_ext_const(GTP_EXT_TRIGGER_ID, &gtp_val_ext, "Unknown"), length);
6783
1
    proto_item_set_len(ti, 3 + length);
6784
6785
1
    return 3 + length;
6786
6787
1
}
6788
6789
/* GPRS:        not present
6790
 * UMTS:        29.060 v4.0, chapter 7.7.42
6791
 * TODO:        find OMC-ID description
6792
 */
6793
static int
6794
decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6795
4
{
6796
4
    uint16_t length;
6797
4
    proto_item* ti;
6798
6799
4
    length = tvb_get_ntohs(tvb, offset + 1);
6800
6801
4
    ti = proto_tree_add_uint_format(tree, hf_gtp_ext_length, tvb, offset, 2, length, "%s length : %u",
6802
4
                                  val_to_str_ext_const(GTP_EXT_OMC_ID, &gtp_val_ext, "Unknown"), length);
6803
4
    proto_item_set_len(ti, 3 + length);
6804
6805
4
    return 3 + length;
6806
6807
4
}
6808
6809
/* GPRS:        9.60 v7.6.0, chapter 7.9.25
6810
 * UMTS:        29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
6811
 */
6812
static int
6813
decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6814
6
{
6815
6816
6
    uint16_t           length;
6817
6
    proto_tree        *ext_tree_chrg_addr;
6818
6
    proto_item        *te;
6819
6820
6
    length = tvb_get_ntohs(tvb, offset + 1);
6821
6822
6
    ext_tree_chrg_addr = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CHRG_ADDR], &te,
6823
6
                                    "%s : ", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"));
6824
6825
6
    proto_tree_add_uint_format(ext_tree_chrg_addr, hf_gtp_ext_length, tvb, offset + 1, 2, length,
6826
6
                                    "%s length : %u", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"), length);
6827
6828
6
    switch (length) {
6829
0
    case 4:
6830
0
        proto_tree_add_item(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6831
0
        proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
6832
0
        break;
6833
0
    case 16:
6834
0
        proto_tree_add_item(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, ENC_NA);
6835
0
        proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
6836
0
        break;
6837
6
    default:
6838
6
        proto_item_append_text(te, "unknown type or wrong length");
6839
6
        break;
6840
6
    }
6841
6842
6
    return 3 + length;
6843
6
}
6844
6845
/* GPRS:        ?
6846
 * UMTS:        29.060 V9.4.0, chapter 7.7.43 RAN Transparent Container
6847
 * The information in the value part of the RAN Transparent Container IE contains all information elements (starting with
6848
 * and including the BSSGP "PDU Type") in either of the RAN INFORMATION, RAN INFORMATION REQUEST,
6849
 * RAN INFORMATION ACK or RAN INFORMATION ERROR messages respectively as specified in 3GPP TS 48.018
6850
 */
6851
static int
6852
decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6853
3
{
6854
6855
3
    uint16_t    length;
6856
3
    proto_tree *ext_tree;
6857
3
    tvbuff_t   *next_tvb;
6858
6859
3
    length = tvb_get_ntohs(tvb, offset + 1);
6860
3
    ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RAN_TR_CONT], NULL,
6861
3
                        "%s : ", val_to_str_ext_const(GTP_EXT_RAN_TR_CONT, &gtp_val_ext, "Unknown"));
6862
6863
3
    offset++;
6864
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6865
3
    offset = offset + 2;
6866
6867
3
    next_tvb = tvb_new_subset_length(tvb, offset, length);
6868
3
    if (bssgp_handle) {
6869
#if 0
6870
        col_set_fence(pinfo->cinfo, COL_INFO);
6871
#endif
6872
3
        call_dissector(bssgp_handle, next_tvb, pinfo, ext_tree);
6873
3
    }
6874
6875
3
    return 3 + length;
6876
6877
3
}
6878
6879
/* GPRS:        ?
6880
 * UMTS:        29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
6881
 */
6882
static int
6883
decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6884
4
{
6885
6886
4
    uint16_t    length;
6887
4
    proto_tree *ext_tree;
6888
6889
4
    length = tvb_get_ntohs(tvb, offset + 1);
6890
4
    ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PDP_CONT_PRIO], NULL,
6891
4
                        "%s : ", val_to_str_ext_const(GTP_EXT_PDP_CONT_PRIO, &gtp_val_ext, "Unknown"));
6892
6893
4
    if (length == 0) {
6894
0
        return 3;
6895
0
    }
6896
6897
4
    offset++;
6898
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6899
4
    offset = offset + 2;
6900
    /* TODO add decoding of data */
6901
4
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
6902
6903
4
    return 3 + length;
6904
6905
4
}
6906
6907
/* GPRS:        ?
6908
 * UMTS:        29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
6909
 */
6910
static int
6911
decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6912
11
{
6913
6914
11
    uint16_t    length;
6915
11
    proto_tree *ext_tree;
6916
6917
11
    length = tvb_get_ntohs(tvb, offset + 1);
6918
11
    ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_RAB_SETUP_INF], NULL,
6919
11
                    "%s : ", val_to_str_ext_const(GTP_EXT_ADD_RAB_SETUP_INF, &gtp_val_ext, "Unknown"));
6920
6921
11
    offset++;
6922
11
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6923
11
    offset = offset + 2;
6924
6925
11
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
6926
11
    if (length == 1)
6927
0
        return 3 + length;
6928
6929
11
    offset++;
6930
11
    proto_tree_add_item(ext_tree, hf_gtp_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
6931
11
    offset += 4;
6932
6933
11
    if (length == 9) {
6934
        /* RNC IP address IPv4*/
6935
0
        proto_tree_add_item(ext_tree, hf_gtp_rnc_ip_addr_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
6936
11
    } else {
6937
        /* RNC IP address IPv6*/
6938
11
        proto_tree_add_item(ext_tree, hf_gtp_rnc_ip_addr_v6, tvb, offset, 16, ENC_NA);
6939
11
    }
6940
6941
6942
11
    return 3 + length;
6943
6944
11
}
6945
6946
6947
 /* GPRS:       ?
6948
  * UMTS:       29.060 v6.11.0, chapter 7.7.47 SGSN Number
6949
  */
6950
static int
6951
decode_gtp_sgsn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6952
2
{
6953
6954
2
    uint16_t    length;
6955
2
    proto_tree *ext_tree;
6956
2
    tvbuff_t   *new_tvb;
6957
6958
2
    length = tvb_get_ntohs(tvb, offset + 1);
6959
2
    ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SGSN_NO], NULL,
6960
2
                    "%s", val_to_str_ext_const(GTP_EXT_SGSN_NO, &gtp_val_ext, "Unknown"));
6961
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
6962
6963
2
    offset++;
6964
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6965
2
    offset = offset + 2;
6966
6967
2
    new_tvb = tvb_new_subset_length(tvb, offset, length);
6968
2
    dissect_gsm_map_msisdn(new_tvb, pinfo, ext_tree);
6969
6970
2
    return 3 + length;
6971
6972
2
}
6973
6974
/* GPRS:        ?
6975
 * UMTS:        3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
6976
 */
6977
static int
6978
decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6979
1
{
6980
6981
1
    uint16_t    length;
6982
1
    proto_tree *ext_tree;
6983
6984
1
    length = tvb_get_ntohs(tvb, offset + 1);
6985
1
    ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_COMMON_FLGS], NULL,
6986
1
                "%s : ", val_to_str_ext_const(GTP_EXT_COMMON_FLGS, &gtp_val_ext, "Unknown"));
6987
6988
1
    offset++;
6989
1
    proto_tree_add_item(ext_tree, hf_gtp_ext_length,                   tvb, offset, 2, ENC_BIG_ENDIAN);
6990
1
    offset = offset + 2;
6991
    /* Dual Address Bearer Flag */
6992
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_dual_addr_bearer_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
6993
    /* Upgrade QoS Supported */
6994
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup,        tvb, offset, 1, ENC_BIG_ENDIAN);
6995
    /* NRSN bit field */
6996
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn,                 tvb, offset, 1, ENC_BIG_ENDIAN);
6997
    /* No QoS negotiation */
6998
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg,           tvb, offset, 1, ENC_BIG_ENDIAN);
6999
    /* MBMS Counting Information bi */
7000
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf,          tvb, offset, 1, ENC_BIG_ENDIAN);
7001
    /* RAN Procedures Ready */
7002
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy,      tvb, offset, 1, ENC_BIG_ENDIAN);
7003
    /* MBMS Service Type */
7004
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type,         tvb, offset, 1, ENC_BIG_ENDIAN);
7005
    /* Prohibit Payload Compression */
7006
1
    proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc,                  tvb, offset, 1, ENC_BIG_ENDIAN);
7007
7008
1
    return 3 + length;
7009
7010
1
}
7011
7012
/* GPRS:        ?
7013
 * UMTS:        29.060 v6.11.0, chapter 7.7.49
7014
 */
7015
static int
7016
decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7017
18
{
7018
7019
18
    uint16_t    length;
7020
18
    proto_tree *ext_tree_apn_res;
7021
7022
18
    length = tvb_get_ntohs(tvb, offset + 1);
7023
18
    ext_tree_apn_res = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length,  ett_gtp_ies[GTP_EXT_APN_RES], NULL,
7024
18
                "%s : ", val_to_str_ext_const(GTP_EXT_APN_RES, &gtp_val_ext, "Unknown"));
7025
7026
18
    offset++;
7027
18
    proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7028
18
    offset = offset + 2;
7029
7030
    /* Restriction Type value */
7031
18
    if (length != 1) {
7032
17
        proto_tree_add_expert_format(tree, pinfo, &ei_gtp_ext_length_mal, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
7033
17
        return 3 + length;
7034
17
    }
7035
7036
1
    proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, ENC_BIG_ENDIAN);
7037
1
    return 3 + length;
7038
18
}
7039
7040
/* GPRS:        ?
7041
 * UMTS:        29.060 v6.11.0, chapter 7.7.50 RAT Type
7042
 * RAT Type
7043
 * Type = 151 (Decimal)
7044
 */
7045
7046
static int
7047
decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7048
5
{
7049
7050
5
    uint16_t    length;
7051
5
    proto_tree *ext_tree_rat_type;
7052
5
    proto_item *te;
7053
7054
5
    length = tvb_get_ntohs(tvb, offset + 1);
7055
5
    ext_tree_rat_type = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RAT_TYPE], &te,
7056
5
                        val_to_str_ext_const(GTP_EXT_RAT_TYPE, &gtp_val_ext, "Unknown"));
7057
7058
5
    offset++;
7059
5
    proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7060
5
    offset = offset + 2;
7061
7062
    /* RAT Type value */
7063
5
    if (length != 1) {
7064
4
        proto_tree_add_expert_format(tree, pinfo, &ei_gtp_ext_length_mal, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
7065
4
        return 3 + length;
7066
4
    }
7067
7068
1
   proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, ENC_BIG_ENDIAN);
7069
1
   proto_item_append_text(te, ": %s", val_to_str_const(tvb_get_uint8(tvb,offset), gtp_ext_rat_type_vals, "Unknown"));
7070
7071
1
   return 3 + length;
7072
5
}
7073
7074
/*
7075
 * 7.7.51 User Location Information
7076
 */
7077
7078
void
7079
dissect_gtp_uli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7080
3
{
7081
3
    uint8_t     geo_loc_type;
7082
3
    proto_item* ti;
7083
7084
    /* Geographic Location Type */
7085
3
    geo_loc_type = tvb_get_uint8(tvb, offset);
7086
3
    ti = proto_tree_add_uint(tree, hf_gtp_uli_geo_loc_type, tvb, offset, 1, geo_loc_type);
7087
7088
3
    offset++;
7089
7090
3
    switch(geo_loc_type) {
7091
1
        case 0:
7092
            /* Geographic Location field included and it holds the Cell Global
7093
             * Identification (CGI) of where the user currently is registered.
7094
             * CGI is defined in sub-clause 4.3.1 of 3GPP TS 23.003 [2].
7095
             */
7096
1
            dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_CGI, true);
7097
1
            offset+=3;
7098
1
            proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7099
1
            offset+=2;
7100
            /* The CI is of fixed length with 2 octets and it can be coded using a full hexadecimal representation */
7101
1
            proto_tree_add_item(tree, hf_gtp_cgi_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
7102
1
            break;
7103
0
        case 1:
7104
            /* Geographic Location field included and it holds the Service
7105
             * Area Identity (SAI) of where the user currently is registered.
7106
             * SAI is defined in sub-clause 9.2.3.9 of 3GPP TS 25.413 [7].
7107
             */
7108
0
            dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_SAI, true);
7109
0
            offset+=3;
7110
0
            proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7111
0
            offset+=2;
7112
0
            proto_tree_add_item(tree, hf_gtp_sai_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
7113
0
            break;
7114
0
        case 2:
7115
            /* Geographic Location field included and it holds the Routing
7116
             * Area Identification (RAI) of where the user currently is
7117
             * registered. RAI is defined in sub-clause 4.2 of 3GPP TS 23.003
7118
             * [2].
7119
             *
7120
             * The routing area code consists of 2 octets and is found in octet
7121
             * 10 and octet 11. Only the first octet (10) contains the RAC and
7122
             * the second octet (11) is coded as "11111111".
7123
             */
7124
0
            dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_RAI, true);
7125
0
            offset+=3;
7126
0
            proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7127
0
            offset+=2;
7128
0
            proto_tree_add_item(tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
7129
0
            break;
7130
2
        default:
7131
2
            expert_add_info(pinfo, ti, &ei_gtp_ext_geo_loc_type);
7132
2
            break;
7133
3
    }
7134
3
}
7135
7136
static int
7137
decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7138
3
{
7139
7140
3
    uint16_t    length;
7141
3
    proto_tree *ext_tree;
7142
7143
3
    length = tvb_get_ntohs(tvb, offset + 1);
7144
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_USR_LOC_INF], NULL,
7145
3
                val_to_str_ext_const(GTP_EXT_USR_LOC_INF, &gtp_val_ext, "Unknown"));
7146
7147
3
    offset++;
7148
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7149
3
    offset = offset + 2;
7150
7151
3
    dissect_gtp_uli(tvb, offset, pinfo, ext_tree, args);
7152
7153
3
    return 3 + length;
7154
3
}
7155
7156
static const value_string daylight_saving_time_vals[] = {
7157
    {0, "No adjustment"},
7158
    {1, "+1 hour adjustment for Daylight Saving Time"},
7159
    {2, "+2 hours adjustment for Daylight Saving Time"},
7160
    {3, "Reserved"},
7161
    {0, NULL}
7162
};
7163
7164
/* GPRS:        ?
7165
 * UMTS:        29.060 v6.11.0, chapter 7.7.52
7166
 * MS Time Zone
7167
 * Type = 153 (Decimal)
7168
 * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
7169
 * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
7170
 * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
7171
 * its value shall be set as defined in 3GPP TS 22.042
7172
 */
7173
static int
7174
decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7175
7
{
7176
7177
7
    uint16_t    length;
7178
7
    proto_tree *ext_tree;
7179
7
    proto_item *te;
7180
7
    uint8_t     data;
7181
7
    char        sign;
7182
7183
7
    length = tvb_get_ntohs(tvb, offset + 1);
7184
7
    ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MS_TIME_ZONE], &te,
7185
7
                    "%s: ", val_to_str_ext_const(GTP_EXT_MS_TIME_ZONE, &gtp_val_ext, "Unknown"));
7186
7187
7
    offset++;
7188
7
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7189
7
    offset = offset + 2;
7190
7191
    /* 3GPP TS 23.040 version 6.6.0 Release 6
7192
     * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
7193
     * :
7194
     * The Time Zone indicates the difference, expressed in quarters of an hour,
7195
     * between the local time and GMT. In the first of the two semi-octets,
7196
     * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
7197
     * represents the algebraic sign of this difference (0: positive, 1: negative).
7198
     */
7199
7200
7
    data = tvb_get_uint8(tvb, offset);
7201
7
    sign = (data & 0x08) ? '-' : '+';
7202
7
    data = (data >> 4) + (data & 0x07) * 10;
7203
7204
7
    proto_tree_add_uint_format_value(ext_tree, hf_gtp_timezone, tvb, offset, 1, data, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
7205
7
    proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
7206
7
    offset++;
7207
7208
7
    proto_tree_add_item(ext_tree, hf_gtp_timezone_dst, tvb, offset, 1, ENC_NA);
7209
7210
7
    return 3 + length;
7211
7212
7
}
7213
7214
/* GPRS:        ?
7215
 * UMTS:        29.060 v6.11.0, chapter 7.7.53
7216
 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
7217
 * Type = 154 (Decimal)
7218
 */
7219
static int
7220
decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7221
3
{
7222
7223
3
    uint16_t    length;
7224
3
    proto_tree *ext_imeisv;
7225
3
    proto_item *te;
7226
3
    tvbuff_t   *next_tvb;
7227
3
    char       *digit_str;
7228
7229
3
    length = tvb_get_ntohs(tvb, offset + 1);
7230
3
    ext_imeisv = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_IMEISV], &te,
7231
3
                        val_to_str_ext_const(GTP_EXT_IMEISV, &gtp_val_ext, "Unknown"));
7232
7233
3
    offset++;
7234
3
    proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7235
3
    offset = offset + 2;
7236
7237
    /* IMEI(SV)
7238
     * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
7239
     * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
7240
     * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
7241
     * set to '1111'. Both IMEI and IMEISV are BCD encoded.
7242
     */
7243
3
    next_tvb = tvb_new_subset_length(tvb, offset, length);
7244
3
    proto_tree_add_item_ret_display_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, ENC_BCD_DIGITS_0_9|ENC_LITTLE_ENDIAN, pinfo->pool, &digit_str);
7245
3
    proto_item_append_text(te, ": %s", digit_str);
7246
7247
3
    return 3 + length;
7248
3
}
7249
7250
/* GPRS:        ?
7251
 * UMTS:        29.060 v6.11.0, chapter 7.7.54
7252
 * CAMEL Charging Information Container
7253
 * Type = 155 (Decimal)
7254
 */
7255
static int
7256
decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7257
31
{
7258
7259
31
    uint16_t    length;
7260
31
    proto_tree *ext_tree;
7261
7262
31
    length = tvb_get_ntohs(tvb, offset + 1);
7263
31
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CAMEL_CHG_INF_CON], NULL,
7264
31
                    val_to_str_ext_const(GTP_EXT_CAMEL_CHG_INF_CON, &gtp_val_ext, "Unknown"));
7265
7266
31
    offset++;
7267
31
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7268
31
    offset = offset + 2;
7269
31
    dissect_gprscdr_CAMELInformationPDP_PDU(tvb_new_subset_length(tvb, offset, length), pinfo, ext_tree, NULL);
7270
7271
31
    return 3 + length;
7272
7273
31
}
7274
7275
/* GPRS:        ?
7276
 * UMTS:        29.060 v6.11.0, chapter 7.7.55
7277
 * MBMS UE Context
7278
 */
7279
static int
7280
decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7281
10
{
7282
7283
10
    uint16_t    length;
7284
10
    proto_tree *ext_tree;
7285
10
    uint8_t     enh_nsapi, trans_id;
7286
10
    uint32_t    pdp_type_num, pdp_addr_len, ggsn_addr_len, apn_len;
7287
7288
10
    length = tvb_get_ntohs(tvb, offset + 1);
7289
10
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_UE_CTX], NULL,
7290
10
                val_to_str_ext_const(GTP_EXT_MBMS_UE_CTX, &gtp_val_ext, "Unknown"));
7291
7292
10
    offset++;
7293
10
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7294
10
    offset = offset + 2;
7295
10
    proto_tree_add_item(ext_tree, hf_gtp_linked_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7296
10
    offset++;
7297
10
    proto_tree_add_item(ext_tree, hf_gtp_uplink_teid_cp, tvb, offset, 4, ENC_BIG_ENDIAN);
7298
10
    offset += 4;
7299
10
    enh_nsapi = tvb_get_uint8(tvb, offset);
7300
10
    if (enh_nsapi < 128) {
7301
5
        proto_tree_add_uint_format_value(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, enh_nsapi, "Reserved");
7302
5
    } else {
7303
5
        proto_tree_add_item(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7304
5
    }
7305
10
    offset++;
7306
10
    proto_tree_add_item(ext_tree, hf_gtp_pdp_organization, tvb, offset, 1, ENC_BIG_ENDIAN);
7307
10
    offset++;
7308
10
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_pdp_type, tvb, offset, 1, ENC_BIG_ENDIAN, &pdp_type_num);
7309
10
    offset++;
7310
10
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_pdp_address_length, tvb, offset, 1, ENC_BIG_ENDIAN, &pdp_addr_len);
7311
10
    offset++;
7312
10
    if (pdp_addr_len > 0) {
7313
7
        switch (pdp_type_num) {
7314
0
        case 0x21:
7315
0
            proto_tree_add_item(ext_tree, hf_gtp_pdp_address_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
7316
0
            break;
7317
0
        case 0x57:
7318
0
            proto_tree_add_item(ext_tree, hf_gtp_pdp_address_ipv6, tvb, offset, 16, ENC_NA);
7319
0
            break;
7320
7
        default:
7321
7
            break;
7322
7
        }
7323
7
        offset += pdp_addr_len;
7324
7
    }
7325
10
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN, &ggsn_addr_len);
7326
10
    offset++;
7327
7328
10
    switch (ggsn_addr_len) {
7329
0
    case 4:
7330
0
        proto_tree_add_item(ext_tree, hf_gtp_ggsn_address_for_control_plane_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
7331
0
        break;
7332
0
    case 16:
7333
0
        proto_tree_add_item(ext_tree, hf_gtp_ggsn_address_for_control_plane_ipv6, tvb, offset, 16, ENC_NA);
7334
0
        break;
7335
8
    default:
7336
        /* XXX: Expert info? */
7337
8
        break;
7338
10
    }
7339
8
    offset += ggsn_addr_len;
7340
7341
8
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN, &apn_len);
7342
8
    offset++;
7343
8
    decode_apn(pinfo, tvb, offset, apn_len, ext_tree, NULL);
7344
8
    offset += apn_len;
7345
    /*
7346
     * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
7347
     * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
7348
     * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
7349
     * MS is stored in the MBMS context IE.
7350
     * NOTE: Bit 5-8 of the first octet in the encoding defined in 3GPP TS 24.007 [3] is mapped into bit 1-4 of the first
7351
     * octet in this field.
7352
     */
7353
8
    trans_id = tvb_get_uint8(tvb, offset);
7354
8
    proto_tree_add_uint(ext_tree, hf_gtp_transaction_identifier, tvb, offset, 2, trans_id);
7355
7356
8
    return 3 + length;
7357
7358
10
}
7359
7360
/* GPRS:        ?
7361
 * UMTS:        3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
7362
 * Temporary Mobile Group Identity (TMGI)
7363
 * The Temporary Mobile Group Identity (TMGI) information element contains
7364
 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
7365
 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
7366
 */
7367
7368
static int
7369
decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7370
4
{
7371
7372
4
    uint16_t    length;
7373
4
    proto_tree *ext_tree, *tmgi_tree;
7374
4
    proto_item *ti;
7375
4
    tvbuff_t   *next_tvb;
7376
7377
4
    length = tvb_get_ntohs(tvb, offset + 1);
7378
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_TMGI], NULL,
7379
4
                val_to_str_ext_const(GTP_EXT_TMGI, &gtp_val_ext, "Unknown"));
7380
7381
4
    offset++;
7382
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7383
4
    offset = offset + 2;
7384
7385
4
    ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, ENC_NA);
7386
7387
4
    tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
7388
4
    next_tvb = tvb_new_subset_length(tvb, offset, length);
7389
4
    de_mid(next_tvb, tmgi_tree, pinfo, 0, length, NULL, 0);
7390
4
    return 3 + length;
7391
7392
4
}
7393
7394
/* GPRS:        ?
7395
 * UMTS:        29.060 v6.11.0, chapter 7.7.57
7396
 * RIM Routing Address
7397
 */
7398
static int
7399
decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7400
17
{
7401
7402
17
    uint16_t    length;
7403
17
    proto_tree *ext_tree;
7404
17
    proto_item *pi;
7405
7406
17
    length = tvb_get_ntohs(tvb, offset + 1);
7407
17
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RIM_RA], NULL,
7408
17
                            val_to_str_ext_const(GTP_EXT_RIM_RA, &gtp_val_ext, "Unknown"));
7409
7410
17
    offset++;
7411
17
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7412
17
    offset = offset + 2;
7413
    /* To dissect the Address the Routing Address discriminator must be known */
7414
    /*
7415
     * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
7416
     */
7417
17
    pi = proto_tree_add_item(ext_tree, hf_gtp_rim_routing_addr, tvb, offset, length, ENC_NA);
7418
17
    if (PINFO_FD_VISITED(pinfo)) {
7419
0
        gtp_private_data_t *gtp_data = gtp_get_private_data(pinfo);
7420
0
        proto_tree *addr_tree = proto_item_add_subtree(pi, ett_gtp_rim_routing_adr);
7421
7422
0
        switch (gtp_data->rim_routing_addr_disc) {
7423
0
        case 0:
7424
0
            de_bssgp_cell_id(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7425
0
            break;
7426
0
        case -1:
7427
0
        case 1:
7428
0
            de_bssgp_rnc_identifier(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7429
0
            break;
7430
0
        case 2:
7431
0
            de_bssgp_enb_id(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7432
0
            break;
7433
0
        default:
7434
0
            break;
7435
0
        }
7436
0
    }
7437
7438
17
    return 3 + length;
7439
7440
17
}
7441
7442
/* GPRS:        ?
7443
 * UMTS:        29.060 v6.11.0, chapter 7.7.58
7444
 * MBMS Protocol Configuration Options
7445
 */
7446
static int
7447
decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7448
4
{
7449
7450
4
    uint16_t    length;
7451
4
    proto_tree *ext_tree;
7452
4
    tvbuff_t   *next_tvb;
7453
7454
4
    length = tvb_get_ntohs(tvb, offset + 1);
7455
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_PROT_CONF_OPT], NULL,
7456
4
                    val_to_str_ext_const(GTP_EXT_MBMS_PROT_CONF_OPT, &gtp_val_ext, "Unknown"));
7457
7458
4
    offset++;
7459
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7460
4
    offset = offset + 2;
7461
    /* The MBMS Protocol Configuration Options contains protocol options
7462
     * associated with an MBMS context, that may be necessary to transfer
7463
     * between the GGSN and the MS. The content and the coding of the MBMS
7464
     * Protocol Configuration Options are defined in octets 3-z of the MBMS
7465
     * Protocol Configuration Options in 3GPP TS 24.008 [5].
7466
     */
7467
4
    next_tvb = tvb_new_subset_length(tvb, offset, length);
7468
4
    de_sm_mbms_prot_conf_opt(next_tvb, ext_tree, pinfo, 0, length, NULL, 0);
7469
7470
4
    return 3 + length;
7471
7472
4
}
7473
7474
/* GPRS:        ?
7475
 * UMTS:        3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
7476
 * MBMS Session Duration
7477
 */
7478
/* Used for Diameter */
7479
static int
7480
dissect_gtp_mbms_ses_dur(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
7481
0
{
7482
7483
0
    int offset = 0;
7484
7485
0
    proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
7486
0
    proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s,    tvb, offset, 3, ENC_BIG_ENDIAN);
7487
7488
0
    return 3;
7489
7490
0
}
7491
7492
static int
7493
decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7494
9
{
7495
7496
9
    uint16_t    length;
7497
9
    proto_tree *ext_tree;
7498
7499
9
    length = tvb_get_ntohs(tvb, offset + 1);
7500
9
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_DUR], NULL,
7501
9
                val_to_str_ext_const(GTP_EXT_MBMS_SES_DUR, &gtp_val_ext, "Unknown"));
7502
7503
9
    offset++;
7504
9
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7505
9
    offset = offset + 2;
7506
    /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
7507
     * The MBMS Session Duration information element indicates the estimated
7508
     * session duration of the MBMS service data transmission if available.
7509
     * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
7510
     * in 3GPP TS 29.061 [27], excluding the AVP Header fields
7511
     * (as defined in IETF RFC 3588 [36], section 4.1).
7512
     */
7513
    /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
7514
     * with a length of three octets and indicates the estimated session duration
7515
     * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
7516
     * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
7517
     * for which the maximum allowed value is 18 days. For the whole session duration the seconds
7518
     * and days are added together and the maximum session duration is 19 days.
7519
     */
7520
9
    proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
7521
9
    proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, ENC_BIG_ENDIAN);
7522
7523
9
    return 3 + length;
7524
7525
9
}
7526
7527
/* GPRS:        ?
7528
 * UMTS:        3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
7529
 * MBMS Service Area
7530
 */
7531
static int
7532
14
dissect_gtp_3gpp_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) {
7533
7534
14
    int    offset = 0;
7535
14
    uint8_t no_of_mbms_sa_codes;
7536
14
    int    i;
7537
7538
    /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
7539
     * The MBMS Service Area information element indicates the area over
7540
     * which the Multimedia Broadcast/Multicast Service is to be distributed.
7541
     * The payload shall be encoded as per the MBMS-Service-Area AVP defined
7542
     * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
7543
     * IETF RFC 3588 [36], section 4.1).
7544
     */
7545
    /* Number N of MBMS service area codes coded as:
7546
     * 1 binary value is '00000000'
7547
     * ... ...
7548
     * 256 binary value is '11111111'
7549
     */
7550
14
    no_of_mbms_sa_codes = tvb_get_uint8(tvb, offset) + 1;
7551
14
    proto_tree_add_uint(tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
7552
14
    offset++;
7553
    /* A consecutive list of N MBMS service area codes
7554
     * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
7555
     * The length of an MBMS service area code is 2 octets.
7556
     */
7557
434
    for (i = 0; i < no_of_mbms_sa_codes; i++) {
7558
420
        proto_tree_add_item(tree, hf_gtp_mbms_sa_code, tvb, offset, 2, ENC_BIG_ENDIAN);
7559
420
        offset = offset + 2;
7560
420
    }
7561
7562
14
    return offset;
7563
14
}
7564
7565
static int
7566
decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7567
14
{
7568
7569
14
    tvbuff_t   *next_tvb;
7570
14
    uint16_t    length;
7571
14
    proto_tree *ext_tree;
7572
7573
14
    length = tvb_get_ntohs(tvb, offset + 1);
7574
14
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SA], NULL,
7575
14
                val_to_str_ext_const(GTP_EXT_MBMS_SA, &gtp_val_ext, "Unknown"));
7576
7577
14
    offset++;
7578
14
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7579
14
    offset = offset + 2;
7580
14
    next_tvb = tvb_new_subset_length(tvb, offset, length-3);
7581
14
    dissect_gtp_3gpp_mbms_service_area(next_tvb, pinfo, ext_tree, NULL);
7582
7583
14
    return 3 + length;
7584
7585
14
}
7586
7587
/* GPRS:        ?
7588
 * UMTS:        29.060 v6.11.0, chapter 7.7.61
7589
 * Source RNC PDCP context info
7590
 */
7591
static int
7592
decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7593
2.09k
{
7594
7595
2.09k
    uint16_t    length;
7596
2.09k
    proto_tree *ext_tree, *sub_tree;
7597
7598
2.09k
    length = tvb_get_ntohs(tvb, offset + 1);
7599
2.09k
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SRC_RNC_PDP_CTX_INF], NULL,
7600
2.09k
                    val_to_str_ext_const(GTP_EXT_SRC_RNC_PDP_CTX_INF, &gtp_val_ext, "Unknown"));
7601
7602
2.09k
    offset++;
7603
2.09k
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7604
2.09k
    offset = offset + 2;
7605
7606
2.09k
    sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_rrc_cont, NULL, "Source RNC to Target RNC Transparent Container");
7607
2.09k
    dissect_rrc_ToTargetRNC_Container_PDU(tvb, pinfo, sub_tree, NULL);
7608
7609
2.09k
    return 3 + length;
7610
2.09k
}
7611
7612
/* GPRS:        ?
7613
 * UMTS:        29.060 v6.11.0, chapter 7.7.62
7614
 * Additional Trace Info
7615
 */
7616
7617
static const value_string gtp_trace_depth_vals[] = {
7618
  { 0, "minimum" },
7619
  { 1, "medium" },
7620
  { 2, "maximum" },
7621
  { 3, "minimumWithoutVendorSpecificExtension" },
7622
  { 4, "mediumWithoutVendorSpecificExtension" },
7623
  { 5, "maximumWithoutVendorSpecificExtension" },
7624
  { 0, NULL }
7625
};
7626
7627
static const value_string gtp_trace_activity_control_vals[] = {
7628
  { 0, "Trace Deactivation"},
7629
  { 1, "Trace Activation"},
7630
  { 0, NULL}
7631
};
7632
7633
static int
7634
decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7635
1
{
7636
7637
1
    uint16_t    length;
7638
1
    proto_tree *ext_tree;
7639
7640
1
    static int * const trigger_flags[] = {
7641
1
        &hf_gtp_trace_triggers_ggsn_mbms,
7642
1
        &hf_gtp_trace_triggers_ggsn_pdp,
7643
1
        NULL
7644
1
    };
7645
7646
1
    static int * const loi_flags[] = {
7647
1
        &hf_gtp_trace_loi_ggsn_gmb,
7648
1
        &hf_gtp_trace_loi_ggsn_gi,
7649
1
        &hf_gtp_trace_loi_ggsn_gn,
7650
1
        NULL
7651
1
    };
7652
7653
1
    length = tvb_get_ntohs(tvb, offset + 1);
7654
1
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_TRS_INF], NULL,
7655
1
                    val_to_str_ext_const(GTP_EXT_ADD_TRS_INF, &gtp_val_ext, "Unknown"));
7656
7657
1
    offset++;
7658
1
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7659
1
    offset = offset + 2;
7660
1
    proto_tree_add_item(ext_tree, hf_gtp_trace_ref2, tvb, offset, 3, ENC_BIG_ENDIAN);
7661
1
    offset += 3;
7662
1
    proto_tree_add_item(ext_tree, hf_gtp_trace_rec_session_ref, tvb, offset, 2, ENC_BIG_ENDIAN);
7663
1
    offset += 2;
7664
1
    proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_triggers_ggsn, ett_gtp_trace_triggers_ggsn, trigger_flags, ENC_BIG_ENDIAN);
7665
1
    offset++;
7666
1
    proto_tree_add_item(ext_tree, hf_gtp_trace_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
7667
1
    offset++;
7668
1
    proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_loi_ggsn, ett_gtp_trace_loi_ggsn, loi_flags, ENC_BIG_ENDIAN);
7669
1
    offset++;
7670
1
    proto_tree_add_item(ext_tree, hf_gtp_trace_activity_control, tvb, offset, 1, ENC_BIG_ENDIAN);
7671
7672
1
    return 3 + length;
7673
7674
1
}
7675
7676
/* GPRS:        ?
7677
 * UMTS:        29.060 v6.11.0, chapter 7.7.63
7678
 * Hop Counter
7679
 */
7680
static int
7681
decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7682
8
{
7683
7684
8
    uint16_t    length;
7685
8
    proto_tree *ext_tree;
7686
7687
8
    length = tvb_get_ntohs(tvb, offset + 1);
7688
8
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_HOP_COUNT], NULL,
7689
8
                val_to_str_ext_const(GTP_EXT_HOP_COUNT, &gtp_val_ext, "Unknown"));
7690
7691
8
    offset++;
7692
8
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7693
8
    offset = offset + 2;
7694
8
    proto_tree_add_item(ext_tree, hf_gtp_hop_count, tvb, offset, 1, ENC_NA);
7695
7696
8
    return 3 + length;
7697
7698
8
}
7699
7700
/* GPRS:        ?
7701
 * UMTS:        29.060 v6.11.0, chapter 7.7.64
7702
 * Selected PLMN ID
7703
 */
7704
static int
7705
decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7706
6
{
7707
7708
6
    uint16_t    length;
7709
6
    proto_tree *ext_tree;
7710
7711
6
    length = tvb_get_ntohs(tvb, offset + 1);
7712
6
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID], NULL,
7713
6
                                val_to_str_ext_const(GTP_EXT_SEL_PLMN_ID, &gtp_val_ext, "Unknown"));
7714
7715
6
    offset++;
7716
6
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7717
6
    offset = offset + 2;
7718
7719
6
    dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, false);
7720
6
    return 3 + length;
7721
7722
6
}
7723
7724
/* GPRS:        ?
7725
 * UMTS:        29.060 v6.11.0, chapter 7.7.65
7726
 * MBMS Session Identifier
7727
 */
7728
static int
7729
decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7730
9
{
7731
7732
9
    uint16_t    length;
7733
9
    proto_tree *ext_tree;
7734
7735
9
    length = tvb_get_ntohs(tvb, offset + 1);
7736
9
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID], NULL, val_to_str_ext_const(GTP_EXT_MBMS_SES_ID, &gtp_val_ext, "Unknown"));
7737
7738
9
    offset++;
7739
9
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7740
9
    offset = offset + 2;
7741
    /* TODO add decoding of data */
7742
9
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7743
7744
9
    return 3 + length;
7745
7746
9
}
7747
7748
/* GPRS:        ?
7749
 * UMTS:        29.060 v6.11.0, chapter 7.7.66
7750
 * MBMS 2G/3G Indicator
7751
 */
7752
static const value_string gtp_mbs_2g_3g_ind_vals[] = {
7753
    {0, "2G only"},
7754
    {1, "3G only"},
7755
    {2, "Both 2G and 3G"},
7756
    {0, NULL}
7757
};
7758
7759
static int
7760
decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7761
3
{
7762
7763
3
    uint16_t    length;
7764
3
    proto_tree *ext_tree;
7765
7766
3
    length = tvb_get_ntohs(tvb, offset + 1);
7767
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_2G_3G_IND], NULL,
7768
3
                val_to_str_ext_const(GTP_EXT_MBMS_2G_3G_IND, &gtp_val_ext, "Unknown"));
7769
7770
3
    offset++;
7771
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7772
3
    offset = offset + 2;
7773
    /* MBMS 2G/3G Indicator */
7774
3
    proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
7775
7776
3
    return 3 + length;
7777
7778
3
}
7779
7780
/* GPRS:        ?
7781
 * UMTS:        29.060 v6.11.0, chapter 7.7.67
7782
 * Enhanced NSAPI
7783
 */
7784
static int
7785
decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7786
2
{
7787
7788
2
    uint16_t    length;
7789
2
    proto_tree *ext_tree;
7790
2
    uint8_t     enh_nsapi;
7791
7792
2
    length = tvb_get_ntohs(tvb, offset + 1);
7793
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ENH_NSAPI], NULL, val_to_str_ext_const(GTP_EXT_ENH_NSAPI, &gtpv1_val_ext, "Unknown"));
7794
7795
2
    offset++;
7796
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7797
2
    offset = offset + 2;
7798
2
    enh_nsapi = tvb_get_uint8(tvb, offset);
7799
2
    if (enh_nsapi < 128) {
7800
1
        proto_tree_add_uint_format_value(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, enh_nsapi, "Reserved");
7801
1
    } else {
7802
1
        proto_tree_add_item(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7803
1
    }
7804
7805
2
    return 3 + length;
7806
7807
2
}
7808
7809
/* GPRS:        ?
7810
 * UMTS:        29.060 v6.11.0, chapter 7.7.68
7811
 * Additional MBMS Trace Info
7812
 */
7813
static int
7814
decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7815
49
{
7816
7817
49
    uint16_t    length;
7818
49
    proto_tree *ext_tree;
7819
7820
49
    static int * const trigger_flags[] = {
7821
49
        &hf_gtp_trace_triggers_bm_sc_mbms,
7822
49
        NULL
7823
49
    };
7824
7825
49
    static int * const loi_flags[] = {
7826
49
        &hf_gtp_trace_loi_bm_sc_gmb,
7827
49
        NULL
7828
49
    };
7829
7830
49
    length = tvb_get_ntohs(tvb, offset + 1);
7831
49
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_MBMS_TRS_INF], NULL,
7832
49
                            val_to_str_ext_const(GTP_EXT_ADD_MBMS_TRS_INF, &gtpv1_val_ext, "Unknown"));
7833
7834
49
    offset++;
7835
49
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7836
49
    offset = offset + 2;
7837
    /* XXX: There is clearly an error in TS 29.060 V17.1.0 and earlier.
7838
     * In Figure 7.7.68.1 the octet column has a gap and is not aligned,
7839
     * octets 7-8 should be for the Trace Recording Session Reference, other
7840
     * values should be moved up a row, and there should be a value for
7841
     * the Trace Activity Control as octet 12, making the IE length 9,
7842
     * as with 7.7.62 Additional Trace Info.
7843
     * Unfortunately the mistake is carried over into the the length field
7844
     * elsewhere in the spec, such as in Table 37.
7845
     */
7846
49
    proto_tree_add_item(ext_tree, hf_gtp_trace_ref2, tvb, offset, 3, ENC_BIG_ENDIAN);
7847
49
    offset += 3;
7848
49
    proto_tree_add_item(ext_tree, hf_gtp_trace_rec_session_ref, tvb, offset, 2, ENC_BIG_ENDIAN);
7849
49
    offset += 2;
7850
49
    proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_triggers_bm_sc, ett_gtp_trace_triggers_bm_sc, trigger_flags, ENC_BIG_ENDIAN);
7851
49
    offset++;
7852
49
    proto_tree_add_item(ext_tree, hf_gtp_trace_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
7853
49
    offset++;
7854
49
    proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_loi_bm_sc, ett_gtp_trace_loi_bm_sc, loi_flags, ENC_BIG_ENDIAN);
7855
49
    if(length > 8){
7856
12
        offset++;
7857
12
        proto_tree_add_item(ext_tree, hf_gtp_trace_activity_control, tvb, offset, 1, ENC_BIG_ENDIAN);
7858
12
    }
7859
7860
49
    return 3 + length;
7861
7862
49
}
7863
7864
/* GPRS:        ?
7865
 * UMTS:        29.060 v6.11.0, chapter 7.7.69
7866
 * MBMS Session Identity Repetition Number
7867
 */
7868
static int
7869
decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7870
6
{
7871
7872
6
    uint16_t    length;
7873
6
    proto_tree *ext_tree;
7874
7875
6
    length = tvb_get_ntohs(tvb, offset + 1);
7876
6
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID_REP_NO], NULL,
7877
6
                                        val_to_str_ext_const(GTP_EXT_MBMS_SES_ID_REP_NO, &gtpv1_val_ext, "Unknown"));
7878
7879
6
    offset++;
7880
6
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7881
6
    offset = offset + 2;
7882
    /* TODO add decoding of data */
7883
6
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7884
7885
6
    return 3 + length;
7886
7887
6
}
7888
7889
/* GPRS:        ?
7890
 * UMTS:        3GPP TS 29.060 version 7.8.0 Release 7
7891
 * MBMS Time To Data Transfer
7892
 */
7893
/* Used for Diameter */
7894
static int
7895
dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
7896
0
{
7897
7898
0
    int    offset = 0;
7899
0
    uint8_t time_2_dta_tr;
7900
7901
0
    time_2_dta_tr = tvb_get_uint8(tvb, offset) + 1;
7902
0
    proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
7903
7904
0
    return 3;
7905
7906
0
}
7907
7908
static int
7909
decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7910
4
{
7911
7912
4
    uint16_t    length;
7913
4
    proto_tree *ext_tree;
7914
4
    uint8_t     time_2_dta_tr;
7915
7916
4
    length = tvb_get_ntohs(tvb, offset + 1);
7917
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_TIME_TO_DATA_TR], NULL,
7918
4
                        val_to_str_ext_const(GTP_EXT_MBMS_TIME_TO_DATA_TR, &gtpv1_val_ext, "Unknown"));
7919
7920
4
    offset++;
7921
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7922
4
    offset = offset + 2;
7923
    /* TODO add decoding of data
7924
     * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
7925
     * The MBMS Time To Data Transfer information element contains a
7926
     * MBMS Time To Data Transfer allocated by the BM-SC.
7927
     * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
7928
     * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
7929
     * (as defined in IETF RFC 3588 [36], section 4.1).
7930
     */
7931
    /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
7932
     * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
7933
     * Bits
7934
     * 8 7 6 5 4 3 2 1
7935
     * 0 0 0 0 0 0 0 0 1s
7936
     * 0 0 0 0 0 0 0 1 2s
7937
     * 0 0 0 0 0 0 1 0 3s
7938
     * :
7939
     * 1 1 1 1 1 1 1 1 256s
7940
     */
7941
4
    time_2_dta_tr = tvb_get_uint8(tvb, offset) + 1;
7942
4
    proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
7943
7944
4
    return 3 + length;
7945
7946
4
}
7947
7948
/* GPRS:        ?
7949
 * UMTS:        29.060 v6.11.0, chapter 7.7.71
7950
 * PS Handover Request Context
7951
 */
7952
static int
7953
decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7954
1
{
7955
7956
1
    uint16_t    length;
7957
1
    proto_tree *ext_tree;
7958
7959
1
    length = tvb_get_ntohs(tvb, offset + 1);
7960
1
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PS_HO_REQ_CTX], NULL,
7961
1
                val_to_str_ext_const(GTP_EXT_PS_HO_REQ_CTX, &gtpv1_val_ext, "Unknown"));
7962
7963
1
    offset++;
7964
1
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7965
1
    offset = offset + 2;
7966
    /* TODO add decoding of data */
7967
1
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7968
7969
1
    return 3 + length;
7970
7971
1
}
7972
7973
/* GPRS:        ?
7974
 * UMTS:        29.060 v6.11.0, chapter 7.7.72
7975
 * BSS Container
7976
 */
7977
static int
7978
decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7979
3
{
7980
7981
3
    uint16_t    length;
7982
3
    proto_tree *ext_tree, *sub_tree;
7983
7984
3
    length = tvb_get_ntohs(tvb, offset + 1);
7985
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BSS_CONT], NULL,
7986
3
                    val_to_str_ext_const(GTP_EXT_BSS_CONT, &gtpv1_val_ext, "Unknown"));
7987
7988
3
    offset++;
7989
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7990
3
    offset = offset + 2;
7991
7992
3
    switch (pinfo->link_dir) {
7993
1
    case P2P_DIR_UL:
7994
1
        sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_bss_cont, NULL, "Source BSS to Target BSS Transparent Container");
7995
1
        de_bssgp_source_BSS_to_target_BSS_transp_cont(tvb, sub_tree, pinfo, offset, length, NULL, 0);
7996
1
        break;
7997
0
    case P2P_DIR_DL:
7998
0
        sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_bss_cont, NULL, "Target BSS to Source BSS Transparent Container");
7999
0
        de_bssgp_target_BSS_to_source_BSS_transp_cont(tvb, sub_tree, pinfo, offset, length, NULL, 0);
8000
0
        break;
8001
2
    default:
8002
2
        break;
8003
3
    }
8004
    /*
8005
     * The content of this container is defined in 3GPP TS 48.018
8006
     */
8007
8008
3
    return 3 + length;
8009
8010
3
}
8011
8012
/* GPRS:        ?
8013
 * UMTS:        29.060 v6.11.0, chapter 7.7.73
8014
 * Cell Identification
8015
 */
8016
static const value_string gtp_source_type_vals[] = {
8017
    { 0, "Source Cell ID"},
8018
    { 1, "Source RNC-ID" },
8019
    { 0, NULL            }
8020
};
8021
8022
static int
8023
decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8024
6
{
8025
8026
6
    uint16_t    length;
8027
6
    uint32_t    source_type;
8028
6
    proto_tree *ext_tree;
8029
8030
6
    length = tvb_get_ntohs(tvb, offset + 1);
8031
6
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CELL_ID], NULL,
8032
6
                                val_to_str_ext_const(GTP_EXT_CELL_ID, &gtpv1_val_ext, "Unknown"));
8033
8034
6
    offset++;
8035
6
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8036
6
    offset = offset + 2;
8037
8038
    /*
8039
     * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
8040
     * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
8041
     *
8042
     * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
8043
     * source RNC (RNC-ID) as defined in 3GPP TS 48.018
8044
     *
8045
     * for PS handover from S1 mode, the identification of a target cell (Target Cell ID) as defined in 3GPP TS 48.018.
8046
     * Octet 12 shall be set to "Source Cell ID" and octets 13-20 shall be encoded as all zero.
8047
     *
8048
     * 3GPP TS 48.018 defines Target and Source Cell ID to use the Cell
8049
     * Identifier IE, encoded as 6 octets of the value part of the RAI IE
8050
     * followed by 2 octets of the value of the Cell Identity IE, both defined
8051
     * in 3GPP TS 24.008. The 3GPP TS 48.018 RNC-ID IE is similar, with the 6
8052
     * octet RAI as in 3GPP TS 24.008 followed by two octets of the RNC-ID.
8053
     * (Or Extended RNC-ID, but the RNC-ID is presented in network byte order
8054
     * with the most significant bits of octet 9 set to "0000", so there is
8055
     * no need to distinguish be RNC-ID and Extended RNC-ID.)
8056
     */
8057
6
    dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8058
6
    offset += 3;
8059
6
    proto_tree_add_item(ext_tree, hf_gtp_target_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8060
6
    offset += 2;
8061
6
    proto_tree_add_item(ext_tree, hf_gtp_target_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8062
6
    offset += 1;
8063
6
    proto_tree_add_item(ext_tree, hf_gtp_target_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
8064
6
    offset += 2;
8065
6
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_source_type, tvb, offset, 1, ENC_NA, &source_type);
8066
6
    offset++;
8067
6
    switch (source_type) {
8068
3
    case 0:
8069
3
        dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8070
3
        offset += 3;
8071
3
        proto_tree_add_item(ext_tree, hf_gtp_source_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8072
3
        offset += 2;
8073
3
        proto_tree_add_item(ext_tree, hf_gtp_source_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8074
3
        offset += 1;
8075
3
        proto_tree_add_item(ext_tree, hf_gtp_source_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
8076
3
        break;
8077
0
    case 1:
8078
0
        dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8079
0
        offset += 3;
8080
0
        proto_tree_add_item(ext_tree, hf_gtp_source_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8081
0
        offset += 2;
8082
0
        proto_tree_add_item(ext_tree, hf_gtp_source_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8083
0
        offset += 1;
8084
0
        proto_tree_add_item(ext_tree, hf_gtp_source_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
8085
0
        break;
8086
3
    default:
8087
3
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_source_type_unknown, tvb, offset-1, 1);
8088
3
        break;
8089
6
    }
8090
8091
6
    return 3 + length;
8092
8093
6
}
8094
8095
/* GPRS:        ?
8096
 * UMTS:        29.060 v6.11.0, chapter 7.7.74
8097
 * PDU Numbers
8098
 */
8099
static int
8100
decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8101
4
{
8102
8103
4
    uint16_t    length;
8104
4
    proto_tree *ext_tree;
8105
8106
4
    length = tvb_get_ntohs(tvb, offset + 1);
8107
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PDU_NO], NULL,
8108
4
                                            val_to_str_ext_const(GTP_EXT_PDU_NO, &gtpv1_val_ext, "Unknown"));
8109
8110
4
    offset++;
8111
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8112
4
    offset = offset + 2;
8113
8114
4
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8115
4
    offset++;
8116
8117
4
    proto_tree_add_item(ext_tree, hf_gtp_sequence_number_down, tvb, offset, 2, ENC_BIG_ENDIAN);
8118
4
    offset += 2;
8119
4
    proto_tree_add_item(ext_tree, hf_gtp_sequence_number_up, tvb, offset, 2, ENC_BIG_ENDIAN);
8120
4
    offset += 2;
8121
    /* The Send N-PDU Number is used only when acknowledged peer-to-peer LLC
8122
     * operation is used for the PDP context.  Send N-PDU Number is the N-PDU
8123
     * number to be assigned by SNDCP to the next down link N-PDU received from
8124
     * the GGSN.
8125
     *
8126
     * The Receive N-PDU Number is used only when acknowledged peer-to-peer LLC
8127
     * operation is used for the PDP context.  The Receive N-PDU Number is the
8128
     * N-PDU number expected by SNDCP from the next up link N-PDU to be
8129
     * received from the MS.
8130
     *
8131
     * XXX: For some reason, 2 octets are reserved for each the Send and
8132
     * Receive N-PDU numbers, even though an N-PDU number in acknowledged
8133
     * mode only has values 0-255 (see 3GPP TS 44.065) and is in a one
8134
     * octet field in the PDP Context IE (7.7.29). Assume, in the lack
8135
     * of other guidance, that the first octet will be zero and the value
8136
     * will be in the second octet.
8137
     * Cf. 7.7.51 ULI, where there is an explicit note in TS 29.060 that only
8138
     * the first octet contains the RAC and the second octet is filler.
8139
     */
8140
4
    proto_tree_add_item(ext_tree, hf_gtp_send_n_pdu_number, tvb, offset, 2, ENC_BIG_ENDIAN);
8141
4
    offset += 2;
8142
4
    proto_tree_add_item(ext_tree, hf_gtp_receive_n_pdu_number, tvb, offset, 2, ENC_BIG_ENDIAN);
8143
8144
4
    return 3 + length;
8145
8146
4
}
8147
8148
/* GPRS:        ?
8149
 * UMTS:        29.060 v6.11.0, chapter 7.7.75
8150
 * BSSGP Cause
8151
 */
8152
static int
8153
decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8154
3
{
8155
8156
3
    uint16_t    length;
8157
3
    proto_tree *ext_tree;
8158
8159
3
    length = tvb_get_ntohs(tvb, offset + 1);
8160
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BSSGP_CAUSE], NULL,
8161
3
                                        val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, &gtpv1_val_ext, "Unknown"));
8162
8163
3
    offset++;
8164
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8165
3
    offset = offset + 2;
8166
8167
    /*
8168
     * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
8169
     */
8170
3
    proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
8171
8172
3
    return 3 + length;
8173
8174
3
}
8175
8176
/*
8177
 * Required MBMS bearer capabilities    7.7.76
8178
 */
8179
static int
8180
decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8181
3
{
8182
3
    uint16_t    length;
8183
3
    proto_tree *ext_tree;
8184
8185
3
    length = tvb_get_ntohs(tvb, offset + 1);
8186
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_REQ_MBMS_BEARER_CAP], NULL,
8187
3
                                    val_to_str_ext_const(GTP_EXT_REQ_MBMS_BEARER_CAP, &gtpv1_val_ext, "Unknown"));
8188
8189
3
    offset++;
8190
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8191
#if 0 /* Fix Dead Store Warning */
8192
    offset = offset + 2;
8193
#endif
8194
    /* The payload shall be encoded as per the
8195
     * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
8196
     * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
8197
     */
8198
    /* TODO Add decoding (call Diameter dissector???) */
8199
3
        return 3 + length;
8200
3
}
8201
8202
/*
8203
 * RIM Routing Address Discriminator    7.7.77
8204
 */
8205
8206
static const value_string gtp_bssgp_ra_discriminator_vals[] = {
8207
    { 0, "A Cell Identifier is used to identify a GERAN cell" },
8208
    { 1, "A Global RNC-ID is used to identify a UTRAN RNC" },
8209
    { 2, "An eNB identifier is used to identify an E-UTRAN eNodeB or HeNB" },
8210
    { 0, NULL }
8211
};
8212
8213
static int
8214
decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8215
3
{
8216
8217
3
    uint16_t    length;
8218
3
    proto_tree *ext_tree;
8219
3
    uint32_t val;
8220
3
    gtp_private_data_t *gtp_data = gtp_get_private_data(pinfo);
8221
8222
3
    length = tvb_get_ntohs(tvb, offset + 1);
8223
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RIM_ROUTING_ADDR_DISC], NULL,
8224
3
                                val_to_str_ext_const(GTP_EXT_RIM_ROUTING_ADDR_DISC, &gtpv1_val_ext, "Unknown"));
8225
8226
3
    offset++;
8227
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8228
3
    offset = offset + 2;
8229
    /* Octet 4 bits 4 - 1 is coded according to 3GPP TS 48.018 [20]
8230
     * RIM Routing Information IE octet 3 bits 4 - 1.
8231
     * Bits 8 - 5 are coded "0000".
8232
     */
8233
3
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_bssgp_ra_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN, &val);
8234
3
    gtp_data->rim_routing_addr_disc = (int8_t)val;
8235
8236
3
    return 3 + length;
8237
8238
3
}
8239
/*
8240
 * List of set-up PFCs  7.7.78
8241
 */
8242
static int
8243
decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8244
3
{
8245
8246
3
    uint16_t    length;
8247
3
    proto_tree *ext_tree, *sub_tree;
8248
8249
3
    length = tvb_get_ntohs(tvb, offset + 1);
8250
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_LIST_OF_SETUP_PFCS], NULL,
8251
3
                                        val_to_str_ext_const(GTP_EXT_LIST_OF_SETUP_PFCS, &gtpv1_val_ext, "Unknown"));
8252
8253
3
    offset++;
8254
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8255
3
    offset = offset + 2;
8256
8257
3
    sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_lst_set_up_pfc, NULL, "List of set-up PFCs");
8258
3
    de_bssgp_list_of_setup_pfcs(tvb, sub_tree, pinfo, offset, length, NULL, 0);
8259
8260
3
    return 3 + length;
8261
8262
3
}
8263
/*
8264
 * PS Handover XID Parameters   7.7.79
8265
 */
8266
static int
8267
decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8268
50
{
8269
8270
50
    uint16_t    length;
8271
50
    proto_tree *ext_tree;
8272
50
    tvbuff_t   *next_tvb;
8273
50
    uint8_t     sapi;
8274
50
    uint8_t     xid_par_len;
8275
8276
50
    length = tvb_get_ntohs(tvb, offset + 1);
8277
50
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PS_HANDOVER_XIP_PAR], NULL,
8278
50
                                        val_to_str_ext_const(GTP_EXT_PS_HANDOVER_XIP_PAR, &gtpv1_val_ext, "Unknown"));
8279
8280
50
    offset++;
8281
50
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8282
50
    offset = offset + 2;
8283
8284
50
    sapi = tvb_get_uint8(tvb, offset) & 0x0F;
8285
50
    proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
8286
50
    offset++;
8287
8288
50
    xid_par_len = tvb_get_uint8(tvb, offset);
8289
50
    proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
8290
50
    offset++;
8291
8292
50
    next_tvb = tvb_new_subset_remaining(tvb, offset);
8293
50
    if (sndcpxid_handle)
8294
50
        call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
8295
0
    else
8296
0
        call_data_dissector(next_tvb, pinfo, tree);
8297
8298
50
    return 4 + length;
8299
8300
50
}
8301
8302
/*
8303
 * MS Info Change Reporting Action      7.7.80
8304
 */
8305
static int
8306
decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8307
4
{
8308
8309
4
    uint16_t    length;
8310
4
    proto_tree *ext_tree;
8311
8312
4
    length = tvb_get_ntohs(tvb, offset + 1);
8313
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MS_INF_CHG_REP_ACT], NULL,
8314
4
                                        val_to_str_ext_const(GTP_EXT_MS_INF_CHG_REP_ACT, &gtpv1_val_ext, "Unknown"));
8315
8316
4
    offset++;
8317
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8318
4
    offset = offset + 2;
8319
8320
4
    proto_tree_add_item(ext_tree, hf_gtp_rep_act_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8321
8322
4
    return 3 + length;
8323
8324
4
}
8325
/*
8326
 * Direct Tunnel Flags  7.7.81
8327
 */
8328
static int
8329
decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8330
4
{
8331
8332
4
    uint16_t    length;
8333
4
    proto_tree *ext_tree;
8334
8335
4
    length = tvb_get_ntohs(tvb, offset + 1);
8336
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_DIRECT_TUNNEL_FLGS], NULL,
8337
4
                                        val_to_str_ext_const(GTP_EXT_DIRECT_TUNNEL_FLGS, &gtpv1_val_ext, "Unknown"));
8338
8339
4
    offset++;
8340
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8341
4
    offset += 2;
8342
8343
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_ei,   tvb, offset, 1, ENC_BIG_ENDIAN);
8344
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8345
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_dti,  tvb, offset, 1, ENC_BIG_ENDIAN);
8346
4
    offset++;
8347
8348
4
    if (length == 1) {
8349
0
        return 3 + length;
8350
0
    }
8351
4
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8352
8353
4
    return 3 + length;
8354
8355
4
}
8356
/*
8357
 * Correlation-ID       7.7.82
8358
 */
8359
static int
8360
decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8361
5
{
8362
8363
5
    uint16_t    length;
8364
5
    proto_tree *ext_tree;
8365
8366
5
    length = tvb_get_ntohs(tvb, offset + 1);
8367
5
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CORRELATION_ID], NULL,
8368
5
                    val_to_str_ext_const(GTP_EXT_CORRELATION_ID, &gtpv1_val_ext, "Unknown"));
8369
8370
5
    offset++;
8371
5
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8372
5
    offset = offset + 2;
8373
8374
5
    proto_tree_add_item(ext_tree, hf_gtp_correlation_id,  tvb, offset, 1, ENC_BIG_ENDIAN);
8375
8376
5
    return 3 + length;
8377
8378
5
}
8379
/*
8380
 * Bearer Control Mode  7.7.83
8381
 * version 10.0.0
8382
 */
8383
static const value_string gtp_pdp_bcm_type_vals[] = {
8384
    {0, "MS_only"},
8385
    {1, "MS/NW"},
8386
    {0, NULL}
8387
};
8388
8389
static int
8390
decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8391
1
{
8392
8393
1
    uint16_t    length;
8394
1
    proto_tree *ext_tree;
8395
8396
1
    length = tvb_get_ntohs(tvb, offset + 1);
8397
1
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length,  ett_gtp_ies[GTP_EXT_BEARER_CONTROL_MODE], NULL,
8398
1
                                        val_to_str_ext_const(GTP_EXT_BEARER_CONTROL_MODE, &gtpv1_val_ext, "Unknown"));
8399
8400
1
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8401
8402
1
    offset++;
8403
1
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8404
1
    offset = offset + 2;
8405
8406
1
    proto_tree_add_item(ext_tree, hf_gtp_bcm, tvb, offset, 1, ENC_BIG_ENDIAN);
8407
8408
1
    return 3 + length;
8409
8410
1
}
8411
8412
/*
8413
 * 7.7.84 MBMS Flow Identifier
8414
 */
8415
static int
8416
decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8417
1
{
8418
1
    uint16_t    length;
8419
1
    proto_tree *ext_tree;
8420
8421
1
    length = tvb_get_ntohs(tvb, offset + 1);
8422
1
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_FLOW_ID], NULL,
8423
1
                                        val_to_str_ext_const(GTP_EXT_MBMS_FLOW_ID, &gtpv1_val_ext, "Unknown"));
8424
1
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8425
8426
1
    offset++;
8427
1
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8428
1
    offset = offset + 2;
8429
8430
    /* 4-n MBMS Flow Identifier */
8431
1
    proto_tree_add_item(ext_tree, hf_gtp_mbms_flow_id, tvb, offset, length, ENC_NA);
8432
8433
8434
1
    return 3 + length;
8435
1
}
8436
8437
/*
8438
 * 7.7.85 MBMS IP Multicast Distribution
8439
 */
8440
8441
static int
8442
decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8443
2
{
8444
2
    uint16_t    length;
8445
2
    proto_tree *ext_tree;
8446
8447
2
    length = tvb_get_ntohs(tvb, offset + 1);
8448
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_IP_MCAST_DIST], NULL,
8449
2
                                    val_to_str_ext_const(GTP_EXT_MBMS_IP_MCAST_DIST, &gtpv1_val_ext, "Unknown"));
8450
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8451
8452
2
    offset++;
8453
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8454
2
    offset = offset + 2;
8455
8456
2
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8457
8458
2
    return 3 + length;
8459
2
}
8460
8461
/*
8462
 * 7.7.86 MBMS Distribution Acknowledgement
8463
 */
8464
/* Table 7.7.86.1: Distribution Indication values */
8465
static const value_string gtp_mbms_dist_indic_vals[] = {
8466
    {0, "No RNCs have accepted IP multicast distribution"},
8467
    {1, "All RNCs have accepted IP multicast distribution"},
8468
    {2, "Some RNCs have accepted IP multicast distribution"},
8469
    {3, "Spare. For future use."},
8470
    {0, NULL}
8471
};
8472
static int
8473
decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8474
3
{
8475
3
    uint16_t    length;
8476
3
    proto_tree *ext_tree;
8477
8478
3
    length = tvb_get_ntohs(tvb, offset + 1);
8479
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_DIST_ACK], NULL,
8480
3
                                    val_to_str_ext_const(GTP_EXT_MBMS_DIST_ACK, &gtpv1_val_ext, "Unknown"));
8481
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8482
8483
3
    offset++;
8484
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8485
3
    offset = offset + 2;
8486
8487
    /* Distribution Indication values */
8488
3
    proto_tree_add_item(ext_tree, hf_gtp_mbms_dist_indic, tvb, offset, 1, ENC_BIG_ENDIAN);
8489
8490
3
    return 3 + length;
8491
3
}
8492
8493
/*
8494
 * 7.7.87 Reliable INTER RAT HANDOVER INFO
8495
 */
8496
static int
8497
decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8498
2
{
8499
2
    uint16_t    length;
8500
2
    proto_tree *ext_tree;
8501
8502
2
    length = tvb_get_ntohs(tvb, offset + 1);
8503
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF], NULL,
8504
2
                                        val_to_str_ext_const(GTP_EXT_RELIABLE_IRAT_HO_INF, &gtpv1_val_ext, "Unknown"));
8505
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8506
8507
2
    offset++;
8508
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8509
2
    offset = offset + 2;
8510
8511
2
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8512
8513
2
    return 3 + length;
8514
2
}
8515
8516
/*
8517
 * 7.7.88 RFSP Index
8518
 */
8519
static int
8520
decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8521
3
{
8522
3
    uint16_t    length;
8523
3
    proto_tree *ext_tree;
8524
8525
3
    length = tvb_get_ntohs(tvb, offset + 1);
8526
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RFSP_INDEX], NULL,
8527
3
                                        val_to_str_ext_const(GTP_EXT_RFSP_INDEX, &gtpv1_val_ext, "Unknown"));
8528
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8529
8530
3
    offset++;
8531
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8532
3
    offset = offset + 2;
8533
8534
3
    proto_tree_add_item(ext_tree, hf_gtp_rfsp_index, tvb, offset, 2, ENC_BIG_ENDIAN);
8535
8536
3
    return 3 + length;
8537
3
}
8538
/*
8539
 * 7.7.89 PDP Type
8540
 */
8541
/*
8542
 * 7.7.90 Fully Qualified Domain Name (FQDN)
8543
 */
8544
static int
8545
decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8546
2
{
8547
8548
2
    uint16_t    length;
8549
2
    proto_tree *ext_tree;
8550
8551
2
    length = tvb_get_ntohs(tvb, offset + 1);
8552
8553
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_FQDN], NULL,
8554
2
                                    val_to_str_ext_const(GTP_EXT_FQDN, &gtp_val_ext, "Unknown field"));
8555
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8556
8557
2
    proto_tree_add_item(ext_tree, hf_gtp_fqdn_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
8558
2
    decode_fqdn(tvb, offset + 3, length, ext_tree, NULL);
8559
8560
2
    return 3 + length;
8561
2
}
8562
8563
/*
8564
 * 7.7.91 Evolved Allocation/Retention Priority I
8565
 */
8566
static int
8567
decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8568
3
{
8569
8570
3
    uint16_t    length;
8571
3
    proto_tree *ext_tree;
8572
8573
3
    length = tvb_get_ntohs(tvb, offset + 1);
8574
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P1], NULL,
8575
3
                                        val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P1, &gtpv1_val_ext, "Unknown"));
8576
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id,      tvb, offset, 1, ENC_BIG_ENDIAN);
8577
8578
3
    offset++;
8579
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8580
3
    offset += 2;
8581
8582
3
    proto_tree_add_item(ext_tree, hf_gtp_earp_pci,   tvb, offset, 1, ENC_BIG_ENDIAN);
8583
3
    proto_tree_add_item(ext_tree, hf_gtp_earp_pl,    tvb, offset, 1, ENC_BIG_ENDIAN);
8584
3
    proto_tree_add_item(ext_tree, hf_gtp_earp_pvi,   tvb, offset, 1, ENC_BIG_ENDIAN);
8585
8586
3
    return 3 + length;
8587
8588
8589
3
}
8590
8591
/*
8592
 * 7.7.92 Evolved Allocation/Retention Priority II
8593
 */
8594
static int
8595
decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8596
2
{
8597
8598
2
    uint16_t    length;
8599
2
    proto_tree *ext_tree;
8600
8601
2
    length = tvb_get_ntohs(tvb, offset + 1);
8602
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P2], NULL,
8603
2
                                        val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P2, &gtpv1_val_ext, "Unknown"));
8604
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8605
8606
2
    offset++;
8607
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8608
2
    offset = offset + 2;
8609
8610
2
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8611
2
    offset++;
8612
8613
2
    proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
8614
2
    proto_tree_add_item(ext_tree, hf_gtp_earp_pl,  tvb, offset, 1, ENC_BIG_ENDIAN);
8615
2
    proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
8616
8617
2
    return 3 + length;
8618
8619
8620
2
}
8621
8622
/*
8623
 * 7.7.93 Extended Common Flags
8624
 */
8625
static int
8626
decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8627
3
{
8628
3
    uint16_t    length;
8629
3
    proto_tree *ext_tree;
8630
8631
3
    length = tvb_get_ntohs(tvb, offset + 1);
8632
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXTENDED_COMMON_FLGS], NULL,
8633
3
                                        val_to_str_ext_const(GTP_EXT_EXTENDED_COMMON_FLGS, &gtpv1_val_ext, "Unknown"));
8634
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8635
8636
3
    offset++;
8637
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8638
3
    offset = offset + 2;
8639
8640
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_uasi, tvb, offset, 1, ENC_BIG_ENDIAN);
8641
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_bdwi, tvb, offset, 1, ENC_BIG_ENDIAN);
8642
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_pcri, tvb, offset, 1, ENC_BIG_ENDIAN);
8643
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_vb, tvb, offset, 1, ENC_BIG_ENDIAN);
8644
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_retloc, tvb, offset, 1, ENC_BIG_ENDIAN);
8645
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_cpsr, tvb, offset, 1, ENC_BIG_ENDIAN);
8646
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_ccrsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8647
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_unauthenticated_imsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8648
3
    offset++;
8649
8650
3
    if(length > 1){
8651
3
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length-1);
8652
3
    }
8653
8654
3
    return 3 + length;
8655
3
}
8656
8657
/*
8658
 * 7.7.94 User CSG Information (UCI)
8659
 */
8660
8661
static const value_string gtp_access_mode_vals[] = {
8662
   { 0, "Closed Mode" },
8663
   { 1, "Hybrid Mode" },
8664
   { 2, "Reserved" },
8665
   { 3, "Reserved" },
8666
   { 0, NULL }
8667
};
8668
8669
static int
8670
decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8671
2
{
8672
2
    uint16_t    length;
8673
2
    proto_tree *ext_tree;
8674
8675
2
    length = tvb_get_ntohs(tvb, offset + 1);
8676
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UCI], NULL,
8677
2
                                        val_to_str_ext_const(GTP_EXT_UCI, &gtpv1_val_ext, "Unknown"));
8678
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8679
8680
2
    offset++;
8681
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8682
2
    offset = offset + 2;
8683
8684
2
    dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8685
2
    offset += 3;
8686
2
    proto_tree_add_item(ext_tree, hf_gtp_csg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8687
2
    offset += 4;
8688
8689
2
    proto_tree_add_item(ext_tree, hf_gtp_access_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
8690
    /* Due to a specification oversight, the CMI values ... are reversed from
8691
     * the values of the CSG-Membership-Indication AVP in 3GPP TS 32.299 [56].
8692
     * Therefore, when CMI values are sent over the charging interface, the
8693
     * values are encoded as specified in 3GPP TS 32.299 [56]. Furthermore,
8694
     * the encoding is different between GTPv1 and GTPv2.
8695
     */
8696
2
    proto_tree_add_item(ext_tree, hf_gtp_cmi, tvb, offset, 1, ENC_BIG_ENDIAN);
8697
8698
2
    return 3 + length;
8699
2
}
8700
8701
/*
8702
 * 7.7.95 CSG Information Reporting Action
8703
 */
8704
8705
static int
8706
decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8707
5
{
8708
5
    uint16_t    length;
8709
5
    proto_tree *ext_tree;
8710
8711
5
    static int * const flags[] = {
8712
5
        &hf_gtp_csg_inf_rep_act_uciuhc,
8713
5
        &hf_gtp_csg_inf_rep_act_ucishc,
8714
5
        &hf_gtp_csg_inf_rep_act_ucicsg,
8715
5
        NULL
8716
5
    };
8717
8718
5
    length = tvb_get_ntohs(tvb, offset + 1);
8719
5
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CSG_INF_REP_ACT], NULL,
8720
5
                                            val_to_str_ext_const(GTP_EXT_CSG_INF_REP_ACT, &gtpv1_val_ext, "Unknown"));
8721
5
    proto_tree_add_item(ext_tree, hf_gtp_ie_id,      tvb, offset, 1, ENC_BIG_ENDIAN);
8722
8723
5
    offset++;
8724
5
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8725
5
    offset = offset + 2;
8726
8727
5
    proto_tree_add_bitmask_list(ext_tree, tvb, offset, 1, flags, ENC_BIG_ENDIAN);
8728
8729
5
    return 3 + length;
8730
5
}
8731
/*
8732
 * 7.7.96 CSG ID
8733
 */
8734
8735
static int
8736
decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8737
2
{
8738
2
    uint16_t    length;
8739
2
    proto_tree *ext_tree;
8740
8741
2
    length = tvb_get_ntohs(tvb, offset + 1);
8742
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CSG_ID], NULL,
8743
2
                                            val_to_str_ext_const(GTP_EXT_CSG_ID, &gtpv1_val_ext, "Unknown"));
8744
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8745
8746
2
    offset++;
8747
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8748
2
    offset = offset + 2;
8749
8750
2
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8751
8752
2
    return 3 + length;
8753
2
}
8754
/*
8755
 * 7.7.97 CSG Membership Indication (CMI)
8756
 */
8757
static int
8758
decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8759
2
{
8760
2
    uint16_t    length;
8761
2
    proto_tree *ext_tree;
8762
8763
2
    length = tvb_get_ntohs(tvb, offset + 1);
8764
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CMI], NULL,
8765
2
                                        val_to_str_ext_const(GTP_EXT_CMI, &gtpv1_val_ext, "Unknown"));
8766
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8767
8768
2
    offset++;
8769
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8770
2
    offset = offset + 2;
8771
8772
    /* Due to a specification oversight, the CMI values ... are reversed from
8773
     * the values of the CSG-Membership-Indication AVP in 3GPP TS 32.299 [56].
8774
     * Therefore, when CMI values are sent over the charging interface, the
8775
     * values are encoded as specified in 3GPP TS 32.299 [56].
8776
     */
8777
2
    proto_tree_add_item(ext_tree, hf_gtp_cmi, tvb, offset, 1, ENC_BIG_ENDIAN);
8778
8779
2
    return 3 + length;
8780
2
}
8781
/*
8782
 * 7.7.98 APN Aggregate Maximum Bit Rate (APN-AMBR)
8783
 */
8784
static int
8785
decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8786
4
{
8787
4
    uint16_t    length;
8788
4
    proto_tree *ext_tree;
8789
8790
4
    length = tvb_get_ntohs(tvb, offset + 1);
8791
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF], NULL,
8792
4
                                        val_to_str_ext_const(GTP_EXT_AMBR, &gtpv1_val_ext, "Unknown"));
8793
4
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8794
8795
4
    offset++;
8796
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8797
4
    offset = offset + 2;
8798
8799
    /* APN Aggregate Maximum Bit Rate (APN-AMBR) is defined in clause 9.9.4.2 of 3GPP TS 24.301 [42], but shall be
8800
     * formatted as shown in Figure 7.7.98-1 as Unsigned32 binary integer values in kbps (1000 bits per second).
8801
     */
8802
    /* 4 to 7 APN-AMBR for Uplink */
8803
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8804
4
    offset+=4;
8805
    /* 8 to 11 APN-AMBR for Downlink */
8806
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8807
8808
4
    return 3 + length;
8809
4
}
8810
/*
8811
 * 7.7.99 UE Network Capability
8812
 */
8813
static int
8814
decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8815
5
{
8816
5
    uint16_t    length;
8817
5
    proto_tree *ext_tree;
8818
8819
5
    length = tvb_get_ntohs(tvb, offset + 1);
8820
5
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_NETWORK_CAP], NULL,
8821
5
                                        val_to_str_ext_const(GTP_EXT_UE_NETWORK_CAP, &gtpv1_val_ext, "Unknown"));
8822
8823
5
    offset++;
8824
5
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8825
5
    offset = offset + 2;
8826
8827
5
    de_emm_ue_net_cap(tvb, ext_tree, pinfo, offset, length, NULL, 0);
8828
8829
5
    return 3 + length;
8830
5
}
8831
/*
8832
 * 7.7.100 UE-AMBR
8833
 */
8834
8835
static int
8836
decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8837
2
{
8838
2
    uint16_t    length;
8839
2
    proto_tree *ext_tree;
8840
8841
2
    length = tvb_get_ntohs(tvb, offset + 1);
8842
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_AMBR], NULL,
8843
2
                                        val_to_str_ext_const(GTP_EXT_UE_AMBR, &gtpv1_val_ext, "Unknown"));
8844
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8845
8846
2
    offset++;
8847
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8848
2
    offset = offset + 2;
8849
8850
    /* 4 to 7 Subscribed UE-AMBR for Uplink */
8851
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8852
2
    offset+=4;
8853
    /* 8 to 11 Subscribed UE-AMBR for Downlink */
8854
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8855
2
    offset+=4;
8856
8857
    /* Authorized UE-AMBR for Uplink and Downlink fields are present in the IE only if the sender has their valid values
8858
     * available. Otherwise, the fields from m to (n+3) shall not be present.
8859
     */
8860
2
    if (length > 8) {
8861
        /* m to (m+3) Authorized UE-AMBR for Uplink */
8862
2
        proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8863
2
        offset += 4;
8864
8865
        /* (m+4) to (n+3) Authorized UE-AMBR for Downlink */
8866
2
        proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8867
2
        offset += 4;
8868
2
    }
8869
8870
2
    if (length > 16) {
8871
2
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 16);
8872
2
    }
8873
8874
2
    return 3 + length;
8875
2
}
8876
8877
/*
8878
 * 7.7.101 APN-AMBR with NSAPI
8879
 */
8880
static int
8881
decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8882
3
{
8883
3
    uint16_t    length;
8884
3
    proto_tree *ext_tree;
8885
8886
3
    length = tvb_get_ntohs(tvb, offset + 1);
8887
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_APN_AMBR_WITH_NSAPI], NULL,
8888
3
                                        val_to_str_ext_const(GTP_EXT_APN_AMBR_WITH_NSAPI, &gtpv1_val_ext, "Unknown"));
8889
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8890
8891
3
    offset++;
8892
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8893
3
    offset = offset + 2;
8894
8895
3
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
8896
3
    offset++;
8897
8898
    /* 5 to 8 Authorized APN-AMBR for Uplink */
8899
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8900
3
    offset+=4;
8901
8902
    /* 9 to12 Authorized APN-AMBR for Downlink */
8903
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8904
8905
3
    return 3 + length;
8906
3
}
8907
/*
8908
 * 7.7.102 GGSN Back-Off Time
8909
 */
8910
/* Table 7.7.102.1: GGSN Back-Off Time information element */
8911
static const value_string gtp_ggsn_back_off_time_units_vals[] = {
8912
    {0, "value is incremented in multiples of 2 seconds"},
8913
    {1, "value is incremented in multiples of 1 minute"},
8914
    {2, "value is incremented in multiples of 10 minutes"},
8915
    {3, "value is incremented in multiples of 1 hour"},
8916
    {4, "value is incremented in multiples of 10 hours"},
8917
    {5, "value indicates that the timer is infinite"},
8918
    {0, NULL}
8919
};
8920
static int
8921
decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8922
3
{
8923
3
    uint16_t    length;
8924
3
    proto_tree *ext_tree;
8925
8926
3
    length = tvb_get_ntohs(tvb, offset + 1);
8927
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_GGSN_BACK_OFF_TIME], NULL,
8928
3
                                        val_to_str_ext_const(GTP_EXT_GGSN_BACK_OFF_TIME, &gtpv1_val_ext, "Unknown"));
8929
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8930
8931
3
    offset++;
8932
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8933
3
    offset += 2;
8934
8935
    /* 4 Timer unit Timer value */
8936
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_time_units, tvb, offset, 1, ENC_BIG_ENDIAN);
8937
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_timer, tvb, offset, 1, ENC_BIG_ENDIAN);
8938
8939
3
    return 3 + length;
8940
3
}
8941
8942
/*
8943
 * 7.7.103 Signalling Priority Indication
8944
 */
8945
static const true_false_string gtp_lapi_tfs = {
8946
        "MS is configured for NAS signalling low priority",
8947
        "MS is not configured for NAS signalling low priority"
8948
};
8949
8950
static int
8951
decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8952
11
{
8953
11
    uint16_t    length;
8954
11
    proto_tree *ext_tree;
8955
8956
11
    length = tvb_get_ntohs(tvb, offset + 1);
8957
11
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SIG_PRI_IND], NULL,
8958
11
                                    val_to_str_ext_const(GTP_EXT_SIG_PRI_IND, &gtpv1_val_ext, "Unknown"));
8959
11
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8960
8961
11
    offset++;
8962
11
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8963
11
    offset += 2;
8964
8965
11
    proto_tree_add_item(ext_tree, hf_gtp_lapi, tvb, offset, 1, ENC_NA);
8966
8967
11
    return 3 + length;
8968
11
}
8969
/*
8970
 * 7.7.104 Signalling Priority Indication with NSAPI
8971
 */
8972
8973
static int
8974
decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8975
4
{
8976
4
    uint16_t    length;
8977
4
    proto_tree *ext_tree;
8978
8979
4
    length = tvb_get_ntohs(tvb, offset + 1);
8980
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SIG_PRI_IND_W_NSAPI], NULL,
8981
4
                                            val_to_str_ext_const(GTP_EXT_SIG_PRI_IND_W_NSAPI, &gtpv1_val_ext, "Unknown"));
8982
4
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8983
8984
4
    offset++;
8985
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8986
4
    offset += 2;
8987
8988
4
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8989
4
    offset++;
8990
8991
4
    proto_tree_add_item(ext_tree, hf_gtp_lapi, tvb, offset, 1, ENC_NA);
8992
8993
4
    return 3 + length;
8994
4
}
8995
/*
8996
 * 7.7.105 Higher bitrates than 16 Mbps flag
8997
 */
8998
static const value_string gtp_higher_br_16mb_flg_vals[] = {
8999
    {0, "Not allowed"},
9000
    {1, "Allowed"},
9001
    {0, NULL}
9002
};
9003
9004
static int
9005
decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9006
2
{
9007
2
    uint16_t    length;
9008
2
    proto_tree *ext_tree;
9009
9010
2
    length = tvb_get_ntohs(tvb, offset + 1);
9011
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_HIGHER_BR_16MB_FLG], NULL,
9012
2
                                          val_to_str_ext_const(GTP_EXT_HIGHER_BR_16MB_FLG, &gtpv1_val_ext, "Unknown"));
9013
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9014
9015
2
    offset++;
9016
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9017
2
    offset += 2;
9018
9019
    /* Higher bitrates than 16 Mbps flag */
9020
2
    proto_tree_add_item(ext_tree, hf_gtp_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
9021
9022
2
    return 3 + length;
9023
2
}
9024
/*
9025
 * 7.7.106 Max MBR/APN-AMBR
9026
 */
9027
9028
static int
9029
decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9030
7
{
9031
7
    uint16_t    length;
9032
7
    proto_tree *ext_tree;
9033
7
    uint32_t    max_ul;
9034
7
    uint32_t    max_dl;
9035
9036
7
    length = tvb_get_ntohs(tvb, offset + 1);
9037
7
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MAX_MBR_APN_AMBR], NULL,
9038
7
                                    val_to_str_ext_const(GTP_EXT_MAX_MBR_APN_AMBR, &gtpv1_val_ext, "Unknown"));
9039
7
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9040
9041
7
    offset++;
9042
7
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9043
7
    offset = offset + 2;
9044
9045
        /* Max MBR/APN-AMBR for uplink */
9046
7
    max_ul = tvb_get_ntohl(tvb, offset);
9047
7
    proto_tree_add_uint_format_value(ext_tree, hf_gtp_max_mbr_apn_ambr_ul, tvb, offset, 4, max_ul, "%u %s",
9048
7
                               (max_ul) > 1000 ? max_ul/1000 : max_ul,
9049
7
                               (max_ul) > 1000 ? "Mbps" : "kbps");
9050
9051
7
    offset += 4;
9052
9053
    /* Max MBR/APN-AMBR for downlink */
9054
7
    max_dl = tvb_get_ntohl(tvb, offset);
9055
7
    proto_tree_add_uint_format_value(ext_tree, hf_gtp_max_mbr_apn_ambr_dl, tvb, offset, 4, max_dl, "%u %s",
9056
7
                                (max_dl) > 1000 ? max_dl/1000 : max_dl,
9057
7
                                (max_dl) > 1000 ? "Mbps" : "kbps");
9058
9059
7
    return 3 + length;
9060
7
}
9061
/*
9062
 * 7.7.107 Additional MM context for SRVCC
9063
 */
9064
9065
static int
9066
decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9067
33
{
9068
33
    uint16_t    length;
9069
33
    proto_tree *ext_tree;
9070
33
    uint32_t inf_len;
9071
9072
33
    length = tvb_get_ntohs(tvb, offset + 1);
9073
33
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_MM_CTX_SRVCC], NULL,
9074
33
                                        val_to_str_ext_const(GTP_EXT_ADD_MM_CTX_SRVCC, &gtpv1_val_ext, "Unknown"));
9075
33
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9076
9077
33
    offset++;
9078
33
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9079
33
    offset += 2;
9080
9081
    /* Length of the Mobile Station Classmark 2 */
9082
33
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ms_cm_2_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9083
33
    offset++;
9084
33
    if (inf_len > 0) {
9085
30
        offset += de_ms_cm_2(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9086
30
    }
9087
9088
    /* Length of the Mobile Station Classmark 3 */
9089
33
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ms_cm_3_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9090
33
    offset++;
9091
33
    if (inf_len > 0) {
9092
26
        offset += de_ms_cm_3(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9093
26
    }
9094
9095
    /* Length of the Supported Codec List */
9096
33
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_sup_codec_lst_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9097
33
    offset++;
9098
33
    if (inf_len > 0) {
9099
23
        de_sup_codec_list(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9100
23
    }
9101
9102
33
    return 3 + length;
9103
33
}
9104
9105
/*
9106
 * 7.7.108 Additional flags for SRVCC
9107
 */
9108
9109
static int
9110
decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9111
0
{
9112
0
    uint16_t    length;
9113
0
    proto_tree *ext_tree;
9114
9115
0
    length = tvb_get_ntohs(tvb, offset + 1);
9116
0
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_FLGS_SRVCC], NULL,
9117
0
                                        val_to_str_ext_const(GTP_EXT_ADD_FLGS_SRVCC, &gtpv1_val_ext, "Unknown"));
9118
0
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9119
9120
0
    offset++;
9121
0
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9122
0
    offset += 2;
9123
9124
    /* 4    Spare ICS */
9125
0
    proto_tree_add_item(ext_tree, hf_gtp_add_flg_for_srvcc_ics, tvb, offset, 1, ENC_BIG_ENDIAN);
9126
9127
0
    return 3 + length;
9128
0
}
9129
/*
9130
 * 7.7.109 STN-SR
9131
 */
9132
static int
9133
decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9134
2
{
9135
2
    uint16_t    length;
9136
2
    proto_tree *ext_tree;
9137
9138
2
    length = tvb_get_ntohs(tvb, offset + 1);
9139
2
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_STN_SR], NULL,
9140
2
                                        val_to_str_ext_const(GTP_EXT_STN_SR, &gtpv1_val_ext, "Unknown"));
9141
2
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9142
9143
2
    offset++;
9144
2
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9145
2
    offset += 2;
9146
9147
2
    proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
9148
9149
2
    return 3 + length;
9150
2
}
9151
9152
/*
9153
 * 7.7.110 C-MSISDN
9154
 */
9155
9156
static int
9157
decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9158
7
{
9159
7
    uint16_t    length;
9160
7
    proto_tree *ext_tree;
9161
9162
7
    length = tvb_get_ntohs(tvb, offset + 1);
9163
7
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_C_MSISDN], NULL,
9164
7
                                        val_to_str_ext_const(GTP_EXT_C_MSISDN, &gtpv1_val_ext, "Unknown"));
9165
7
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9166
9167
7
    offset++;
9168
7
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9169
7
    offset += 2;
9170
9171
7
    dissect_e164_msisdn(tvb, ext_tree, offset, length, E164_ENC_BCD);
9172
9173
7
    return 3 + length;
9174
7
}
9175
/*
9176
 * 7.7.111 Extended RANAP Cause
9177
 */
9178
static int
9179
decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9180
11
{
9181
11
    uint16_t    length;
9182
11
    proto_tree *ext_tree;
9183
11
    tvbuff_t *new_tvb;
9184
9185
11
    length = tvb_get_ntohs(tvb, offset + 1);
9186
11
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXT_RANAP_CAUSE], NULL,
9187
11
                                        val_to_str_ext_const(GTP_EXT_EXT_RANAP_CAUSE, &gtpv1_val_ext, "Unknown"));
9188
11
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9189
9190
11
    offset++;
9191
11
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9192
11
    offset += 2;
9193
9194
11
    new_tvb = tvb_new_subset_remaining(tvb, offset);
9195
9196
11
    dissect_ranap_Cause_PDU(new_tvb, pinfo, ext_tree, NULL);
9197
9198
11
    return 3 + length;
9199
11
}
9200
9201
/*
9202
 * 7.7.112 eNodeB ID
9203
 */
9204
9205
static const value_string gtp_enb_type_vals[] = {
9206
    { 0, "Macro eNodeB ID" },
9207
    { 1, "Home eNodeB ID" },
9208
    { 0, NULL }
9209
};
9210
9211
static int
9212
decode_gtp_ext_enodeb_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9213
3
{
9214
3
    uint16_t    length;
9215
3
    proto_tree *ext_tree;
9216
3
    uint32_t enb_type;
9217
9218
3
    length = tvb_get_ntohs(tvb, offset + 1);
9219
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ENODEB_ID], NULL,
9220
3
        val_to_str_ext_const(GTP_EXT_ENODEB_ID, &gtpv1_val_ext, "Unknown"));
9221
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9222
9223
3
    offset++;
9224
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9225
3
    offset += 2;
9226
9227
    /* eNodeB Type */
9228
3
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_enb_type, tvb, offset, 1, ENC_BIG_ENDIAN, &enb_type);
9229
3
    offset++;
9230
9231
3
    dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
9232
3
    offset += 3;
9233
9234
3
    switch (enb_type){
9235
2
    case 0:
9236
        /* Macro eNodeB ID */
9237
2
        proto_tree_add_item(ext_tree, hf_gtp_macro_enodeb_id, tvb, offset, 3, ENC_BIG_ENDIAN);
9238
2
        offset += 3;
9239
2
        proto_tree_add_item(ext_tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
9240
2
        break;
9241
0
    case 1:
9242
        /* Home eNodeB ID */
9243
0
        proto_tree_add_item(ext_tree, hf_gtp_home_enodeb_id, tvb, offset, 4, ENC_BIG_ENDIAN);
9244
0
        offset += 4;
9245
0
        proto_tree_add_item(ext_tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
9246
0
        break;
9247
1
    default:
9248
1
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 4);
9249
1
        break;
9250
3
    }
9251
9252
2
    return 3 + length;
9253
3
}
9254
9255
/*
9256
 * 7.7.113 Selection Mode with NSAPI
9257
 */
9258
static int
9259
decode_gtp_ext_sel_mode_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9260
4
{
9261
4
    uint16_t    length;
9262
4
    proto_tree *ext_tree;
9263
9264
4
    length = tvb_get_ntohs(tvb, offset + 1);
9265
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SEL_MODE_W_NSAPI], NULL,
9266
4
        val_to_str_ext_const(GTP_EXT_SEL_MODE_W_NSAPI, &gtpv1_val_ext, "Unknown"));
9267
4
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9268
9269
4
    offset++;
9270
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9271
4
    offset += 2;
9272
9273
4
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
9274
4
    offset++;
9275
9276
4
    proto_tree_add_item(ext_tree, hf_gtp_sel_mode_val, tvb, offset, 1, ENC_BIG_ENDIAN);
9277
9278
9279
4
    return 3 + length;
9280
4
}
9281
/*
9282
 * 7.7.114 ULI Timestamp
9283
 */
9284
static int
9285
decode_gtp_ext_uli_timestamp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9286
6
{
9287
6
    uint16_t    length;
9288
6
    proto_tree *ext_tree;
9289
9290
6
    length = tvb_get_ntohs(tvb, offset + 1);
9291
6
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ULI_TIMESTAMP], NULL,
9292
6
        val_to_str_ext_const(GTP_EXT_ULI_TIMESTAMP, &gtpv1_val_ext, "Unknown"));
9293
6
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9294
9295
6
    offset++;
9296
6
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9297
6
    offset += 2;
9298
9299
6
    proto_tree_add_item(ext_tree, hf_gtp_uli_timestamp, tvb, offset, 4, ENC_TIME_SECS_NTP|ENC_BIG_ENDIAN);
9300
9301
6
    return 3 + length;
9302
6
}
9303
9304
/*
9305
 * 7.7.115 Local Home Network ID (LHN-ID) with NSAPI
9306
 */
9307
static int
9308
decode_gtp_ext_lhn_id_w_sapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9309
1
{
9310
1
    uint16_t    length;
9311
1
    proto_tree *ext_tree;
9312
9313
1
    length = tvb_get_ntohs(tvb, offset + 1);
9314
1
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_LHN_ID_W_SAPI], NULL,
9315
1
        val_to_str_ext_const(GTP_EXT_LHN_ID_W_SAPI, &gtpv1_val_ext, "Unknown"));
9316
1
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9317
9318
1
    offset++;
9319
1
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9320
1
    offset += 2;
9321
1
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
9322
1
    offset += 1;
9323
9324
1
    proto_tree_add_item(ext_tree, hf_gtp_lhn_id, tvb, offset, length, ENC_APN_STR|ENC_NA);
9325
9326
1
    return 3 + length;
9327
1
}
9328
/*
9329
 * 7.7.116 CN Operator Selection Entity
9330
 */
9331
static const value_string gtp_sel_entity_vals[] = {
9332
    { 0, "The Serving Network has been selected by the UE"},
9333
    { 1, "The Serving Network has been selected by the network"},
9334
    { 2, "For future use"},
9335
    { 3, "For future use"},
9336
    { 0, NULL},
9337
};
9338
9339
static int
9340
decode_gtp_ext_cn_op_sel_entity(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9341
7
{
9342
7
    uint16_t    length;
9343
7
    proto_tree *ext_tree;
9344
9345
7
    length = tvb_get_ntohs(tvb, offset + 1);
9346
7
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CN_OP_SEL_ENTITY], NULL,
9347
7
        val_to_str_ext_const(GTP_EXT_CN_OP_SEL_ENTITY, &gtpv1_val_ext, "Unknown"));
9348
7
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9349
9350
7
    offset++;
9351
7
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9352
7
    offset += 2;
9353
9354
7
    proto_tree_add_item(ext_tree, hf_gtp_sel_entity, tvb, offset, 1, ENC_BIG_ENDIAN);
9355
7
    offset++;
9356
9357
7
    if (length > 1) {
9358
6
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9359
6
    }
9360
7
    return 3 + length;
9361
7
}
9362
9363
/*
9364
 * 7.7.117 UE Usage Type
9365
 */
9366
static int
9367
decode_gtp_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9368
3
{
9369
3
    uint16_t    length;
9370
3
    proto_tree *ext_tree;
9371
9372
3
    length = tvb_get_ntohs(tvb, offset + 1);
9373
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_USAGE_TYPE], NULL,
9374
3
        val_to_str_ext_const(GTP_EXT_UE_USAGE_TYPE, &gtpv1_val_ext, "Unknown"));
9375
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9376
9377
3
    offset++;
9378
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9379
3
    offset += 2;
9380
9381
3
    proto_tree_add_item(ext_tree, hf_gtp_ue_usage_type_value, tvb, offset, 4, ENC_BIG_ENDIAN);
9382
3
    offset += 4;
9383
9384
3
    if (length > 4) {
9385
2
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 4);
9386
2
    }
9387
9388
3
    return 3 + length;
9389
3
}
9390
9391
/*
9392
 * 7.7.118 Extended Common Flags II
9393
 */
9394
static int
9395
decode_gtp_extended_common_flgs_II(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9396
4
{
9397
4
    uint16_t    length;
9398
4
    proto_tree *ext_tree;
9399
9400
4
    length = tvb_get_ntohs(tvb, offset + 1);
9401
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXT_COMMON_FLGS_II], NULL,
9402
4
                                        val_to_str_ext_const(GTP_EXT_EXT_COMMON_FLGS_II, &gtpv1_val_ext, "Unknown"));
9403
4
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9404
9405
4
    offset++;
9406
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9407
4
    offset = offset + 2;
9408
9409
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_pnsi, tvb, offset, 1, ENC_BIG_ENDIAN);
9410
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_dtci, tvb, offset, 1, ENC_BIG_ENDIAN);
9411
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_pmtsmi, tvb, offset, 1, ENC_BIG_ENDIAN);
9412
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
9413
9414
4
    offset++;
9415
9416
4
    if(length > 1){
9417
3
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length-1);
9418
3
    }
9419
9420
4
    return 3 + length;
9421
4
}
9422
9423
/*
9424
 * 7.7.119 Node Identifier
9425
 */
9426
static int
9427
decode_gtp_ext_node_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9428
1
{
9429
1
    uint16_t    length;
9430
1
    uint32_t    item_len;
9431
1
    proto_tree *ext_tree;
9432
9433
1
    length = tvb_get_ntohs(tvb, offset + 1);
9434
1
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_NODE_IDENTIFIER], NULL,
9435
1
        val_to_str_ext_const(GTP_EXT_NODE_IDENTIFIER, &gtpv1_val_ext, "Unknown"));
9436
1
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9437
9438
1
    offset++;
9439
1
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9440
1
    offset += 2;
9441
9442
    /* The Node Name and Node Realm are Diameter Identities, which are
9443
     * specified by RFC 6733 to be in ASCII for compatibility with DNS.
9444
     */
9445
1
    proto_tree_add_item_ret_length(ext_tree, hf_gtp_node_name, tvb, offset, 1, ENC_ASCII | ENC_NA, &item_len);
9446
1
    offset += item_len;
9447
1
    proto_tree_add_item_ret_length(ext_tree, hf_gtp_node_realm, tvb, offset, 1, ENC_ASCII | ENC_NA, &item_len);
9448
9449
1
    return 3 + length;
9450
1
}
9451
9452
/*
9453
 * 7.7.120 CIoT Optimizations Support Indication
9454
 */
9455
static int
9456
decode_gtp_ciot_opt_sup_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9457
19
{
9458
19
    uint16_t    length;
9459
19
    proto_tree *ext_tree;
9460
9461
19
    length = tvb_get_ntohs(tvb, offset + 1);
9462
19
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CIOT_OPT_SUP_IND], NULL,
9463
19
        val_to_str_ext_const(GTP_EXT_CIOT_OPT_SUP_IND, &gtpv1_val_ext, "Unknown"));
9464
19
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9465
9466
19
    offset++;
9467
19
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9468
19
    offset += 2;
9469
9470
19
    proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_sgni_pdn, tvb, offset, 1, ENC_NA);
9471
19
    proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_scni_pdn, tvb, offset, 1, ENC_NA);
9472
19
    proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_spare, tvb, offset, 1, ENC_NA);
9473
19
    offset++;
9474
9475
19
    if (length > 1) {
9476
5
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9477
5
    }
9478
9479
19
    return 3 + length;
9480
19
}
9481
9482
/*
9483
 * 7.7.121 SCEF PDN Connection
9484
 */
9485
static int
9486
decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9487
6
{
9488
6
    uint16_t    length;
9489
6
    proto_tree *ext_tree;
9490
6
    uint32_t    apn_length, scef_id_length;
9491
9492
6
    length = tvb_get_ntohs(tvb, offset + 1);
9493
6
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SCEF_PDN_CONNECTION], NULL,
9494
6
        val_to_str_ext_const(GTP_EXT_SCEF_PDN_CONNECTION, &gtpv1_val_ext, "Unknown"));
9495
6
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9496
9497
6
    offset++;
9498
6
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9499
6
    offset += 2;
9500
9501
6
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_NA, &apn_length);
9502
6
    decode_apn(pinfo, tvb, offset + 1, (uint16_t)apn_length, ext_tree, NULL);
9503
9504
6
    offset += 1 + apn_length;
9505
9506
6
    proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_NA);
9507
6
    offset++;
9508
9509
6
    proto_tree_add_item_ret_uint(ext_tree, hf_gtp_scef_id_length, tvb, offset, 2, ENC_BIG_ENDIAN, &scef_id_length);
9510
6
    offset += 2;
9511
9512
6
    proto_tree_add_item(ext_tree, hf_gtp_scef_id, tvb, offset, scef_id_length, ENC_ASCII);
9513
6
    offset += scef_id_length;
9514
9515
6
    if (length > 4 + apn_length + scef_id_length) {
9516
2
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - (4 + apn_length + scef_id_length));
9517
2
    }
9518
9519
6
    return 3 + length;
9520
6
}
9521
/*
9522
 * 7.7.122 IOV_updates counter
9523
 */
9524
static int
9525
decode_gtp_iov_updates_counter(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9526
4
{
9527
4
    uint16_t    length;
9528
4
    proto_tree *ext_tree;
9529
9530
4
    length = tvb_get_ntohs(tvb, offset + 1);
9531
4
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_IOV_UPDATES_COUNTER], NULL,
9532
4
        val_to_str_ext_const(GTP_EXT_IOV_UPDATES_COUNTER, &gtpv1_val_ext, "Unknown"));
9533
4
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9534
9535
4
    offset++;
9536
4
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9537
4
    offset += 2;
9538
9539
4
    proto_tree_add_item(ext_tree, hf_gtp_iov_updates_counter, tvb, offset, 1, ENC_BIG_ENDIAN);
9540
4
    offset++;
9541
9542
4
    if (length > 1) {
9543
3
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9544
3
    }
9545
9546
4
    return 3 + length;
9547
4
}
9548
/*
9549
 * 7.7.123 Mapped UE Usage Type
9550
 */
9551
static int
9552
decode_gtp_mapped_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9553
3
{
9554
3
    uint16_t    length;
9555
3
    proto_tree *ext_tree;
9556
9557
3
    length = tvb_get_ntohs(tvb, offset + 1);
9558
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MAPPED_UE_USAGE_TYPE], NULL,
9559
3
        val_to_str_ext_const(GTP_EXT_MAPPED_UE_USAGE_TYPE, &gtpv1_val_ext, "Unknown"));
9560
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9561
9562
3
    offset++;
9563
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9564
3
    offset += 2;
9565
9566
3
    proto_tree_add_item(ext_tree, hf_gtp_mapped_ue_usage_type, tvb, offset, 2, ENC_BIG_ENDIAN);
9567
3
    offset += 2;
9568
9569
3
    if (length > 2) {
9570
3
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 2);
9571
3
    }
9572
9573
3
    return 3 + length;
9574
3
}
9575
/*
9576
 * 7.7.124 UP Function Selection Indication Flags
9577
 */
9578
static int
9579
decode_gtp_up_fun_sel_ind_flags(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9580
3
{
9581
3
    uint16_t    length;
9582
3
    proto_tree *ext_tree;
9583
9584
3
    length = tvb_get_ntohs(tvb, offset + 1);
9585
3
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UP_FUN_SEL_IND_FLAGS], NULL,
9586
3
        val_to_str_ext_const(GTP_EXT_UP_FUN_SEL_IND_FLAGS, &gtpv1_val_ext, "Unknown"));
9587
3
    proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9588
9589
3
    offset++;
9590
3
    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9591
3
    offset += 2;
9592
9593
3
    proto_tree_add_item(ext_tree, hf_gtp_up_fun_sel_ind_flags_dcnr, tvb, offset, 1, ENC_BIG_ENDIAN);
9594
3
    proto_tree_add_item(ext_tree, hf_gtp_up_fun_sel_ind_flags_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
9595
3
    offset++;
9596
9597
3
    if (length > 1) {
9598
2
        proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9599
2
    }
9600
9601
3
    return 3 + length;
9602
3
}
9603
9604
/* TS 32.295, chapter 6.2.4.5.4, page 30 */
9605
static int
9606
decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9607
13
{
9608
9609
13
    uint16_t    length, n, number;
9610
13
    proto_tree *ext_tree_rel_pack;
9611
9612
13
    length = tvb_get_ntohs(tvb, offset + 1);
9613
9614
13
    ext_tree_rel_pack = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_rel_pack, NULL,
9615
13
                                    "Sequence numbers of released packets IE");
9616
9617
13
    n = 0;
9618
9619
1.48k
    while (n < length) {
9620
9621
1.47k
        number = tvb_get_ntohs(tvb, offset + 3 + n);
9622
1.47k
        proto_tree_add_uint_format(ext_tree_rel_pack, hf_gtp_seq_num_released, tvb, offset + 3 + n, 2, number, "%u", number);
9623
1.47k
        n = n + 2;
9624
9625
1.47k
    }
9626
9627
13
    return 3 + length;
9628
13
}
9629
9630
/* GPRS:        12.15
9631
 * UMTS:        33.015
9632
 */
9633
static int
9634
decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9635
14
{
9636
9637
14
    uint16_t    length, n, number;
9638
14
    proto_tree *ext_tree_can_pack;
9639
9640
14
    length = tvb_get_ntohs(tvb, offset + 1);
9641
9642
14
    ext_tree_can_pack = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_can_pack, NULL,
9643
14
                                        "Sequence numbers of cancelled  packets IE");
9644
9645
14
    n = 0;
9646
9647
836
    while (n < length) {
9648
9649
822
        number = tvb_get_ntohs(tvb, offset + 3 + n);
9650
822
        proto_tree_add_uint_format(ext_tree_can_pack, hf_gtp_seq_num_canceled, tvb, offset + 3 + n, 2, number, "%u", number);
9651
822
        n += 2;
9652
822
    }
9653
9654
14
    return 3 + length;
9655
14
}
9656
9657
/* CDRs dissector
9658
 * 3GPP TS 32.295 version 9.0.0 Release 9
9659
 */
9660
9661
/* 3GPP TS 32.298 version 18.6.0, chapter 6.1, page 259 */
9662
static const value_string gtp_cdr_fmt_vals[] = {
9663
    {1, "Basic Encoding Rules (BER)"},
9664
    {2, "Unaligned basic Packed Encoding Rules (PER)"},
9665
    {3, "Aligned basic Packed Encoding Rules (PER)"},
9666
    {4, "XML Encoding Rules (XER)"},
9667
    {0, NULL}
9668
};
9669
static int
9670
decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9671
25
{
9672
9673
25
    uint16_t    length, cdr_length;
9674
25
    uint8_t     no, format, app_id, rel_id, ver_id, i;
9675
25
    bool        rel_id_zero = false;
9676
25
    proto_tree *ext_tree, *ver_tree, *cdr_dr_tree;
9677
25
    proto_item *fmt_item;
9678
25
    tvbuff_t   *next_tvb;
9679
9680
25
    ext_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ext, NULL,
9681
25
                    val_to_str_ext_const(GTP_EXT_DATA_REQ, &gtp_val_ext, "Unknown message"));
9682
25
    offset++;
9683
9684
25
    length = tvb_get_ntohs(tvb, offset);
9685
25
    proto_tree_add_uint(ext_tree, hf_gtp_length, tvb, offset, 2, length);
9686
25
    offset+=2;
9687
9688
25
    if (length == 0) {
9689
1
        return 3;
9690
1
    }
9691
9692
    /* Octet 4 Number of Data Records */
9693
24
    no = tvb_get_uint8(tvb, offset);
9694
24
    proto_tree_add_item(ext_tree, hf_gtp_number_of_data_records, tvb, offset, 1, ENC_BIG_ENDIAN);
9695
24
    offset++;
9696
9697
    /* Octet 5 Data Record Format */
9698
24
    format   = tvb_get_uint8(tvb, offset);
9699
24
    fmt_item = proto_tree_add_item(ext_tree, hf_gtp_data_record_format, tvb, offset, 1, ENC_BIG_ENDIAN);
9700
24
    offset++;
9701
    /* The value range is 1-255 in decimal. The value '0' should not be used.
9702
     * Only the values 1-10 and 51-255 can be used for standards purposes.
9703
     * Values in the range of 11-50 are to be configured only by operators, and are not subject to standardization.
9704
     */
9705
24
    if(format < 5) {
9706
18
        proto_item_append_text(fmt_item, " %s", val_to_str_const(format, gtp_cdr_fmt_vals, "Unknown"));
9707
        /* Octet 6 -7  Data Record Format Version
9708
         *    8 7 6 5             4 3 2 1
9709
         * 6 Application Identifier Release Identifier
9710
         * 7 Version Identifier
9711
         *
9712
         * New with Release 15 and higher:
9713
         * 8 Release Identifier Extension
9714
         * The Release Identifier indicates the TS release up to and including
9715
         * 15. The Release Identifier Extension indicates TS releases above 15,
9716
         * in this case the Release Identifier has a value of '0' (decimal)
9717
         */
9718
18
        app_id = tvb_get_uint8(tvb,offset);
9719
18
        rel_id = app_id & 0x0f;
9720
18
        app_id = app_id >>4;
9721
18
        ver_id = tvb_get_uint8(tvb,offset+1);
9722
18
        if (rel_id == 0) {
9723
8
            rel_id_zero = true;
9724
8
            rel_id = tvb_get_uint8(tvb,offset+2);
9725
8
        }
9726
        /* The second octet (#7 in Data Record Packet IE) identifies the version of the TS used to encode the CDR,
9727
         * i.e. its value corresponds to the second digit of the version number of the document [51]
9728
         * (as shown on the cover sheet), plus '1'.
9729
         * E.g. for version 3.4.0, the Version Identifier would be "5".
9730
         * In circumstances where the second digit is an alphabetical character, (e.g. 3.b.0), the corresponding ASCII value shall
9731
         * be taken, e.g. the Version Identifier would be "66" (ASCII(b)).
9732
         */
9733
18
        if(ver_id < 0x65)
9734
11
            ver_id = ver_id -1;
9735
        /* XXX We don't handle ASCCI version */
9736
9737
18
        ver_tree = proto_tree_add_subtree_format(ext_tree, tvb, offset, (rel_id_zero || rel_id == 15) ? 3 : 2, ett_gtp_cdr_ver, NULL,
9738
18
                                "Data record format version: AppId %u Rel %u.%u.0", app_id,rel_id,ver_id);
9739
18
        proto_tree_add_item(ver_tree, hf_gtp_cdr_app, tvb, offset, 1, ENC_BIG_ENDIAN);
9740
18
        proto_tree_add_item(ver_tree, hf_gtp_cdr_rel, tvb, offset, 1, ENC_BIG_ENDIAN);
9741
18
        offset++;
9742
18
        proto_tree_add_item(ver_tree, hf_gtp_cdr_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
9743
18
        offset++;
9744
18
        if(rel_id_zero) {
9745
            /* The Release Identifier indicates the TS release up to and including 15.
9746
             * The Release Identifier Extension indicates TS releases above 15,
9747
             * in this case the Release Identifier has a value of '0' (decimal).
9748
             */
9749
8
            fmt_item = proto_tree_add_item(ver_tree, hf_gtp_cdr_rel_ext, tvb, offset, 1, ENC_NA);
9750
8
            offset++;
9751
8
            if(rel_id < 16) {
9752
7
                expert_add_info(pinfo, fmt_item, &ei_gtp_cdr_rel_ext_invalid);
9753
7
            }
9754
8
        }
9755
42
        for(i = 0; i < no; ++i) {
9756
24
            cdr_length = tvb_get_ntohs(tvb, offset);
9757
24
            cdr_dr_tree = proto_tree_add_subtree_format(ext_tree, tvb, offset, cdr_length+2,
9758
24
                                    ett_gtp_cdr_dr, NULL, "Data record %d", i + 1);
9759
24
            proto_tree_add_uint(cdr_dr_tree, hf_gtp_cdr_length, tvb, offset, 2, cdr_length);
9760
24
            offset+=2;
9761
24
            proto_tree_add_item(cdr_dr_tree, hf_gtp_cdr_context, tvb, offset, cdr_length, ENC_NA);
9762
24
            next_tvb = tvb_new_subset_remaining(tvb, offset);
9763
9764
            /* XXX this is for release 6, may not work for higher releases */
9765
24
            if(format==1) {
9766
0
                if(rel_id <= 6){
9767
0
                    dissect_gprscdr_GPRSCallEventRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
9768
0
                }else{
9769
0
                    dissect_gprscdr_GPRSRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
9770
0
                }
9771
24
            } else {
9772
                /* Do we have a dissector registering for this standardized encodings data format? */
9773
24
                dissector_try_uint(gtp_cdr_fmt_dissector_table, format, next_tvb, pinfo, cdr_dr_tree);
9774
24
            }
9775
9776
24
            offset = offset + cdr_length;
9777
24
        }
9778
18
        return offset;
9779
9780
18
    } else {
9781
        /* Proprietary CDR format */
9782
6
        proto_item_append_text(fmt_item, " Proprietary or un documented format");
9783
6
    }
9784
9785
6
    next_tvb = tvb_new_subset_remaining(tvb, offset);
9786
6
    if (gtpcdr_handle) {
9787
0
        call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
9788
6
    } else {
9789
        /* Do we have a dissector registering for this proprietary data format? */
9790
6
        dissector_try_uint_with_data(gtp_cdr_fmt_dissector_table, format, next_tvb, pinfo, tree, false, &no);
9791
6
    }
9792
9793
6
    return 3 + length;
9794
24
}
9795
9796
/* TS 32.295 */
9797
static int
9798
decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
9799
43
{
9800
9801
43
    uint16_t         length, n;
9802
43
    proto_tree      *ext_tree_data_resp;
9803
43
    gtp_msg_hash_t  *gcrp = NULL;
9804
43
    unsigned         request_responded_seq_no = 0;
9805
43
    gtp_conv_info_t *gtp_info;
9806
9807
43
    gtp_info = find_or_create_gtp_conv_info(pinfo, NULL);
9808
9809
43
    length = tvb_get_ntohs(tvb, offset + 1);
9810
9811
43
    ext_tree_data_resp = proto_tree_add_subtree(tree, tvb, offset, 3 + length,
9812
43
                                ett_gtp_data_resp, NULL, "Requests responded");
9813
9814
43
    n = 0;
9815
9816
3.00k
    while (n < length) {
9817
9818
2.96k
        proto_tree_add_item_ret_uint(ext_tree_data_resp, hf_gtp_requests_responded, tvb, offset + 3 + n, 2, ENC_BIG_ENDIAN, &request_responded_seq_no);
9819
2.96k
        n = n + 2;
9820
9821
        /* Unlike GTP, sequence number inside GTP' header of response is not used to confirm request.
9822
         * Instead of this "Data Record Transfer Response" message includes IE "Requests Responded"
9823
         * with sequence numbers of requests to confirm.
9824
         */
9825
2.96k
        uint8_t cause_aux = 128; /* Cause accepted by default. Only used when args is NULL */
9826
2.96k
        if (args) {
9827
0
            cause_aux = args->last_cause;
9828
0
        }
9829
2.96k
        gcrp = gtp_match_response(tvb, pinfo, tree, request_responded_seq_no, GTP_MSG_DATA_TRANSF_RESP, gtp_info, cause_aux);
9830
        /*pass packet to tap for response time reporting*/
9831
2.96k
        if (gcrp) {
9832
97
            tap_queue_packet(gtp_tap, pinfo, gcrp);
9833
97
        }
9834
2.96k
    }
9835
9836
43
    return 3 + length;
9837
9838
43
}
9839
9840
/* GPRS:        12.15
9841
 * UMTS:        33.015
9842
 */
9843
static int
9844
decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9845
8
{
9846
9847
8
    uint16_t           length;
9848
8
    proto_tree        *ext_tree_node_addr;
9849
8
    proto_item        *te;
9850
9851
8
    length = tvb_get_ntohs(tvb, offset + 1);
9852
9853
8
    ext_tree_node_addr = proto_tree_add_subtree(tree, tvb, offset, 3 + length,
9854
8
                                ett_gtp_node_addr, &te, "Node address: ");
9855
9856
8
    proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
9857
9858
8
    switch (length) {
9859
0
    case 4:
9860
0
        proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
9861
0
        proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
9862
0
        break;
9863
0
    case 16:
9864
0
        proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, ENC_NA);
9865
0
        proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
9866
0
        break;
9867
8
    default:
9868
8
        proto_item_append_text(te, "unknown type or wrong length");
9869
8
        break;
9870
8
    }
9871
9872
8
    return 3 + length;
9873
9874
8
}
9875
9876
/* GPRS:        9.60 v7.6.0, chapter 7.9.26
9877
 * UMTS:        29.060 v4.0, chapter 7.7.46 Private Extension
9878
 *
9879
 */
9880
9881
static int
9882
decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9883
54
{
9884
9885
54
    uint16_t    length, ext_id;
9886
54
    proto_tree *ext_tree_priv_ext;
9887
54
    proto_item *te;
9888
54
    tvbuff_t   *next_tvb;
9889
9890
54
    ext_tree_priv_ext = proto_tree_add_subtree_format(tree, tvb, offset, 1, ett_gtp_ext, &te,
9891
54
                "%s : ", val_to_str_ext_const(GTP_EXT_PRIV_EXT, &gtp_val_ext, "Unknown message"));
9892
9893
54
    offset++;
9894
54
    length = tvb_get_ntohs(tvb, offset);
9895
54
    proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9896
54
    offset += 2;
9897
54
    if (length >= 2) {
9898
49
        ext_id = tvb_get_ntohs(tvb, offset);
9899
49
        proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
9900
49
        proto_item_append_text(te, "%s (%u)", enterprises_lookup(ext_id, "Unknown"), ext_id);
9901
49
        offset = offset + 2;
9902
9903
49
       if (length > 2) {
9904
47
            next_tvb = tvb_new_subset_length(tvb, offset, length-2);
9905
47
            if(!dissector_try_uint(gtp_priv_ext_dissector_table, ext_id, next_tvb, pinfo, ext_tree_priv_ext)){
9906
47
                    proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, ENC_NA);
9907
47
            }
9908
47
       }
9909
49
    }
9910
9911
54
    return 3 + length;
9912
54
}
9913
9914
static int
9915
decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9916
394
{
9917
9918
394
    proto_tree_add_expert(tree, pinfo, &ei_gtp_unknown_extension_header, tvb, offset, 1);
9919
9920
394
    return tvb_reported_length_remaining(tvb, offset);
9921
394
}
9922
9923
static void
9924
track_gtp_session(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t * gtp_hdr, wmem_list_t *teid_list, wmem_list_t *ip_list, uint32_t last_teid, address last_ip)
9925
0
{
9926
0
    uint32_t session, frame_teid_cp;
9927
0
    proto_item *it;
9928
9929
    /* GTP session */
9930
0
    if (tree) {
9931
0
        session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
9932
0
        if (session) {
9933
0
            it = proto_tree_add_uint(tree, hf_gtp_session, tvb, 0, 0, session);
9934
0
            proto_item_set_generated(it);
9935
0
        }
9936
0
    }
9937
9938
9939
0
    if (!PINFO_FD_VISITED(pinfo) && gtp_version == 1) {
9940
        /* If the message does not have any session ID */
9941
0
        session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
9942
0
        if (!session) {
9943
            /* If the message is not a CPDPCRES, CPDPCREQ, UPDPREQ, UPDPRES
9944
             * then we remove its information from teid and ip lists
9945
             * XXX: Wouldn't it be better not to insert this information
9946
             * in the first place for other message types, instead of
9947
             * inserting it and then immediately removing it?
9948
             * At the very least, it would be faster to iterate through the
9949
             * teid_list and ip_list and remove via keys rather than doing
9950
             * removal through a reverse lookup.
9951
             */
9952
0
            if ((gtp_hdr->message != GTP_MSG_CREATE_PDP_RESP && gtp_hdr->message != GTP_MSG_CREATE_PDP_REQ && gtp_hdr->message != GTP_MSG_UPDATE_PDP_RESP
9953
0
                && gtp_hdr->message != GTP_MSG_UPDATE_PDP_REQ)) {
9954
                /* If the lists are not empty*/
9955
0
                if (wmem_list_count(teid_list) && wmem_list_count(ip_list)) {
9956
0
                    remove_frame_info(pinfo->num);
9957
0
                }
9958
0
            }
9959
9960
0
            if (gtp_hdr->message == GTP_MSG_CREATE_PDP_REQ) {
9961
                /* If CPDPCREQ and not already in the list then we create a new session*/
9962
0
                add_gtp_session(pinfo->num, gtp_session_count++);
9963
0
            } else if (gtp_hdr->message != GTP_MSG_CREATE_PDP_RESP) {
9964
                /* If this is an error indication then we have to check the session id that belongs to the message with the same data teid and ip */
9965
0
                if (gtp_hdr->message == GTP_MSG_ERR_IND) {
9966
0
                    if (get_frame(last_ip, last_teid, &frame_teid_cp) == 1) {
9967
0
                        session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame_teid_cp)));
9968
0
                        if (session) {
9969
                            /* We add the corresponding session to the session list*/
9970
0
                            add_gtp_session(pinfo->num, session);
9971
0
                        }
9972
0
                    }
9973
0
                }
9974
0
                else {
9975
                    /* We have to check if its teid == teid_cp and ip.dst == gsn_ipv4 from the lists, if that is the case then we have to assign
9976
                    the corresponding session ID */
9977
0
                    if ((get_frame(pinfo->dst, (uint32_t)gtp_hdr->teid, &frame_teid_cp) == 1)) {
9978
                        /* Then we have to set its session ID */
9979
0
                        session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame_teid_cp)));
9980
0
                        if (session) {
9981
                            /* We add the corresponding session to the list so that when a response came we can associate its session ID*/
9982
0
                            add_gtp_session(pinfo->num, session);
9983
0
                        }
9984
0
                    }
9985
0
                }
9986
0
            }
9987
0
        }
9988
0
    }
9989
0
}
9990
9991
static int
9992
dissect_nrup(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree,
9993
            void *private_data _U_)
9994
6
{
9995
6
    uint32_t pdu_type;
9996
6
    bool dl_disc_blk;
9997
6
    bool dl_flush;
9998
6
    uint32_t dl_disc_num_blks;
9999
6
    int offset = 0;
10000
10001
    /* NRUP */
10002
6
    proto_item *nrup_ti;
10003
6
    proto_tree *nrup_tree;
10004
10005
    /* Protocol subtree */
10006
6
    nrup_ti = proto_tree_add_item(tree, proto_nrup, tvb, offset, -1, ENC_NA);
10007
6
    nrup_tree = proto_item_add_subtree(nrup_ti, ett_nrup);
10008
10009
10010
6
    proto_tree_add_item_ret_uint(nrup_ti, hf_nrup_pdu_type,tvb, offset, 1, ENC_BIG_ENDIAN, &pdu_type);
10011
10012
6
    switch (pdu_type) {
10013
3
        case NR_UP_DL_USER_DATA:
10014
3
        {
10015
            /* 5.5.2.1 */
10016
3
            bool report_delivered;
10017
10018
            /* PDU Type (=0) Spare DL Discard Blocks DL Flush Report polling Octet 1*/
10019
3
            proto_tree_add_item(nrup_tree, hf_nrup_spr_bit_extnd_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10020
3
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_discrd_blks, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_disc_blk);
10021
3
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_flush, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_flush);
10022
3
            proto_tree_add_item(nrup_tree, hf_nrup_rpt_poll, tvb, offset, 1, ENC_BIG_ENDIAN);
10023
3
            offset++;
10024
10025
            /* Spare    Assistance Info. Report Polling Flag    Retransmission flag*/
10026
3
            proto_tree_add_item(nrup_tree, hf_nrup_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
10027
3
            proto_tree_add_item(nrup_tree, hf_nrup_request_out_of_seq_report, tvb, offset, 1, ENC_BIG_ENDIAN);
10028
3
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_report_delivered, tvb, offset, 1, ENC_BIG_ENDIAN, &report_delivered);
10029
3
            proto_tree_add_item(nrup_tree, hf_nrup_user_data_existence_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10030
3
            proto_tree_add_item(nrup_tree, hf_nrup_ass_inf_rep_poll_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10031
3
            proto_tree_add_item(nrup_tree, hf_nrup_retransmission_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10032
3
            offset++;
10033
10034
            /* NR-U Sequence NUmber */
10035
3
            proto_tree_add_item(nrup_tree, hf_nrup_nr_u_seq_num, tvb, offset, 3, ENC_BIG_ENDIAN);
10036
3
            offset += 3;
10037
10038
3
            if (dl_flush) {
10039
                /* DL discard NR PDCP PDU SN */
10040
1
                proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_nr_pdcp_pdu_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10041
1
                offset += 3;
10042
1
            }
10043
            /* Discarded blocks */
10044
3
            if (dl_disc_blk) {
10045
                /* DL discard Number of blocks */
10046
1
                proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_dl_disc_num_blks, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_disc_num_blks);
10047
1
                offset++;
10048
1
                while (dl_disc_num_blks) {
10049
                    /* DL discard NR PDCP PDU SN start */
10050
0
                    proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_nr_pdcp_pdu_sn_start, tvb, offset, 3, ENC_BIG_ENDIAN);
10051
0
                    offset += 3;
10052
10053
                    /* Discarded Block size */
10054
0
                    proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_blk_sz, tvb, offset, 1, ENC_BIG_ENDIAN);
10055
0
                    offset++;
10056
0
                    dl_disc_num_blks--;
10057
0
                }
10058
1
            }
10059
10060
3
            if (report_delivered) {
10061
                /* DL report NR PDCP PDU SN */
10062
1
                proto_tree_add_item(nrup_tree, hf_nrup_dl_report_nr_pdcp_pdu_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10063
1
                offset += 3;
10064
1
            }
10065
3
            break;
10066
0
        }
10067
10068
0
        case NR_UP_DL_DATA_DELIVERY_STATUS:
10069
0
        {
10070
            /* 5.5.2.2 */
10071
0
            bool high_tx_nr_pdcp_sn_ind;
10072
0
            bool high_del_nr_pdcp_sn_ind;
10073
0
            bool lost_packet_report;
10074
0
            bool high_retx_nr_pdcp_sn_ind;
10075
0
            bool high_del_retx_nr_pdcp_sn_ind;
10076
0
            bool cause_rpt;
10077
0
            bool data_rate_ind;
10078
0
            uint32_t lost_NR_U_SN_range;
10079
10080
0
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_tx_nr_pdcp_sn_ind ,tvb, offset,1, ENC_BIG_ENDIAN, &high_tx_nr_pdcp_sn_ind );
10081
0
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_delivered_nr_pdcp_sn_ind ,tvb, offset,1, ENC_BIG_ENDIAN, &high_del_nr_pdcp_sn_ind );
10082
0
            proto_tree_add_item(nrup_tree, hf_nrup_final_frame_ind,tvb, offset, 1, ENC_BIG_ENDIAN);
10083
0
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_lost_pkt_rpt,tvb, offset, 1, ENC_BIG_ENDIAN, &lost_packet_report);
10084
0
            offset++;
10085
10086
0
            proto_tree_add_item(nrup_tree, hf_nrup_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
10087
0
            proto_tree_add_item(nrup_tree, hf_nrup_delivered_nr_pdcp_sn_range_ind ,tvb, offset,1, ENC_BIG_ENDIAN);
10088
0
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_data_rate_ind,tvb, offset,1, ENC_BIG_ENDIAN, &data_rate_ind);
10089
0
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_retx_nr_pdcp_sn_ind,tvb, offset,1, ENC_BIG_ENDIAN, &high_retx_nr_pdcp_sn_ind);
10090
0
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_delivered_retx_nr_pdcp_sn_ind,tvb, offset,1, ENC_BIG_ENDIAN, &high_del_retx_nr_pdcp_sn_ind);
10091
0
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_cause_rpt,tvb, offset,1, ENC_BIG_ENDIAN, &cause_rpt);
10092
0
            offset++;
10093
10094
0
            proto_tree_add_item(nrup_tree, hf_nrup_desrd_buff_sz_data_radio_bearer,tvb, offset, 4, ENC_BIG_ENDIAN);
10095
0
            offset += 4;
10096
10097
0
            if (data_rate_ind){
10098
0
                proto_tree_add_item(nrup_tree, hf_nrup_desrd_data_rate,tvb, offset, 4, ENC_BIG_ENDIAN);
10099
0
                offset += 4;
10100
0
            }
10101
10102
0
            if (lost_packet_report) {
10103
0
                proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_lost_nru_seq_num,tvb, offset, 1, ENC_BIG_ENDIAN, &lost_NR_U_SN_range);
10104
0
                offset+=1;
10105
10106
0
                while (lost_NR_U_SN_range) {
10107
0
                    proto_tree_add_item(nrup_tree, hf_nrup_start_lost_nru_seq_num,tvb, offset, 3, ENC_BIG_ENDIAN);
10108
0
                    offset += 3;
10109
10110
0
                     proto_tree_add_item(nrup_tree, hf_nrup_end_lost_nru_seq_num,tvb, offset, 3, ENC_BIG_ENDIAN);
10111
0
                     offset += 3;
10112
0
                     lost_NR_U_SN_range--;
10113
0
                }
10114
0
            }
10115
10116
0
            if (high_del_nr_pdcp_sn_ind) {
10117
0
                proto_tree_add_item(nrup_tree, hf_nrup_high_success_delivered_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10118
0
                offset += 3;
10119
0
            }
10120
10121
0
            if (high_tx_nr_pdcp_sn_ind) {
10122
0
                proto_tree_add_item(nrup_tree, hf_nrup_high_tx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10123
0
                offset += 3;
10124
0
            }
10125
10126
0
            if (cause_rpt) {
10127
0
                proto_tree_add_item(nrup_tree, hf_nrup_cause_val,tvb, offset, 1, ENC_BIG_ENDIAN);
10128
0
                offset ++;
10129
0
            }
10130
10131
0
            if (high_del_retx_nr_pdcp_sn_ind) {
10132
0
                proto_tree_add_item(nrup_tree, hf_nrup_high_success_delivered_retx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10133
0
                offset += 3;
10134
0
            }
10135
10136
0
            if (high_retx_nr_pdcp_sn_ind) {
10137
0
                proto_tree_add_item(nrup_tree, hf_nrup_high_retx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10138
0
            }
10139
10140
0
            break;
10141
0
        }
10142
10143
1
        case NR_UP_ASSISTANCE_INFORMATION_DATA:
10144
1
        {
10145
            /* 5.5.2.3 */
10146
1
            bool pdcp_duplication_indication;
10147
1
            bool assistance_information_ind;
10148
1
            bool ul_delay_ind;
10149
1
            bool dl_delay_ind;
10150
1
            bool pdcp_duplication_suggestion;
10151
10152
            /* Flags */
10153
1
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_pdcp_duplication_ind, tvb, offset,1, ENC_BIG_ENDIAN, &pdcp_duplication_indication);
10154
1
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_assistance_information_ind, tvb, offset,1, ENC_BIG_ENDIAN, &assistance_information_ind);
10155
1
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_ul_delay_ind, tvb, offset,1, ENC_BIG_ENDIAN, &ul_delay_ind);
10156
1
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_delay_ind, tvb, offset,1, ENC_BIG_ENDIAN, &dl_delay_ind);
10157
1
            offset++;
10158
1
            proto_tree_add_item(nrup_tree, hf_nrup_spare_2, tvb, offset,1, ENC_BIG_ENDIAN);
10159
1
            proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_pdcp_duplication_activation_suggestion,
10160
1
                                            tvb, offset,1, ENC_BIG_ENDIAN, &pdcp_duplication_suggestion);
10161
1
            offset++;
10162
10163
            /* Number of Assistance Information Fields */
10164
1
            if (assistance_information_ind) {
10165
0
                uint32_t number_of_assistance_information_fields = 0;
10166
0
                uint32_t num_octets_radio_qa_info;
10167
10168
                /* Number of assistance info fields */
10169
0
                proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_assistance_info_fields,
10170
0
                                             tvb, offset,1, ENC_BIG_ENDIAN, &number_of_assistance_information_fields);
10171
0
                offset++;
10172
10173
0
                for (unsigned n=0; n < number_of_assistance_information_fields; n++) {
10174
                    /* Assistance Information Type */
10175
0
                    proto_tree_add_item(nrup_tree, hf_nrup_assistance_information_type,
10176
0
                                        tvb, offset,1, ENC_BIG_ENDIAN);
10177
0
                    offset++;
10178
                    /* Num octets in assistance info */
10179
0
                    proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_octets_radio_qa_info,
10180
0
                                                 tvb, offset, 1, ENC_BIG_ENDIAN, &num_octets_radio_qa_info);
10181
0
                    offset++;
10182
                    /* Radio Quality Assistance info */
10183
0
                    proto_tree_add_item(nrup_tree, hf_nrup_radio_qa_info, tvb, offset,
10184
0
                                        num_octets_radio_qa_info, ENC_NA);
10185
0
                    offset += num_octets_radio_qa_info;
10186
0
                }
10187
0
            }
10188
10189
            /* UL Delay DU Result */
10190
1
            if (ul_delay_ind) {
10191
0
                proto_tree_add_item(nrup_tree, hf_nrup_ul_delay_du_result, tvb, offset, 4, ENC_BIG_ENDIAN);
10192
0
                offset += 4;
10193
0
            }
10194
            /* DL Delay DU Result */
10195
1
            if (dl_delay_ind) {
10196
0
                proto_tree_add_item(nrup_tree, hf_nrup_dl_delay_du_result, tvb, offset, 4, ENC_BIG_ENDIAN);
10197
0
                offset += 4;
10198
0
            }
10199
1
            break;
10200
0
        }
10201
2
        default:
10202
            /* TODO: expert info error for unexpected PDU type? */
10203
2
            break;
10204
6
    }
10205
10206
6
    return offset;
10207
6
}
10208
10209
/* TS 38.425 */
10210
static void
10211
addRANContParameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
10212
6
{
10213
6
    tvbuff_t *next_tvb = tvb_new_subset_length(tvb, offset, length);
10214
6
    call_dissector(nrup_handle, next_tvb, pinfo, tree);
10215
6
}
10216
10217
static void
10218
dissect_gtp_tpdu_by_handle(dissector_handle_t handle, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset)
10219
0
{
10220
0
    tvbuff_t        *next_tvb;
10221
0
    next_tvb = tvb_new_subset_remaining(tvb, offset);
10222
0
    call_dissector(handle, next_tvb, pinfo, tree);
10223
0
    col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP/");
10224
0
}
10225
10226
static void
10227
dissect_gtp_tpdu_as_pdcp_lte_info(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t *gtp_hdr, int offset)
10228
0
{
10229
    /* Check if we have info to call the PDCP dissector */
10230
0
    struct pdcp_lte_info *p_pdcp_info;
10231
0
    uat_pdcp_lte_keys_record_t * found_record;
10232
0
    tvbuff_t *pdcp_lte_tvb;
10233
10234
0
    if ((found_record = look_up_pdcp_lte_keys_record(pinfo, (uint32_t)gtp_hdr->teid))) {
10235
        /* Look for attached packet info! */
10236
0
        p_pdcp_info = (struct pdcp_lte_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0);
10237
        /* If we don't have the data, add it */
10238
0
        if (p_pdcp_info == NULL) {
10239
0
            p_pdcp_info = wmem_new0(wmem_file_scope(), pdcp_lte_info);
10240
            /* Channel info is needed for RRC parsing */
10241
0
            p_pdcp_info->direction = found_record->direction;
10242
0
            p_pdcp_info->ueid = found_record->ue_id;
10243
0
            p_pdcp_info->channelType = Channel_DCCH;
10244
0
            p_pdcp_info->channelId = found_record->rb_id;
10245
            /*p_pdcp_info->BCCHTransport;*/
10246
10247
            /* Details of PDCP header */
10248
0
            if (found_record->header_present == PDCP_LTE_HEADER_PRESENT) {
10249
0
                p_pdcp_info->no_header_pdu = false;
10250
0
            } else {
10251
0
                p_pdcp_info->no_header_pdu = true;
10252
0
            }
10253
0
            p_pdcp_info->plane = found_record->plane;
10254
0
            p_pdcp_info->seqnum_length = found_record->lte_sn_length;
10255
10256
            /* RoHC settings */
10257
0
            p_pdcp_info->rohc.rohc_compression = found_record->rohc_compression;
10258
0
            p_pdcp_info->rohc.rohc_ip_version = 4; /* For now set it explicitly */
10259
0
            p_pdcp_info->rohc.cid_inclusion_info = false;
10260
0
            p_pdcp_info->rohc.large_cid_present = false;
10261
0
            p_pdcp_info->rohc.mode = MODE_NOT_SET;
10262
0
            p_pdcp_info->rohc.rnd = false;
10263
0
            p_pdcp_info->rohc.udp_checksum_present = false;
10264
0
            p_pdcp_info->rohc.profile = found_record->rohc_profile;
10265
10266
            /* p_pdcp_info->is_retx;*/
10267
10268
            /* Used by heuristic dissector only */
10269
            /*p_pdcp_info->pdu_length;*/
10270
0
            p_add_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0, p_pdcp_info);
10271
0
        }
10272
0
        pdcp_lte_tvb = tvb_new_subset_remaining(tvb, offset);
10273
0
        call_dissector(pdcp_lte_handle, pdcp_lte_tvb, pinfo, tree);
10274
10275
0
    } else {
10276
0
        proto_tree_add_subtree(tree, tvb, offset, -1, ett_gtp_pdcp_no_conf, NULL, "[No PDCP-LTE Configuration data found]");
10277
0
        proto_tree_add_item(tree, hf_pdcp_cont, tvb, offset, -1, ENC_NA);
10278
0
    }
10279
0
}
10280
10281
static void
10282
dissect_gtp_tpsu_as_pdcp_nr_info(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t *gtp_hdr, int offset)
10283
0
{
10284
    /*NR-U DUD or DDDS PDU
10285
    * This is NR-U DUD/DDDS PDU. It contains PDCP
10286
    * payload as per 3GPP TS 38.323
10287
    */
10288
    /* Check if we have info to call the PDCP dissector */
10289
0
    uat_pdcp_nr_keys_record_t* found_record;
10290
10291
0
    if ((found_record = look_up_pdcp_nr_keys_record(pinfo, (uint32_t)gtp_hdr->teid))) {
10292
0
        tvbuff_t *pdcp_tvb;
10293
0
        struct pdcp_nr_info temp_data;
10294
10295
0
        pdcp_tvb = tvb_new_subset_remaining(tvb, offset);
10296
10297
        /* Fill in pdcp_nr_info */
10298
0
        temp_data.direction = found_record->direction;
10299
0
        temp_data.bearerType = Bearer_DCCH;  /* always */
10300
        /* Want to use same ueid as other PDCP config.. */
10301
0
        temp_data.ueid = found_record->ue_id;
10302
        /* Get this from table, may also be available from F1AP signalling... */
10303
0
        temp_data.bearerId = found_record->rb_id;
10304
10305
        /* Details of PDCP header */
10306
0
        temp_data.plane = found_record->plane;
10307
0
        temp_data.seqnum_length = found_record->pdcp_nr_sn_length;
10308
        /* PDCP_NR_(U|D)L_sdap_hdr_PRESENT bitmask */
10309
0
        if (found_record->sdap_header_present == PDCP_NR_SDAP_HEADER_PRESENT) {
10310
0
            if (temp_data.direction == PDCP_NR_DIRECTION_UPLINK) {
10311
0
                temp_data.sdap_header = PDCP_NR_UL_SDAP_HEADER_PRESENT;
10312
0
            } else {
10313
0
                temp_data.sdap_header = PDCP_NR_DL_SDAP_HEADER_PRESENT;
10314
0
            }
10315
0
        } else {
10316
0
            temp_data.sdap_header = 0;
10317
0
        }
10318
        /* Integrity MAC present? */
10319
0
        temp_data.maci_present = found_record->mac_i_present;
10320
10321
        /* RoHC settings */
10322
0
        temp_data.rohc.rohc_compression = found_record->rohc_compression;
10323
0
        temp_data.rohc.rohc_ip_version = 4; /* For now set it explicitly */
10324
0
        temp_data.rohc.cid_inclusion_info = false;
10325
0
        temp_data.rohc.large_cid_present = false;
10326
0
        temp_data.rohc.mode = MODE_NOT_SET;
10327
0
        temp_data.rohc.rnd = false;
10328
0
        temp_data.rohc.udp_checksum_present = false;
10329
0
        temp_data.rohc.profile = found_record->rohc_profile;
10330
10331
0
        temp_data.is_retx = 0;
10332
10333
        /* Used by heuristic dissector only */
10334
0
        temp_data.pdu_length = 0;
10335
10336
0
        call_dissector_with_data(pdcp_nr_handle, pdcp_tvb, pinfo, tree, &temp_data);
10337
0
    } else {
10338
0
        proto_tree_add_subtree(tree, tvb, offset, -1, ett_gtp_pdcp_no_conf, NULL, "[No PDCP-NR Configuration data found]");
10339
0
        proto_tree_add_item(tree, hf_pdcp_cont, tvb, offset, -1, ENC_NA);
10340
0
    }
10341
0
}
10342
10343
static int
10344
dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
10345
2.07k
{
10346
2.07k
    uint8_t          octet;
10347
2.07k
    gtp_hdr_t       *gtp_hdr = NULL;
10348
2.07k
    proto_tree      *gtp_tree = NULL, *ext_tree;
10349
2.07k
    proto_tree      *ran_cont_tree = NULL;
10350
2.07k
    proto_item      *ti = NULL, *tf, *ext_hdr_len_item, *message_item;
10351
2.07k
    int              i, offset = 0, checked_field, mandatory;
10352
2.07k
    bool             gtp_prime, has_SN;
10353
2.07k
    unsigned         seq_no           = 0;
10354
2.07k
    unsigned         flow_label       = 0;
10355
2.07k
    unsigned         pdu_no, next_hdr = 0;
10356
2.07k
    uint8_t          ext_hdr_val;
10357
2.07k
    unsigned         ext_hdr_length;
10358
2.07k
    uint32_t         ext_hdr_pdcpsn, value;
10359
2.07k
    char            *tid_str;
10360
2.07k
    uint8_t          acfield_len      = 0;
10361
2.07k
    gtp_msg_hash_t  *gcrp             = NULL;
10362
2.07k
    gtp_conv_info_t *gtp_info;
10363
2.07k
    session_args_t  *args             = NULL;
10364
2.07k
    ie_decoder      *decoder          = NULL;
10365
10366
    /* Do we have enough bytes for the version and message type? */
10367
2.07k
    if (!tvb_bytes_exist(tvb, 0, 2)) {
10368
        /* No - reject the packet. */
10369
1
        return 0;
10370
1
    }
10371
2.06k
    octet = tvb_get_uint8(tvb, 0);
10372
2.06k
    if (((octet >> 5) & 0x07) > 2) {
10373
        /* Version > 2; reject the packet */
10374
15
        return 0;
10375
15
    }
10376
2.05k
    octet = tvb_get_uint8(tvb, 1);
10377
2.05k
    if (octet == GTP_MSG_UNKNOWN || try_val_to_str(octet, gtp_message_type) == NULL) {
10378
        /* Unknown message type; reject the packet */
10379
72
        return 0;
10380
72
    }
10381
10382
    /* Setting everything to 0, so that the TEID is 0 for GTP version 0
10383
     * The magic number should perhaps be replaced.
10384
     */
10385
1.98k
    gtp_hdr = wmem_new0(pinfo->pool, gtp_hdr_t);
10386
10387
    /* Setting the TEID to -1 to say that the TEID is not valid for this packet */
10388
1.98k
    gtp_hdr->teid = -1;
10389
10390
1.98k
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
10391
1.98k
    col_clear(pinfo->cinfo, COL_INFO);
10392
10393
1.98k
    if (g_gtp_session) {
10394
0
        args = wmem_new0(pinfo->pool, session_args_t);
10395
0
        args->last_cause = 128;                                         /* It stores the last cause decoded. Cause accepted by default */
10396
        /* We create the auxiliary lists */
10397
0
        args->teid_list = wmem_list_new(pinfo->pool);
10398
0
        args->ip_list = wmem_list_new(pinfo->pool);
10399
0
    }
10400
10401
1.98k
    gtp_info = find_or_create_gtp_conv_info(pinfo, NULL);
10402
10403
1.98k
    gtp_hdr->flags = tvb_get_uint8(tvb, offset);
10404
10405
1.98k
    if (!(gtp_hdr->flags & 0x10)){
10406
334
        gtp_prime = true;
10407
1.64k
    }else{
10408
1.64k
        gtp_prime = false;
10409
1.64k
    }
10410
10411
1.98k
    switch ((gtp_hdr->flags >> 5) & 0x07) {
10412
676
        case 0:
10413
676
            gtp_version = 0;
10414
676
            break;
10415
437
        case 1:
10416
437
            gtp_version = 1;
10417
437
            break;
10418
869
        default:
10419
869
            gtp_version = 1;
10420
869
            break;
10421
1.98k
    }
10422
1.98k
    if (tree) {
10423
1.98k
        if (gtp_prime) {
10424
334
            static int * const gtp_prime_flags[] = {
10425
334
                &hf_gtp_prime_flags_ver,
10426
334
                &hf_gtp_flags_pt,
10427
334
                &hf_gtp_flags_spare1,
10428
334
                NULL
10429
334
            };
10430
334
            static int * const gtp_prime_v0_flags[] = {
10431
334
                &hf_gtp_prime_flags_ver,
10432
334
                &hf_gtp_flags_pt,
10433
334
                &hf_gtp_flags_spare1,
10434
334
                &hf_gtp_flags_hdr_length,
10435
334
                NULL
10436
334
            };
10437
10438
334
            ti = proto_tree_add_item(tree, proto_gtpprime, tvb, 0, -1, ENC_NA);
10439
334
            gtp_tree = proto_item_add_subtree(ti, ett_gtp);
10440
10441
            /* Octet  8    7    6    5    4    3    2    1
10442
             * 1      Version   | PT| Spare '1 1 1 '| ' 0/1 '
10443
             */
10444
10445
             /* Bit 1 of octet 1 is not used in GTP' (except in v0), and it is marked '0'
10446
              * in the GTP' header. It is in use in GTP' v0 and distinguishes the used header-length.
10447
              * In the case of GTP' v0, this bit being marked one (1) indicates the usage of the 6
10448
              * octets header. If the bit is set to '0' (usually the case) the 20-octet header is used.
10449
              * For all other versions of GTP', this bit is not used and is set to '0'. However,
10450
              * this does not suggest the use of the 20-octet header, rather a shorter 6-octet header.
10451
              */
10452
334
            if (gtp_version == 0) {
10453
276
                proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10454
276
                    ett_gtp_flags, gtp_prime_v0_flags, gtp_hdr->flags, BMT_NO_APPEND);
10455
276
            } else {
10456
58
                proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10457
58
                    ett_gtp_flags, gtp_prime_flags, gtp_hdr->flags, BMT_NO_APPEND);
10458
58
            }
10459
1.64k
        } else {
10460
1.64k
            static int * const gtp_flags[] = {
10461
1.64k
                &hf_gtp_flags_ver,
10462
1.64k
                &hf_gtp_flags_pt,
10463
1.64k
                &hf_gtp_flags_spare2,
10464
1.64k
                &hf_gtp_flags_e,
10465
1.64k
                &hf_gtp_flags_s,
10466
1.64k
                &hf_gtp_flags_pn,
10467
1.64k
                NULL
10468
1.64k
            };
10469
1.64k
            static int * const gtp_v0_flags[] = {
10470
1.64k
                &hf_gtp_flags_ver,
10471
1.64k
                &hf_gtp_flags_pt,
10472
1.64k
                &hf_gtp_flags_spare1,
10473
1.64k
                &hf_gtp_flags_snn,
10474
1.64k
                NULL
10475
1.64k
            };
10476
1.64k
            ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, ENC_NA);
10477
1.64k
            gtp_tree = proto_item_add_subtree(ti, ett_gtp);
10478
10479
1.64k
            if (gtp_version == 0) {
10480
400
                proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10481
400
                    ett_gtp_flags, gtp_v0_flags, gtp_hdr->flags, BMT_NO_APPEND);
10482
1.24k
            } else {
10483
1.24k
                proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10484
1.24k
                    ett_gtp_flags, gtp_flags, gtp_hdr->flags, BMT_NO_APPEND);
10485
1.24k
            }
10486
1.64k
        }
10487
1.98k
    }
10488
1.98k
    offset++;
10489
10490
1.98k
    gtp_hdr->message = tvb_get_uint8(tvb, offset);
10491
    /* Link direction is needed to properly dissect PCO */
10492
1.98k
    switch(gtp_hdr->message){
10493
11
        case GTP_MSG_DELETE_PDP_REQ:
10494
53
        case GTP_MSG_UPDATE_PDP_REQ:
10495
68
        case GTP_MSG_CREATE_PDP_REQ:
10496
113
        case GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ:
10497
117
        case GTP_MSG_PDU_NOTIFY_REQ:
10498
169
        case GTP_MSG_PDU_NOTIFY_REJ_REQ:
10499
225
        case GTP_MSG_FORW_RELOC_REQ: /* direction added for UTRAN Container & BSS Container decode */
10500
225
            pinfo->link_dir = P2P_DIR_UL;
10501
225
            break;
10502
715
        case GTP_MSG_DELETE_PDP_RESP:
10503
762
        case GTP_MSG_UPDATE_PDP_RESP:
10504
797
        case GTP_MSG_CREATE_PDP_RESP:
10505
915
        case GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP:
10506
1.13k
        case GTP_MSG_FORW_RELOC_RESP: /* direction added for UTRAN Container & BSS Container decode */
10507
1.13k
            pinfo->link_dir = P2P_DIR_DL;
10508
1.13k
            break;
10509
618
    default:
10510
618
        break;
10511
1.98k
    }
10512
1.98k
    col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(gtp_hdr->message, &gtp_message_type_ext, "Unknown"));
10513
1.98k
    message_item = proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, offset, 1, gtp_hdr->message);
10514
1.98k
    offset++;
10515
10516
1.98k
    proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, ENC_BIG_ENDIAN, &gtp_hdr->length);
10517
1.98k
    offset += 2;
10518
10519
    /* We initialize the sequence number*/
10520
1.98k
    has_SN = false;
10521
1.98k
    if (gtp_prime) {
10522
334
        has_SN = true;
10523
334
        proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10524
334
        offset += 2;
10525
        /* If GTP' version is 0 and bit 1 is 0 20 bytes header is used, dissect it */
10526
334
        if( (gtp_version == 0) && ((gtp_hdr->flags & 0x01) == 0) ) {
10527
241
            proto_tree_add_item(gtp_tree, hf_gtp_dummy_octets, tvb, offset, 14, ENC_NA);
10528
241
            offset += 14;
10529
241
        }
10530
10531
334
        set_actual_length(tvb, offset + gtp_hdr->length);
10532
1.64k
    } else {
10533
1.64k
        switch (gtp_version) {
10534
400
        case 0:
10535
400
            has_SN = true;
10536
400
            proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10537
400
            offset += 2;
10538
10539
400
            proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, ENC_BIG_ENDIAN, &flow_label);
10540
400
            offset += 2;
10541
10542
400
            proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, ENC_NA, &pdu_no);
10543
400
            offset += 4;
10544
10545
400
            tid_str = id_to_str(tvb, offset);
10546
400
            proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
10547
400
            offset += 8;
10548
10549
400
            set_actual_length(tvb, offset + gtp_hdr->length);
10550
10551
400
            break;
10552
1.24k
        case 1:
10553
1.24k
            proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_teid, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
10554
1.24k
            gtp_hdr->teid = value;
10555
1.24k
            offset += 4;
10556
10557
1.24k
            set_actual_length(tvb, offset + gtp_hdr->length);
10558
10559
            /* Are sequence number/N-PDU Number/extension header present?
10560
               See NOTE 5 of Figure 2 of 3GPP TS 29.060 version 4.3.0
10561
               Release 4 - the Sequence Number, N-PDU Number, and
10562
               Next Extension Header fields are present if any of
10563
               GTP_E_MASK, GTP_S_MASK, or GTP_PN_MASK are set. */
10564
1.24k
            if (gtp_hdr->flags & (GTP_E_MASK|GTP_S_MASK|GTP_PN_MASK)) {
10565
                /* Those fields are only *interpreted* if the
10566
                   particular flag for the field is set. */
10567
1.16k
                if (gtp_hdr->flags & GTP_S_MASK) {
10568
311
                    has_SN = true;
10569
311
                    proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10570
311
                }
10571
1.16k
                offset += 2;
10572
10573
1.16k
                if (gtp_hdr->flags & GTP_PN_MASK) {
10574
885
                    proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, ENC_NA, &pdu_no);
10575
885
                }
10576
1.16k
                offset++;
10577
10578
1.16k
                if (gtp_hdr->flags & GTP_E_MASK) {
10579
38
                    proto_item* hdr_ext_item;
10580
38
                    hdr_ext_item = proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, ENC_NA, &next_hdr);
10581
38
                    offset++;
10582
                    /* Add each extension header found. */
10583
103
                    while (next_hdr != 0) {
10584
68
                        tf = proto_tree_add_item(gtp_tree, hf_gtp_ext_hdr, tvb, offset, 0, ENC_NA);
10585
68
                        ext_tree = proto_item_add_subtree(tf, ett_gtp_ext_hdr);
10586
68
                        ext_hdr_len_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_length, tvb, offset, 1, ENC_NA, &ext_hdr_length);
10587
68
                        proto_item_set_len(tf, ext_hdr_length * 4);
10588
68
                        if (ext_hdr_length == 0) {
10589
2
                            expert_add_info_format(pinfo, ext_hdr_len_item, &ei_gtp_ext_length_mal,
10590
2
                                                   "Extension header length is zero");
10591
2
                            return tvb_reported_length(tvb);
10592
2
                        }
10593
66
                        offset++;
10594
66
                        proto_item_append_text(tf, " (%s)", val_to_str_const(next_hdr, next_extension_header_fieldvals, "Unknown"));
10595
10596
66
                        switch (next_hdr) {
10597
10598
0
                        case GTP_EXT_HDR_UDP_PORT:
10599
                            /* UDP Port
10600
                             * 3GPP 29.281 v9.0.0, 5.2.2.1 UDP Port
10601
                             * "This extension header may be transmitted in
10602
                             * Error Indication messages to provide the UDP
10603
                             * Source Port of the G-PDU that triggered the
10604
                             * Error Indication. It is 4 octets long, and
10605
                             * therefore the Length field has value 1"
10606
                             */
10607
0
                            if (ext_hdr_length == 1) {
10608
                                /* UDP Port of source */
10609
0
                                proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_udp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
10610
0
                            } else {
10611
                                /* Bad length */
10612
0
                                expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the UDP Port Extension header should be 1.");
10613
0
                            }
10614
0
                            break;
10615
10616
4
                        case GTP_EXT_HDR_RAN_CONT:
10617
                            /* RAN Container
10618
                             * 3GPP 29.281 v15.2.0, 5.2.2.4 RAN Container
10619
                             * This extension header may be transmitted in
10620
                             * a G-PDU over the X2 user plane interface
10621
                             * between the eNBs. The RAN Container has a
10622
                             * variable length and its content is specified
10623
                             * in 3GPP TS 36.425 [25]. A G-PDU message with
10624
                             * this extension header may be sent without a T-PDU.
10625
                             */
10626
4
                            proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_ran_cont, tvb, offset, (4*ext_hdr_length)-1, ENC_NA);
10627
4
                            break;
10628
10629
2
                        case GTP_EXT_HDR_LONG_PDCP_PDU:
10630
                            /* Long PDCP PDU Number
10631
                             * 3GPP 29.281 v15.2.0, 5.2.2.2A Long PDCP PDU Number
10632
                             * This extension header is used for direct X2 or
10633
                             * indirect S1 DL data forwarding during a Handover
10634
                             * procedure between two eNBs. The Long PDCP PDU number
10635
                             * extension header is 8 octets long, and therefore
10636
                             * the Length field has value 2.
10637
                             * The PDCP PDU number field of the Long PDCP PDU number
10638
                             * extension header has a maximum value which requires 18
10639
                             * bits (see 3GPP TS 36.323 [24]). Bit 2 of octet 2 is
10640
                             * the most significant bit and bit 1 of octet 4 is the
10641
                             * least significant bit, see Figure 5.2.2.2A-1. Bits 8 to
10642
                             * 3 of octet 2, and Bits 8 to 1 of octets 5 to 7 shall be
10643
                             * set to 0.
10644
                             * NOTE: A G-PDU which includes a PDCP PDU Number contains
10645
                             * either the extension header PDCP PDU Number or Long PDCP
10646
                             * PDU Number.
10647
                             */
10648
2
                            if (ext_hdr_length == 2) {
10649
0
                                proto_tree_add_bits_item(ext_tree, hf_gtp_ext_hdr_spare_bits, tvb, offset<<3, 6, ENC_BIG_ENDIAN);
10650
0
                                proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_long_pdcp_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10651
0
                                proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_spare_bytes, tvb, offset+3, 3, ENC_NA);
10652
2
                            } else {
10653
2
                                expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the Long PDCP SN Extension header should be 2.");
10654
2
                            }
10655
2
                            break;
10656
10657
0
                        case GTP_EXT_HDR_XW_RAN_CONT:
10658
                            /* Xw RAN Container
10659
                             * 3GPP 29.281 v15.2.0, 5.2.2.5 Xw RAN Container
10660
                             * This extension header may be transmitted in a
10661
                             * G-PDU over the Xw user plane interface between
10662
                             * the eNB and the WLAN Termination (WT). The Xw
10663
                             * RAN Container has a variable length and its
10664
                             * content is specified in 3GPP TS 36.464 [27].
10665
                             * A G-PDU message with this extension header may
10666
                             * be sent without a T-PDU.
10667
                             */
10668
0
                            proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_xw_ran_cont, tvb, offset, (4*ext_hdr_length)-1, ENC_NA);
10669
0
                            break;
10670
10671
6
                        case GTP_EXT_HDR_NR_RAN_CONT:
10672
                            /* NR RAN Container
10673
                             * 3GPP 29.281 v15.2.0, 5.2.2.6 NR RAN Container
10674
                             * This extension header may be transmitted in a
10675
                             * G-PDU over the X2-U, Xn-U and F1-U user plane
10676
                             * interfaces, within NG-RAN and, for EN-DC, within
10677
                             * E-UTRAN. The NR RAN Container has a variable
10678
                             * length and its content is specified in 3GPP TS
10679
                             * 38.425 [30]. A G-PDU message with this extension
10680
                             * header may be sent without a T-PDU.
10681
                             */
10682
6
                            ran_cont_tree = proto_tree_add_subtree(ext_tree, tvb, offset, (ext_hdr_length * 4) - 1, ett_gtp_nr_ran_cont, NULL, "NR RAN Container");
10683
6
                            addRANContParameter(tvb, pinfo, ran_cont_tree, offset, (ext_hdr_length * 4) - 1);
10684
6
                            break;
10685
10686
1
                        case GTP_EXT_HDR_PDU_SESSION_CONT:
10687
1
                            {
10688
                                /* PDU Session Container
10689
                                 * 3GPP 29.281 v15.2.0, 5.2.2.7 PDU Session Container
10690
                                 * This extension header may be transmitted in a G-PDU
10691
                                 * over the N3 and N9 user plane interfaces, between
10692
                                 * NG-RAN and UPF, or between two UPFs. The PDU Session
10693
                                 * Container has a variable length and its content is
10694
                                 * specified in 3GPP TS 38.415 [31].
10695
                                 */
10696
1
                                static int * const flags1_dl[] = {
10697
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
10698
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_snp_dl,
10699
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_msnp,
10700
1
                                    &hf_gtp_spare_b0,
10701
1
                                    NULL
10702
1
                                };
10703
1
                                static int * const flags1_ul[] = {
10704
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
10705
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind,
10706
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind,
10707
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_snp_ul,
10708
1
                                    NULL
10709
1
                                };
10710
1
                                static int * const flags2[] = {
10711
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_ppp,
10712
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_rqi,
10713
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
10714
1
                                    NULL
10715
1
                                };
10716
1
                                static int * const flags3[] = {
10717
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_ppi,
10718
1
                                    &hf_gtp_spare_b4b0,
10719
1
                                    NULL
10720
1
                                };
10721
1
                                static int * const flags4[] = {
10722
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind,
10723
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag,
10724
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
10725
1
                                    NULL
10726
1
                                };
10727
1
                                static int * const flags5[] = {
10728
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7,
10729
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6,
10730
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5,
10731
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4,
10732
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3,
10733
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2,
10734
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1,
10735
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0,
10736
1
                                    NULL
10737
1
                                };
10738
1
                                static int * const flags6[] = {
10739
1
                                    &hf_gtp_spare_b7b1,
10740
1
                                    &hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind,
10741
1
                                    NULL
10742
1
                                };
10743
10744
1
                                proto_tree *pdu_ses_cont_tree;
10745
1
                                uint32_t pdu_type;
10746
1
                                uint64_t flags1_val, flags2_val, flags4_val, flags5_val;
10747
1
                                int curr_offset = offset;
10748
10749
1
                                pdu_ses_cont_tree = proto_tree_add_subtree(ext_tree, tvb, curr_offset, (ext_hdr_length * 4) - 1, ett_pdu_session_cont, NULL, "PDU Session Container");
10750
1
                                proto_tree_add_item_ret_uint(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_pdu_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &pdu_type);
10751
1
                                switch (pdu_type) {
10752
1
                                case 0:
10753
                                    /* PDU Type: DL PDU SESSION INFORMATION (0) */
10754
                                    /* PDU Type    QMP    SNP    MSNP    Spare */
10755
1
                                    proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags1_dl, ENC_BIG_ENDIAN, &flags1_val);
10756
1
                                    curr_offset++;
10757
                                    /* PPP    RQI    QoS Flow Identifier */
10758
1
                                    proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags2, ENC_BIG_ENDIAN, &flags2_val);
10759
1
                                    curr_offset++;
10760
1
                                    if (flags2_val & 0x80) {
10761
                                        /* PPI    Spare */
10762
0
                                        proto_tree_add_bitmask_list(pdu_ses_cont_tree, tvb, curr_offset, 1, flags3, ENC_BIG_ENDIAN);
10763
0
                                        curr_offset++;
10764
0
                                    }
10765
1
                                    if (flags1_val & 0x08) {
10766
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10767
0
                                        curr_offset += 8;
10768
0
                                    }
10769
1
                                    if (flags1_val & 0x04) {
10770
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_qfi_sn, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
10771
0
                                        curr_offset += 3;
10772
0
                                    }
10773
1
                                    if (flags1_val & 0x02) {
10774
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_mbs_qfi_sn, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10775
                                        //curr_offset += 4;
10776
0
                                    }
10777
1
                                    break;
10778
0
                                case 1:
10779
                                    /* PDU Type: UL PDU SESSION INFORMATION (1)*/
10780
                                    /* PDU Type    QMP    DL Delay Ind    UL Delay Ind    SNP */
10781
0
                                    proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags1_ul, ENC_BIG_ENDIAN, &flags1_val);
10782
0
                                    curr_offset++;
10783
                                    /* N3/N9 Delay ind    New IE Flag    QoS Flow Identifier */
10784
0
                                    proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags4, ENC_BIG_ENDIAN, &flags4_val);
10785
0
                                    curr_offset++;
10786
0
                                    if (flags1_val & 0x08) {
10787
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp_repeat, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10788
0
                                        curr_offset += 8;
10789
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_recv_time_stamp, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10790
0
                                        curr_offset += 8;
10791
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_ul_send_time_stamp, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10792
0
                                        curr_offset += 8;
10793
0
                                    }
10794
0
                                    if (flags1_val & 0x04) {
10795
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_result, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10796
0
                                        curr_offset += 4;
10797
0
                                    }
10798
0
                                    if (flags1_val & 0x02) {
10799
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_result, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10800
0
                                        curr_offset += 4;
10801
0
                                    }
10802
0
                                    if (flags1_val & 0x01) {
10803
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_ul_qfi_sn, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
10804
0
                                        curr_offset += 3;
10805
0
                                    }
10806
0
                                    if (flags4_val & 0x80) {
10807
0
                                        proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_result, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10808
0
                                        curr_offset += 4;
10809
0
                                    }
10810
0
                                    if (flags4_val & 0x40) {
10811
0
                                        proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags5, ENC_BIG_ENDIAN, &flags5_val);
10812
0
                                        curr_offset++;
10813
0
                                        if (flags5_val & 0x01) {
10814
0
                                            proto_tree_add_bitmask_list(pdu_ses_cont_tree, tvb, curr_offset, 1, flags6, ENC_BIG_ENDIAN);
10815
                                            //curr_offset++;
10816
0
                                        }
10817
0
                                    }
10818
0
                                    break;
10819
0
                                default:
10820
0
                                    proto_tree_add_expert(pdu_ses_cont_tree, pinfo, &ei_gtp_unknown_pdu_type, tvb, offset, (ext_hdr_length * 4) - 1);
10821
0
                                    break;
10822
1
                                }
10823
1
                            }
10824
1
                            break;
10825
10826
2
                        case GTP_EXT_HDR_PDCP_SN:
10827
                            /* PDCP PDU
10828
                             * 3GPP 29.281 v9.0.0, 5.2.2.2 PDCP PDU Number
10829
                             *
10830
                             * "This extension header is transmitted, for
10831
                             * example in UTRAN, at SRNS relocation time,
10832
                             * to provide the PDCP sequence number of not
10833
                             * yet acknowledged N-PDUs. It is 4 octets long,
10834
                             * and therefore the Length field has value 1.
10835
                             *
10836
                             * When used during a handover procedure between
10837
                             * two eNBs at the X2 interface (direct DL data
10838
                             * forwarding) or via the S1 interface (indirect
10839
                             * DL data forwarding) in E-UTRAN, bit 8 of octet
10840
                             * 2 is spare and shall be set to zero.
10841
                             *
10842
                             * Wireshark Note: TS 29.060 does not define bit
10843
                             * 5-6 as spare, so no check is possible unless
10844
                             * a preference is used.
10845
                             */
10846
                            /* First byte is length (should be 1) */
10847
2
                            if (ext_hdr_length == 1) {
10848
0
                                proto_item* ext_item;
10849
10850
0
                                ext_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_pdcpsn, tvb, offset, 2, ENC_BIG_ENDIAN, &ext_hdr_pdcpsn);
10851
0
                                if (ext_hdr_pdcpsn & 0x8000) {
10852
0
                                    expert_add_info(pinfo, ext_item, &ei_gtp_ext_hdr_pdcpsn);
10853
0
                                }
10854
2
                            } else {
10855
2
                                expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the PDCP SN Extension header should be 1.");
10856
2
                            }
10857
2
                            break;
10858
10859
2
                        case GTP_EXT_HDR_SUSPEND_REQ:
10860
                            /* Suspend Request */
10861
2
                            break;
10862
10863
1
                        case GTP_EXT_HDR_SUSPEND_RESP:
10864
                            /* Suspend Response */
10865
1
                            break;
10866
10867
48
                        default:
10868
48
                            {
10869
48
                                tvbuff_t * ext_hdr_tvb;
10870
48
                                gtp_hdr_ext_info_t gtp_hdr_ext_info;
10871
10872
48
                                gtp_hdr_ext_info.hdr_ext_item = hdr_ext_item;
10873
                                /* NOTE Type and length included in the call */
10874
48
                                ext_hdr_tvb = tvb_new_subset_remaining(tvb, offset - 2);
10875
48
                                dissector_try_uint_with_data(gtp_hdr_ext_dissector_table, next_hdr, ext_hdr_tvb, pinfo, ext_tree, false, &gtp_hdr_ext_info);
10876
48
                                break;
10877
1
                            }
10878
66
                        }
10879
65
                        offset += ext_hdr_length*4 - 2;
10880
65
                        hdr_ext_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, ENC_NA, &next_hdr);
10881
65
                        offset++;
10882
65
                    }
10883
38
                } else
10884
1.12k
                    offset++;
10885
1.16k
            }
10886
1.24k
            break;
10887
1.24k
        default:
10888
0
            break;
10889
1.64k
        }
10890
1.64k
    }
10891
10892
1.95k
    if (gtp_hdr->message != GTP_MSG_TPDU) {
10893
1.92k
        uint8_t version = gtp_version;
10894
        /* GTP' protocol version has different meaning rather GTP.
10895
         * According to 3GPP TS 32.295:
10896
         * - GTP' version 1 is the same as version 0 but has, in addendum, the duplicate CDR prevention
10897
         *   mechanism, introduced in GSM 12.15 version 7.2.1 (1999-07) of the GPRS charging specification.
10898
         * - GTP' version 2 is the same as version 1, but the header is just 6 octets long
10899
         *
10900
         * Decode GTP' versions v1/v2 as v0.
10901
         */
10902
1.92k
        if (gtp_prime) {
10903
321
            version = 0;
10904
321
        }
10905
10906
        /* Dissect IEs */
10907
1.92k
        mandatory = 0;      /* check order of GTP fields against ETSI */
10908
10.6k
        while (tvb_reported_length_remaining(tvb, offset) > 0) {
10909
8.68k
            decoder = NULL;
10910
8.68k
            ext_hdr_val = tvb_get_uint8(tvb, offset);
10911
8.68k
            if (g_gtp_etsi_order) {
10912
0
                checked_field = check_field_presence_and_decoder(version, gtp_hdr->message, ext_hdr_val, &mandatory, &decoder);
10913
0
                switch (checked_field) {
10914
0
                case -2:
10915
0
                    expert_add_info(pinfo, message_item, &ei_gtp_message_not_found);
10916
0
                    break;
10917
0
                case -1:
10918
0
                    expert_add_info(pinfo, message_item, &ei_gtp_field_not_present);
10919
0
                    break;
10920
0
                case 0:
10921
0
                    break;
10922
0
                default:
10923
0
                    expert_add_info_format(pinfo, message_item, &ei_gtp_wrong_next_field, "[WARNING] wrong next field, should be: %s",
10924
0
                                        val_to_str_ext_const(checked_field, &gtp_val_ext, "Unknown extension field"));
10925
0
                    break;
10926
0
                }
10927
0
            }
10928
10929
8.68k
            if (decoder == NULL) {
10930
8.68k
                i = -1;
10931
348k
                while (gtpopt[++i].optcode)
10932
347k
                    if (gtpopt[i].optcode == ext_hdr_val)
10933
8.28k
                        break;
10934
8.68k
                decoder = gtpopt[i].decode;
10935
8.68k
            }
10936
10937
8.68k
            offset = offset + (*decoder) (tvb, offset, pinfo, gtp_tree, args);
10938
8.68k
        }
10939
10940
1.92k
        if (args && !PINFO_FD_VISITED(pinfo)) {
10941
            /* We insert the lists inside the table*/
10942
0
            fill_map(args->teid_list, args->ip_list, pinfo->num);
10943
0
        }
10944
        /* Use sequence number to track Req/Resp pairs except GTP' message "Data Record Transfer Response".
10945
         * For "Data Record Transfer Response" sequence numbers are analysed inside decoder of TLV "Requests Responded".
10946
         */
10947
1.92k
        if (has_SN && gtp_hdr->message != GTP_MSG_DATA_TRANSF_RESP) {
10948
413
            uint8_t cause_aux = 128; /* Cause accepted by default. Only used when args is NULL */
10949
413
            if (args) {
10950
0
                cause_aux = args->last_cause;
10951
0
            }
10952
413
            gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr->message, gtp_info, cause_aux);
10953
            /*pass packet to tap for response time reporting*/
10954
413
            if (gcrp) {
10955
9
                tap_queue_packet(gtp_tap,pinfo,gcrp);
10956
9
            }
10957
413
        }
10958
1.92k
    }
10959
1.95k
    if (args) {
10960
0
        track_gtp_session(tvb, pinfo, gtp_tree, gtp_hdr, args->teid_list, args->ip_list, args->last_teid, args->last_ip);
10961
0
    }
10962
1.95k
    proto_item_set_end(ti, tvb, offset);
10963
10964
1.95k
    if ((gtp_hdr->message == GTP_MSG_TPDU) && (tvb_reported_length_remaining(tvb, offset) > 0)) {
10965
24
        switch (dissect_tpdu_as) {
10966
24
        case GTP_TPDU_AS_TPDU_HEUR: {
10967
24
            heur_dtbl_entry_t *hdtbl_entry;
10968
24
            tvbuff_t *next_tvb = tvb_new_subset_remaining(tvb, offset);
10969
24
            if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) {
10970
1
                col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP/");
10971
23
            } else {
10972
23
                proto_tree_add_item(tree, hf_gtp_tpdu_data, next_tvb, 0, -1, ENC_NA);
10973
23
            }
10974
24
            break;
10975
0
        }
10976
0
        case GTP_TPDU_AS_PDCP_LTE:
10977
0
            dissect_gtp_tpdu_as_pdcp_lte_info(tvb, pinfo, tree, gtp_hdr, offset);
10978
0
            break;
10979
0
        case GTP_TPDU_AS_PDCP_NR:
10980
0
            dissect_gtp_tpsu_as_pdcp_nr_info(tvb, pinfo, tree, gtp_hdr, offset);
10981
0
            break;
10982
0
        case GTP_TPDU_AS_SYNC:
10983
0
            dissect_gtp_tpdu_by_handle(sync_handle, tvb, pinfo, tree, offset + acfield_len);
10984
0
            break;
10985
0
        case GTP_TPDU_AS_ETHERNET:
10986
0
            dissect_gtp_tpdu_by_handle(eth_handle, tvb, pinfo, tree, offset);
10987
0
            break;
10988
0
        case GTP_TPDU_AS_CUSTOM:
10989
            /* Call a custom dissector if available */
10990
0
            if (gtp_tpdu_custom_handle ||
10991
0
                 (gtp_tpdu_custom_handle = find_dissector("gtp_tpdu_custom"))) {
10992
0
                dissect_gtp_tpdu_by_handle(gtp_tpdu_custom_handle, tvb, pinfo, tree, offset);
10993
0
            } else {
10994
0
                proto_tree_add_item(tree, hf_gtp_tpdu_data, tvb, offset, -1, ENC_NA);
10995
0
            }
10996
0
            break;
10997
0
        default:
10998
0
            proto_tree_add_item(tree, hf_gtp_tpdu_data, tvb, offset, -1, ENC_NA);
10999
0
            break;
11000
24
        }
11001
24
    }
11002
11003
1.95k
    tap_queue_packet(gtpv1_tap,pinfo, gtp_hdr);
11004
11005
1.95k
    return tvb_reported_length(tvb);
11006
1.95k
}
11007
11008
static int
11009
dissect_gtpprime(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
11010
                void *private_data _U_)
11011
1.22k
{
11012
1.22k
    return dissect_gtp_common(tvb, pinfo, tree);
11013
1.22k
}
11014
11015
static int
11016
dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
11017
            void *private_data _U_)
11018
1.39k
{
11019
1.39k
    uint8_t version;
11020
11021
    /*
11022
     * Do we have enough data to check the first byte?
11023
     */
11024
1.39k
    if (!tvb_bytes_exist(tvb, 0, 1)) {
11025
        /* No. */
11026
0
        return 0;
11027
0
    }
11028
11029
    /*
11030
     * If this is GTPv2-C call the gtpv2 dissector if present
11031
     * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
11032
     */
11033
1.39k
    version = tvb_get_uint8(tvb,0)>>5;
11034
1.39k
    if (version > 2) {
11035
        /* Unknown version - reject the packet */
11036
18
        return 0;
11037
18
    }
11038
1.37k
    if (version == 2) {
11039
        /* GTPv2-C 3GPP TS 29.274 */
11040
531
        if (gtpv2_handle) {
11041
531
            call_dissector(gtpv2_handle, tvb, pinfo, tree);
11042
531
            return tvb_reported_length(tvb);
11043
531
        }
11044
531
    }
11045
11046
846
    return dissect_gtp_common(tvb, pinfo, tree);
11047
1.37k
}
11048
11049
// Very minimal heuristic dissector for ethernet that recognizes ethernet with a limited
11050
// set of protocols, optionally with a set of vlan tags.
11051
// This dissector is not implemented in the packet-eth.c file as it is too simplistic
11052
// for general purpose.
11053
static bool
11054
dissect_eth_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
11055
24
{
11056
24
    int offset;
11057
24
    uint16_t ethertype;
11058
11059
24
    if (tvb_reported_length(tvb) < 14) {
11060
5
        return false;
11061
5
    }
11062
11063
    // skip both mac-addresses, no information to be gained from them
11064
19
    offset = 12;
11065
11066
19
    ethertype = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
11067
19
    offset += 2;
11068
11069
19
    if (ethertype == ETHERTYPE_QINQ_OLD || ethertype == ETHERTYPE_IEEE_802_1AD)
11070
0
    {
11071
0
        if (tvb_reported_length_remaining(tvb, offset) < 4) {
11072
0
            return false;
11073
0
        }
11074
0
        ethertype = tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN);
11075
0
        if (ethertype != ETHERTYPE_VLAN) {
11076
0
            return false;
11077
0
        }
11078
0
        offset += 4;
11079
0
    }
11080
19
    while (ethertype == ETHERTYPE_VLAN)
11081
0
    {
11082
0
        if (tvb_reported_length_remaining(tvb, offset) < 4) {
11083
0
            return false;
11084
0
        }
11085
0
        ethertype = tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN);
11086
0
        offset += 4;
11087
0
    }
11088
11089
19
    switch (ethertype) {
11090
1
    case ETHERTYPE_IP:
11091
1
    case ETHERTYPE_IPv6:
11092
1
    case ETHERTYPE_ARP:
11093
1
    case ETHERTYPE_PPPOED:
11094
1
    case ETHERTYPE_PPPOES:
11095
1
        call_dissector(eth_handle, tvb, pinfo, tree);
11096
1
        return true;
11097
19
    }
11098
11099
18
    return false;
11100
19
}
11101
11102
static void
11103
gtp_init(void)
11104
14
{
11105
14
    gtp_session_count = 1;
11106
14
}
11107
11108
void
11109
proto_register_gtp(void)
11110
14
{
11111
14
    module_t *gtp_module;
11112
14
    expert_module_t* expert_gtp;
11113
14
    unsigned  i;
11114
14
    unsigned  last_offset;
11115
11116
14
    static hf_register_info hf_gtp[] = {
11117
11118
14
        {&hf_gtp_ie_id,
11119
14
         { "IE Id", "gtp.ie_id",
11120
14
           FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtp_val_ext, 0x0,
11121
14
           NULL, HFILL}
11122
14
        },
11123
14
        {&hf_gtp_response_in,
11124
14
         { "Response In", "gtp.response_in",
11125
14
           FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
11126
14
           "The response to this GTP request is in this frame", HFILL}
11127
14
        },
11128
14
        {&hf_gtp_response_to,
11129
14
         { "Response To", "gtp.response_to",
11130
14
           FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
11131
14
           "This is a response to the GTP request in this frame", HFILL}
11132
14
        },
11133
14
        {&hf_gtp_time,
11134
14
         { "Time", "gtp.time",
11135
14
           FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
11136
14
           "The time between the Request and the Response", HFILL}
11137
14
        },
11138
14
        {&hf_gtp_apn,
11139
14
         { "APN", "gtp.apn",
11140
14
           FT_STRING, BASE_NONE, NULL, 0,
11141
14
           "Access Point Name", HFILL}
11142
14
        },
11143
14
        {&hf_gtp_cause,
11144
14
         { "Cause", "gtp.cause",
11145
14
           FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0,
11146
14
           "Cause of operation", HFILL}
11147
14
        },
11148
14
        {&hf_gtp_chrg_char,
11149
14
         { "Charging characteristics", "gtp.chrg_char",
11150
14
           FT_UINT16, BASE_DEC, NULL, 0,
11151
14
           NULL, HFILL}
11152
14
        },
11153
14
        {&hf_gtp_chrg_char_s,
11154
14
         { "Spare", "gtp.chrg_char_s",
11155
14
           FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S,
11156
14
           NULL, HFILL}
11157
14
        },
11158
14
        {&hf_gtp_chrg_char_n,
11159
14
         { "Normal charging", "gtp.chrg_char_n",
11160
14
           FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N,
11161
14
           NULL, HFILL}
11162
14
        },
11163
14
        {&hf_gtp_chrg_char_p,
11164
14
         { "Prepaid charging", "gtp.chrg_char_p",
11165
14
           FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P,
11166
14
           NULL, HFILL}
11167
14
        },
11168
14
        {&hf_gtp_chrg_char_f,
11169
14
         { "Flat rate charging", "gtp.chrg_char_f",
11170
14
           FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F,
11171
14
           NULL, HFILL}
11172
14
        },
11173
14
        {&hf_gtp_chrg_char_h,
11174
14
         { "Hot billing charging", "gtp.chrg_char_h",
11175
14
           FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H,
11176
14
           NULL, HFILL}
11177
14
        },
11178
14
        {&hf_gtp_chrg_char_r,
11179
14
         { "Reserved", "gtp.chrg_char_r",
11180
14
           FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R,
11181
14
           NULL, HFILL}
11182
14
        },
11183
14
        {&hf_gtp_chrg_id,
11184
14
         { "Charging ID", "gtp.chrg_id",
11185
14
           FT_UINT32, BASE_HEX_DEC, NULL, 0,
11186
14
           NULL, HFILL}
11187
14
        },
11188
14
        {&hf_gtp_chrg_ipv4,
11189
14
         { "CG address IPv4", "gtp.chrg_ipv4",
11190
14
           FT_IPv4, BASE_NONE, NULL, 0,
11191
14
           "Charging Gateway address IPv4", HFILL}
11192
14
        },
11193
14
        {&hf_gtp_chrg_ipv6,
11194
14
         { "CG address IPv6", "gtp.chrg_ipv6",
11195
14
           FT_IPv6, BASE_NONE, NULL, 0,
11196
14
           "Charging Gateway address IPv6", HFILL}
11197
14
        },
11198
14
        {&hf_gtp_ext_flow_label,
11199
14
         { "Flow Label Data I", "gtp.ext_flow_label",
11200
14
           FT_UINT16, BASE_HEX, NULL, 0,
11201
14
           NULL, HFILL}
11202
14
        },
11203
14
        {&hf_gtp_ext_id,
11204
14
         { "Extension identifier", "gtp.ext_id",
11205
14
           FT_UINT16, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0,
11206
14
           "Private Enterprise number", HFILL}
11207
14
        },
11208
14
        {&hf_gtp_ext_val,
11209
14
         { "Extension value", "gtp.ext_val",
11210
14
           FT_BYTES, BASE_NONE, NULL, 0,
11211
14
           NULL, HFILL}
11212
14
        },
11213
14
        {&hf_gtp_flags,
11214
14
         { "Flags", "gtp.flags",
11215
14
           FT_UINT8, BASE_HEX, NULL, 0,
11216
14
           "Ver/PT/Spare...", HFILL}
11217
14
        },
11218
14
        {&hf_gtp_ext_hdr,
11219
14
         { "Extension header", "gtp.ext_hdr",
11220
14
           FT_NONE, BASE_NONE, NULL, 0,
11221
14
           NULL, HFILL}
11222
14
        },
11223
14
        {&hf_gtp_ext_hdr_next,
11224
14
         { "Next extension header type", "gtp.ext_hdr.next",
11225
14
           FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0,
11226
14
           NULL, HFILL}
11227
14
        },
11228
14
        {&hf_gtp_ext_hdr_ran_cont,
11229
14
         { "RAN Container", "gtp.ext_hdr.ran_cont",
11230
14
           FT_BYTES, BASE_NONE, NULL, 0,
11231
14
           NULL, HFILL}
11232
14
        },
11233
14
        {&hf_gtp_ext_hdr_spare_bits,
11234
14
         { "Spare", "gtp.ext_hdr.spare_bits",
11235
14
           FT_UINT8, BASE_HEX, NULL, 0,
11236
14
           NULL, HFILL}
11237
14
        },
11238
14
        {&hf_gtp_ext_hdr_spare_bytes,
11239
14
         { "Spare", "gtp.ext_hdr.spare_bytes",
11240
14
           FT_BYTES, BASE_NONE, NULL, 0,
11241
14
           NULL, HFILL}
11242
14
        },
11243
14
        {&hf_gtp_ext_hdr_long_pdcp_sn,
11244
14
         { "Long PDCP Sequence Number", "gtp.ext_hdr.long_pdcp_sn",
11245
14
           FT_UINT24, BASE_DEC, NULL, 0,
11246
14
           NULL, HFILL}
11247
14
        },
11248
14
        {&hf_gtp_ext_hdr_xw_ran_cont,
11249
14
         { "Xw RAN Container", "gtp.ext_hdr.xw_ran_cont",
11250
14
           FT_BYTES, BASE_NONE, NULL, 0,
11251
14
           NULL, HFILL}
11252
14
        },
11253
11254
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_pdu_type,
11255
14
         { "PDU Type", "gtp.ext_hdr.pdu_ses_con.pdu_type",
11256
14
           FT_UINT8, BASE_DEC, VALS(gtp_ext_hdr_pdu_ses_cont_pdu_type_vals), 0xf0,
11257
14
           NULL, HFILL}
11258
14
        },
11259
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
11260
14
         { "QoS Monitoring Packet", "gtp.ext_hdr.pdu_ses_con.qmp",
11261
14
           FT_BOOLEAN, 8, TFS(&tfs_used_notused), 0x08,
11262
14
           NULL, HFILL}
11263
14
        },
11264
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_snp_dl,
11265
14
         { "Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.snp",
11266
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11267
14
           NULL, HFILL}
11268
14
        },
11269
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_msnp,
11270
14
         { "MBS Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.msnp",
11271
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11272
14
           NULL, HFILL}
11273
14
        },
11274
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_ppp,
11275
14
         { "Paging Policy Presence (PPP)", "gtp.ext_hdr.pdu_ses_cont.ppp",
11276
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11277
14
           NULL, HFILL}
11278
14
        },
11279
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_rqi,
11280
14
         { "Reflective QoS Indicator (RQI)", "gtp.ext_hdr.pdu_ses_cont.rqi",
11281
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11282
14
           NULL, HFILL}
11283
14
        },
11284
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
11285
14
         { "QoS Flow Identifier (QFI)", "gtp.ext_hdr.pdu_ses_con.qos_flow_id",
11286
14
           FT_UINT8, BASE_DEC, NULL, 0x3f,
11287
14
           NULL, HFILL}
11288
14
        },
11289
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_ppi,
11290
14
         { "Paging Policy Indicator (PPI)", "gtp.ext_hdr.pdu_ses_cont.ppi",
11291
14
           FT_UINT8, BASE_DEC, NULL, 0xe0,
11292
14
           NULL, HFILL}
11293
14
        },
11294
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp,
11295
14
         { "DL Sending Time Stamp", "gtp.ext_hdr.pdu_ses_cont.dl_send_time_stamp",
11296
14
           FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11297
14
           NULL, HFILL}
11298
14
        },
11299
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_dl_qfi_sn,
11300
14
         { "DL QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.dl_qfi_sn",
11301
14
           FT_UINT24, BASE_DEC, NULL, 0,
11302
14
           NULL, HFILL}
11303
14
        },
11304
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_dl_mbs_qfi_sn,
11305
14
         { "DL MBS QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.dl_mbs_qfi_sn",
11306
14
           FT_UINT32, BASE_DEC, NULL, 0,
11307
14
           NULL, HFILL}
11308
14
        },
11309
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind,
11310
14
         { "DL Delay Ind", "gtp.ext_hdr.pdu_ses_con.dl_delay_ind",
11311
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11312
14
           NULL, HFILL}
11313
14
        },
11314
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind,
11315
14
         { "UL Delay Ind", "gtp.ext_hdr.pdu_ses_con.ul_delay_ind",
11316
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11317
14
           NULL, HFILL}
11318
14
        },
11319
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_snp_ul,
11320
14
         { "Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.snp",
11321
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
11322
14
           NULL, HFILL}
11323
14
        },
11324
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind,
11325
14
         { "N3/N9 Delay Ind", "gtp.ext_hdr.pdu_ses_con.n3_n9_delay_ind",
11326
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11327
14
           NULL, HFILL}
11328
14
        },
11329
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag,
11330
14
         { "New IE Flag", "gtp.ext_hdr.pdu_ses_con.new_ie_flag",
11331
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11332
14
           NULL, HFILL}
11333
14
        },
11334
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp_repeat,
11335
14
         { "DL Sending Time Stamp Repeated", "gtp.ext_hdr.pdu_ses_cont.dl_send_time_stamp_repeat",
11336
14
           FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11337
14
           NULL, HFILL}
11338
14
        },
11339
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_dl_recv_time_stamp,
11340
14
         { "DL Received Time Stamp", "gtp.ext_hdr.pdu_ses_cont.dl_recv_time_stamp",
11341
14
           FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11342
14
           NULL, HFILL}
11343
14
        },
11344
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_ul_send_time_stamp,
11345
14
         { "UL Sending Time Stamp", "gtp.ext_hdr.pdu_ses_cont.ul_send_time_stamp",
11346
14
           FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11347
14
           NULL, HFILL}
11348
14
        },
11349
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_result,
11350
14
         { "DL Delay Result", "gtp.ext_hdr.pdu_ses_cont.dl_delay_result",
11351
14
           FT_UINT32, BASE_DEC, NULL, 0,
11352
14
           NULL, HFILL}
11353
14
        },
11354
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_result,
11355
14
         { "UL Delay Result", "gtp.ext_hdr.pdu_ses_cont.ul_delay_result",
11356
14
           FT_UINT32, BASE_DEC, NULL, 0,
11357
14
           NULL, HFILL}
11358
14
        },
11359
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_ul_qfi_sn,
11360
14
         { "UL QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.ul_qfi_sn",
11361
14
           FT_UINT24, BASE_DEC, NULL, 0,
11362
14
           NULL, HFILL}
11363
14
        },
11364
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_result,
11365
14
         { "N3/N9 Delay Result", "gtp.ext_hdr.pdu_ses_cont.n3_n9_delay_result",
11366
14
           FT_UINT32, BASE_DEC, NULL, 0,
11367
14
           NULL, HFILL}
11368
14
        },
11369
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7,
11370
14
         { "New IE Flag 7", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_7",
11371
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11372
14
           NULL, HFILL}
11373
14
        },
11374
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6,
11375
14
         { "New IE Flag 6", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_6",
11376
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11377
14
           NULL, HFILL}
11378
14
        },
11379
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5,
11380
14
         { "New IE Flag 5", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_5",
11381
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
11382
14
           NULL, HFILL}
11383
14
        },
11384
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4,
11385
14
         { "New IE Flag 4", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_4",
11386
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
11387
14
           NULL, HFILL}
11388
14
        },
11389
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3,
11390
14
         { "New IE Flag 3", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_3",
11391
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
11392
14
           NULL, HFILL}
11393
14
        },
11394
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2,
11395
14
         { "New IE Flag 2", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_2",
11396
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11397
14
           NULL, HFILL}
11398
14
        },
11399
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1,
11400
14
         { "New IE Flag 1", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_1",
11401
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11402
14
           NULL, HFILL}
11403
14
        },
11404
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0,
11405
14
         { "New IE Flag 0", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_0",
11406
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
11407
14
           NULL, HFILL}
11408
14
        },
11409
14
        { &hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind,
11410
14
         { "D1 UL PDCP Delay Result Ind", "gtp.ext_hdr.pdu_ses_cont.d1_ul_pdcp_delay_result_ind",
11411
14
           FT_BOOLEAN, 8, TFS(&tfs_included_not_included), 0x01,
11412
14
           NULL, HFILL}
11413
14
        },
11414
11415
14
        {&hf_pdcp_cont,
11416
14
         { "PDCP Protocol", "gtp.pdcp",
11417
14
           FT_BYTES, BASE_NONE, NULL, 0,
11418
14
           NULL, HFILL}
11419
14
        },
11420
14
        {&hf_gtp_ext_hdr_pdcpsn,
11421
14
         { "PDCP Sequence Number", "gtp.ext_hdr.pdcp_sn",
11422
14
           FT_UINT16, BASE_DEC, NULL, 0,
11423
14
           NULL, HFILL}
11424
14
        },
11425
14
        {&hf_gtp_ext_hdr_udp_port,
11426
14
         { "UDP Port", "gtp.ext_hdr.udp_port",
11427
14
           FT_UINT16, BASE_DEC, NULL, 0,
11428
14
           NULL, HFILL}
11429
14
        },
11430
14
        {&hf_gtp_ext_hdr_length,
11431
14
         { "Extension Header Length", "gtp.ext_hdr.length",
11432
14
           FT_UINT8, BASE_DEC, NULL, 0,
11433
14
           NULL, HFILL}
11434
14
        },
11435
14
        {&hf_gtp_flags_ver,
11436
14
         { "Version", "gtp.flags.version",
11437
14
           FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
11438
14
           "GTP Version", HFILL}
11439
14
        },
11440
14
        {&hf_gtp_prime_flags_ver,
11441
14
         { "Version", "gtp.prim.flags.version",
11442
14
           FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK,
11443
14
           "GTP' Version", HFILL}
11444
14
        },
11445
14
        {&hf_gtp_flags_pt,
11446
14
         { "Protocol type", "gtp.flags.payload",
11447
14
           FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
11448
14
           NULL, HFILL}
11449
14
        },
11450
14
        {&hf_gtp_flags_spare1,
11451
14
         { "Reserved", "gtp.flags.reserved",
11452
14
           FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
11453
14
           "Reserved (shall be sent as '111' )", HFILL}
11454
14
        },
11455
14
        {&hf_gtp_flags_hdr_length,
11456
14
         { "Header length", "gtp.flags.hdr_length",
11457
14
           FT_BOOLEAN, 8,  TFS(&gtp_hdr_length_vals), 0x01,
11458
14
           NULL, HFILL}
11459
14
        },
11460
14
        {&hf_gtp_flags_snn,
11461
14
         { "Is SNDCP N-PDU included?", "gtp.flags.snn",
11462
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_SNN_MASK,
11463
14
           "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}
11464
14
        },
11465
14
        {&hf_gtp_flags_spare2,
11466
14
         { "Reserved", "gtp.flags.reserved",
11467
14
           FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK,
11468
14
           "Reserved (shall be sent as '1' )", HFILL}
11469
14
        },
11470
14
        {&hf_gtp_flags_e,
11471
14
         { "Is Next Extension Header present?", "gtp.flags.e",
11472
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_E_MASK,
11473
14
           "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}
11474
14
        },
11475
14
        {&hf_gtp_flags_s,
11476
14
         { "Is Sequence Number present?", "gtp.flags.s",
11477
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_S_MASK,
11478
14
           "Is Sequence Number present? (1 = yes, 0 = no)", HFILL}
11479
14
        },
11480
14
        {&hf_gtp_flags_pn,
11481
14
         { "Is N-PDU number present?", "gtp.flags.pn",
11482
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_PN_MASK,
11483
14
           "Is N-PDU number present? (1 = yes, 0 = no)", HFILL}
11484
14
        },
11485
14
        {&hf_gtp_flow_ii,
11486
14
         { "Flow Label Data II", "gtp.flow_ii",
11487
14
           FT_UINT16, BASE_DEC, NULL, 0,
11488
14
           "Downlink flow label data", HFILL}
11489
14
        },
11490
14
        {&hf_gtp_flow_label,
11491
14
         { "Flow label", "gtp.flow_label",
11492
14
           FT_UINT16, BASE_HEX, NULL, 0,
11493
14
           NULL, HFILL}
11494
14
        },
11495
14
        {&hf_gtp_flow_sig,
11496
14
         { "Flow label Signalling", "gtp.flow_sig",
11497
14
           FT_UINT16, BASE_HEX, NULL, 0,
11498
14
           NULL, HFILL}
11499
14
        },
11500
14
        {&hf_gtp_gsn_addr_len,
11501
14
         { "GSN Address Length", "gtp.gsn_addr_len",
11502
14
           FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK,
11503
14
           NULL, HFILL}
11504
14
        },
11505
14
        {&hf_gtp_gsn_addr_type,
11506
14
         { "GSN Address Type", "gtp.gsn_addr_type",
11507
14
           FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK,
11508
14
           NULL, HFILL}
11509
14
        },
11510
14
        {&hf_gtp_gsn_ipv4,
11511
14
         { "GSN address IPv4", "gtp.gsn_ipv4",
11512
14
           FT_IPv4, BASE_NONE, NULL, 0,
11513
14
           NULL, HFILL}
11514
14
        },
11515
14
        {&hf_gtp_gsn_ipv6,
11516
14
         { "GSN address IPv6", "gtp.gsn_ipv6",
11517
14
           FT_IPv6, BASE_NONE, NULL, 0,
11518
14
           NULL, HFILL}
11519
14
        },
11520
14
        {&hf_gtp_length,
11521
14
         { "Length", "gtp.length",
11522
14
           FT_UINT16, BASE_DEC, NULL, 0,
11523
14
           "Length (i.e. number of octets after TID or TEID)", HFILL}
11524
14
        },
11525
14
        {&hf_gtp_map_cause,
11526
14
         { "MAP cause", "gtp.map_cause",
11527
14
           FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0,
11528
14
           NULL, HFILL}
11529
14
        },
11530
14
        {&hf_gtp_message_type,
11531
14
         { "Message Type", "gtp.message",
11532
14
           FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gtp_message_type_ext, 0x0,
11533
14
           "GTP Message Type", HFILL}
11534
14
        },
11535
14
        {&hf_gtp_ms_reason,
11536
14
         { "MS not reachable reason", "gtp.ms_reason",
11537
14
           FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0,
11538
14
           NULL, HFILL}
11539
14
        },
11540
14
        {&hf_gtp_ms_valid,
11541
14
         { "MS validated", "gtp.ms_valid",
11542
14
           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11543
14
           NULL, HFILL}
11544
14
        },
11545
14
        {&hf_gtp_node_ipv4,
11546
14
         { "Node address IPv4", "gtp.node_ipv4",
11547
14
           FT_IPv4, BASE_NONE, NULL, 0,
11548
14
           "Recommended node address IPv4", HFILL}
11549
14
        },
11550
14
        {&hf_gtp_node_ipv6,
11551
14
         { "Node address IPv6", "gtp.node_ipv6",
11552
14
           FT_IPv6, BASE_NONE, NULL, 0,
11553
14
           "Recommended node address IPv6", HFILL}
11554
14
        },
11555
14
        {&hf_gtp_node_name,
11556
14
         { "Node name", "gtp.node_name",
11557
14
           FT_UINT_STRING, BASE_NONE, NULL, 0,
11558
14
           "Diameter Identity of the node", HFILL}
11559
14
        },
11560
14
        {&hf_gtp_node_realm,
11561
14
         { "Node realm", "gtp.node_realm",
11562
14
           FT_UINT_STRING, BASE_NONE, NULL, 0,
11563
14
           "Diameter Realm Identity of the node", HFILL}
11564
14
        },
11565
14
        {&hf_gtp_npdu_number,
11566
14
         { "N-PDU Number", "gtp.npdu_number",
11567
14
           FT_UINT8, BASE_HEX, NULL, 0,
11568
14
           NULL, HFILL}
11569
14
        },
11570
14
        {&hf_gtp_nsapi,
11571
14
         { "NSAPI", "gtp.nsapi",
11572
14
           FT_UINT8, BASE_DEC, NULL, 0x0f,
11573
14
           "Network layer Service Access Point Identifier", HFILL}
11574
14
        },
11575
14
        {&hf_gtp_qos_version,
11576
14
         { "Version", "gtp.qos_version",
11577
14
           FT_UINT8, BASE_HEX, NULL, 0,
11578
14
           "Version of the QoS Profile", HFILL}
11579
14
        },
11580
14
        {&hf_gtp_qos_spare1,
11581
14
         { "Spare", "gtp.qos_spare1",
11582
14
           FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK,
11583
14
           "Spare (shall be sent as '00' )", HFILL}
11584
14
        },
11585
14
        {&hf_gtp_qos_delay,
11586
14
         { "QoS delay", "gtp.qos_delay",
11587
14
           FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK,
11588
14
           "Quality of Service Delay Class", HFILL}
11589
14
        },
11590
14
        {&hf_gtp_qos_reliability,
11591
14
         { "QoS reliability", "gtp.qos_reliability",
11592
14
           FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
11593
14
           "Quality of Service Reliability Class", HFILL}
11594
14
        },
11595
14
        {&hf_gtp_qos_peak,
11596
14
         { "QoS peak", "gtp.qos_peak",
11597
14
           FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK,
11598
14
           "Quality of Service Peak Throughput", HFILL}
11599
14
        },
11600
14
        {&hf_gtp_qos_spare2,
11601
14
         { "Spare", "gtp.qos_spare2",
11602
14
           FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK,
11603
14
           "Spare (shall be sent as 0)", HFILL}
11604
14
        },
11605
14
        {&hf_gtp_qos_precedence,
11606
14
         { "QoS precedence", "gtp.qos_precedence",
11607
14
           FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
11608
14
           "Quality of Service Precedence Class", HFILL}
11609
14
        },
11610
14
        {&hf_gtp_qos_spare3,
11611
14
         { "Spare", "gtp.qos_spare3",
11612
14
           FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK,
11613
14
           "Spare (shall be sent as '000' )", HFILL}
11614
14
        },
11615
14
        {&hf_gtp_qos_mean,
11616
14
         { "QoS mean", "gtp.qos_mean",
11617
14
           FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_mean_type_ext, GTP_EXT_QOS_MEAN_MASK,
11618
14
           "Quality of Service Mean Throughput", HFILL}
11619
14
        },
11620
14
        {&hf_gtp_qos_al_ret_priority,
11621
14
         { "Allocation/Retention priority", "gtp.qos_al_ret_priority",
11622
14
           FT_UINT8, BASE_DEC, NULL, 0,
11623
14
           NULL, HFILL}
11624
14
        },
11625
14
        {&hf_gtp_qos_traf_class,
11626
14
         { "Traffic class", "gtp.qos_traf_class",
11627
14
           FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK,
11628
14
           NULL, HFILL}
11629
14
        },
11630
14
        {&hf_gtp_qos_del_order,
11631
14
         { "Delivery order", "gtp.qos_del_order",
11632
14
           FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK,
11633
14
           NULL, HFILL}
11634
14
        },
11635
14
        {&hf_gtp_qos_del_err_sdu,
11636
14
         { "Delivery of erroneous SDU", "gtp.qos_del_err_sdu",
11637
14
           FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK,
11638
14
           NULL, HFILL}
11639
14
        },
11640
        /* The SDU size and UL/DL bandwidth items take up one octet in the
11641
         * frame, but are multiplied by various factors before being added
11642
         * to the tree with proto_item_add_uint[_format_value].
11643
         */
11644
14
        {&hf_gtp_qos_max_sdu_size,
11645
14
         { "Maximum SDU size", "gtp.qos_max_sdu_size",
11646
14
           FT_UINT16, BASE_DEC, VALS(qos_max_sdu_size), 0,
11647
14
           NULL, HFILL}
11648
14
        },
11649
14
        {&hf_gtp_qos_max_ul,
11650
14
         { "Maximum bit rate for uplink", "gtp.qos_max_ul",
11651
14
           FT_UINT16, BASE_DEC, VALS(qos_max_ul), 0,
11652
14
           NULL, HFILL}
11653
14
        },
11654
14
        {&hf_gtp_qos_max_dl,
11655
14
         { "Maximum bit rate for downlink", "gtp.qos_max_dl",
11656
14
           FT_UINT16, BASE_DEC, VALS(qos_max_dl), 0,
11657
14
           NULL, HFILL}
11658
14
        },
11659
14
        {&hf_gtp_qos_res_ber,
11660
14
         { "Residual BER", "gtp.qos_res_ber",
11661
14
           FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK,
11662
14
           "Residual Bit Error Rate", HFILL}
11663
14
        },
11664
14
        {&hf_gtp_qos_sdu_err_ratio,
11665
14
         { "SDU Error ratio", "gtp.qos_sdu_err_ratio",
11666
14
           FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK,
11667
14
           NULL,
11668
14
           HFILL}
11669
14
        },
11670
14
        {&hf_gtp_qos_trans_delay,
11671
14
         { "Transfer delay", "gtp.qos_trans_delay",
11672
14
           FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_trans_delay_ext, GTP_EXT_QOS_TRANS_DELAY_MASK,
11673
14
           NULL, HFILL}
11674
14
        },
11675
14
        {&hf_gtp_qos_traf_handl_prio,
11676
14
         { "Traffic handling priority", "gtp.qos_traf_handl_prio",
11677
14
           FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
11678
14
           NULL, HFILL}
11679
14
        },
11680
14
        {&hf_gtp_qos_guar_ul,
11681
14
         { "Guaranteed bit rate for uplink", "gtp.qos_guar_ul",
11682
14
           FT_UINT16, BASE_DEC, VALS(qos_guar_ul), 0,
11683
14
           NULL, HFILL}
11684
14
        },
11685
14
        {&hf_gtp_qos_guar_dl,
11686
14
         { "Guaranteed bit rate for downlink", "gtp.qos_guar_dl",
11687
14
           FT_UINT16, BASE_DEC, VALS(qos_guar_dl), 0,
11688
14
           NULL, HFILL}
11689
14
        },
11690
14
        {&hf_gtp_qos_spare4,
11691
14
         { "Spare", "gtp.qos_spare4",
11692
14
           FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE4_MASK,
11693
14
           "Spare (shall be sent as '000' )", HFILL}
11694
14
        },
11695
14
        {&hf_gtp_qos_sig_ind,
11696
14
         { "Signalling Indication", "gtp.sig_ind",
11697
14
           FT_BOOLEAN, 8, TFS(&gtp_sig_ind), GTP_EXT_QOS_SIG_IND_MASK,
11698
14
           NULL, HFILL}
11699
14
        },
11700
14
        {&hf_gtp_qos_src_stat_desc,
11701
14
         { "Source Statistics Descriptor", "gtp.src_stat_desc",
11702
14
           FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), GTP_EXT_QOS_SRC_STAT_DESC_MASK,
11703
14
           NULL, HFILL}
11704
14
        },
11705
14
        { &hf_gtp_qos_arp,
11706
14
          {"Allocation/Retention Priority", "gtp.qos_arp",
11707
14
          FT_UINT16, BASE_HEX, NULL, 0x0,
11708
14
          NULL, HFILL}
11709
14
        },
11710
14
        { &hf_gtp_qos_arp_pci,
11711
14
          {"Pre-emption Capability (PCI)", "gtp.qos_arp_pci",
11712
14
          FT_BOOLEAN, 16, TFS(&tfs_disabled_enabled), 0x0040,
11713
14
          NULL, HFILL}
11714
14
        },
11715
14
        { &hf_gtp_qos_arp_pl,
11716
14
          {"Priority Level", "gtp.qos_arp_pl",
11717
14
          FT_UINT16, BASE_DEC, NULL, 0x003c,
11718
14
          NULL, HFILL}
11719
14
        },
11720
14
        { &hf_gtp_qos_arp_pvi,
11721
14
          {"Pre-emption Vulnerability (PVI)", "gtp.qos_arp_pvi",
11722
14
          FT_BOOLEAN, 16, TFS(&tfs_disabled_enabled), 0x0001,
11723
14
          NULL, HFILL}
11724
14
        },
11725
14
        {&hf_gtp_qos_qci,
11726
14
         {"QCI", "gtp.qos_qci",
11727
14
          FT_UINT8, BASE_DEC, NULL, 0x0,
11728
14
          NULL, HFILL}
11729
14
        },
11730
14
        {&hf_gtp_qos_ul_mbr,
11731
14
         {"Uplink Maximum Bit Rate", "gtp.qos_ul_mbr",
11732
14
          FT_UINT64, BASE_DEC, NULL, 0x0,
11733
14
          NULL, HFILL}
11734
14
        },
11735
14
        {&hf_gtp_qos_dl_mbr,
11736
14
         {"Downlink Maximum Bit Rate", "gtp.qos_dl_mbr",
11737
14
          FT_UINT64, BASE_DEC, NULL, 0x0,
11738
14
          NULL, HFILL}
11739
14
        },
11740
14
        {&hf_gtp_qos_ul_gbr,
11741
14
         {"Uplink Guaranteed Bit Rate", "gtp.qos_ul_gbr",
11742
14
          FT_UINT64, BASE_DEC, NULL, 0x0,
11743
14
          NULL, HFILL}
11744
14
        },
11745
14
        {&hf_gtp_qos_dl_gbr,
11746
14
         {"Downlink Guaranteed Bit Rate", "gtp.qos_dl_gbr",
11747
14
          FT_UINT64, BASE_DEC, NULL, 0x0,
11748
14
          NULL, HFILL}
11749
14
        },
11750
14
        {&hf_gtp_qos_ul_apn_ambr,
11751
14
         {"Uplink APN Aggregate Maximum Bit Rate", "gtp.qos_ul_apn_ambr",
11752
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
11753
14
          NULL, HFILL}
11754
14
        },
11755
14
        {&hf_gtp_qos_dl_apn_ambr,
11756
14
         {"Downlink APN Aggregate Maximum Bit Rate", "gtp.qos_dl_apn_ambr",
11757
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
11758
14
          NULL, HFILL}
11759
14
        },
11760
14
        {&hf_gtp_pkt_flow_id,
11761
14
         { "Packet Flow ID", "gtp.pkt_flow_id",
11762
14
           FT_UINT8, BASE_DEC, NULL, 0,
11763
14
           NULL, HFILL}
11764
14
        },
11765
14
        {&hf_gtp_ptmsi,
11766
14
         { "P-TMSI", "gtp.ptmsi",
11767
14
           FT_UINT32, BASE_DEC_HEX, NULL, 0,
11768
14
           "Packet-Temporary Mobile Subscriber Identity", HFILL}
11769
14
        },
11770
14
        {&hf_gtp_ptmsi_sig,
11771
14
         { "P-TMSI Signature", "gtp.ptmsi_sig",
11772
14
           FT_UINT24, BASE_HEX, NULL, 0,
11773
14
           NULL, HFILL}
11774
14
        },
11775
14
        {&hf_gtp_rab_gtpu_dn,
11776
14
         { "Downlink GTP-U seq number", "gtp.rab_gtp_dn",
11777
14
           FT_UINT16, BASE_DEC, NULL, 0,
11778
14
           "Downlink GTP-U sequence number", HFILL}
11779
14
        },
11780
14
        {&hf_gtp_rab_gtpu_up,
11781
14
         { "Uplink GTP-U seq number", "gtp.rab_gtp_up",
11782
14
           FT_UINT16, BASE_DEC, NULL, 0,
11783
14
           "Uplink GTP-U sequence number", HFILL}
11784
14
        },
11785
14
        {&hf_gtp_rab_pdu_dn,
11786
14
         { "Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn",
11787
14
           FT_UINT16, BASE_DEC, NULL, 0,
11788
14
           "Downlink next PDCP-PDU sequence number", HFILL}
11789
14
        },
11790
14
        {&hf_gtp_rab_pdu_up,
11791
14
         { "Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up",
11792
14
           FT_UINT16, BASE_DEC, NULL, 0,
11793
14
           "Uplink next PDCP-PDU sequence number", HFILL}
11794
14
        },
11795
14
        {&hf_gtp_uli_geo_loc_type,
11796
14
         { "Geographic Location Type", "gtp.geo_loc_type",
11797
14
           FT_UINT8, BASE_DEC, VALS(geographic_location_type),  0,
11798
14
           NULL, HFILL}
11799
14
        },
11800
14
        {&hf_gtp_cgi_ci,
11801
14
         { "Cell ID (CI)", "gtp.cgi_ci",
11802
14
           FT_UINT16, BASE_DEC, NULL, 0,
11803
14
           NULL, HFILL}
11804
14
        },
11805
14
        {&hf_gtp_sai_sac,
11806
14
         { "Service Area Code (SAC)", "gtp.sai_sac",
11807
14
           FT_UINT16, BASE_DEC, NULL, 0,
11808
14
           NULL, HFILL}
11809
14
        },
11810
14
        {&hf_gtp_rai_rac,
11811
14
         { "Routing Area Code (RAC)", "gtp.rai_rac",
11812
14
           FT_UINT8, BASE_DEC, NULL, 0,
11813
14
           NULL, HFILL}
11814
14
        },
11815
14
        {&hf_gtp_lac,
11816
14
         { "Location Area Code (LAC)", "gtp.lac",
11817
14
           FT_UINT16, BASE_DEC, NULL, 0,
11818
14
           NULL, HFILL}
11819
14
        },
11820
14
        { &hf_gtp_tac,
11821
14
          {"TAC", "gtp.tac",
11822
14
           FT_UINT16, BASE_DEC, NULL, 0,
11823
14
           NULL, HFILL}
11824
14
        },
11825
14
        {&hf_gtp_ranap_cause,
11826
14
         { "RANAP cause", "gtp.ranap_cause",
11827
14
           FT_UINT16, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0,
11828
14
           NULL, HFILL}
11829
14
        },
11830
14
        {&hf_gtp_recovery,
11831
14
         { "Recovery", "gtp.recovery",
11832
14
           FT_UINT8, BASE_DEC, NULL, 0,
11833
14
           "Restart counter", HFILL}
11834
14
        },
11835
14
        {&hf_gtp_reorder,
11836
14
         { "Reordering required", "gtp.reorder",
11837
14
           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11838
14
           NULL, HFILL}
11839
14
        },
11840
14
        {&hf_gtp_rnc_ipv4,
11841
14
         { "RNC address IPv4", "gtp.rnc_ipv4",
11842
14
           FT_IPv4, BASE_NONE, NULL, 0,
11843
14
           "Radio Network Controller address IPv4", HFILL}
11844
14
        },
11845
14
        {&hf_gtp_rnc_ipv6,
11846
14
         { "RNC address IPv6", "gtp.rnc_ipv6",
11847
14
           FT_IPv6, BASE_NONE, NULL, 0,
11848
14
           "Radio Network Controller address IPv6", HFILL}
11849
14
        },
11850
14
        {&hf_gtp_rp,
11851
14
         { "Radio Priority", "gtp.rp",
11852
14
           FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK,
11853
14
           "Radio Priority for uplink tx", HFILL}
11854
14
        },
11855
14
        {&hf_gtp_rp_nsapi,
11856
14
         { "NSAPI in Radio Priority", "gtp.rp_nsapi",
11857
14
           FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
11858
14
           "Network layer Service Access Point Identifier in Radio Priority", HFILL}
11859
14
        },
11860
14
        {&hf_gtp_rp_sms,
11861
14
         { "Radio Priority SMS", "gtp.rp_sms",
11862
14
           FT_UINT8, BASE_DEC, NULL, 0,
11863
14
           "Radio Priority for MO SMS", HFILL}
11864
14
        },
11865
14
        {&hf_gtp_rp_spare,
11866
14
         { "Reserved", "gtp.rp_spare",
11867
14
           FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK,
11868
14
           "Spare bit", HFILL}
11869
14
        },
11870
14
        {&hf_gtp_sel_mode,
11871
14
         { "Selection mode", "gtp.sel_mode",
11872
14
           FT_UINT8, BASE_DEC, VALS(gtp_sel_mode_vals), 0x03,
11873
14
           NULL, HFILL}
11874
14
        },
11875
14
        {&hf_gtp_seq_number,
11876
14
         { "Sequence number", "gtp.seq_number",
11877
14
           FT_UINT16, BASE_HEX_DEC, NULL, 0,
11878
14
           NULL, HFILL}
11879
14
        },
11880
14
        {&hf_gtp_session,
11881
14
          { "Session", "gtp.session",
11882
14
            FT_UINT32, BASE_DEC, NULL, 0,
11883
14
            NULL, HFILL }
11884
14
        },
11885
14
        {&hf_gtp_sndcp_number,
11886
14
         { "SNDCP N-PDU LLC Number", "gtp.sndcp_number",
11887
14
           FT_UINT8, BASE_HEX, NULL, 0,
11888
14
           NULL, HFILL}
11889
14
        },
11890
14
        {&hf_gtp_tear_ind,
11891
14
         { "Teardown Indicator", "gtp.tear_ind",
11892
14
           FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11893
14
           NULL, HFILL}
11894
14
        },
11895
14
        {&hf_gtp_teid,
11896
14
         { "TEID", "gtp.teid",
11897
14
           FT_UINT32, BASE_HEX_DEC, NULL, 0,
11898
14
           "Tunnel Endpoint Identifier", HFILL}
11899
14
        },
11900
14
        {&hf_gtp_teid_cp,
11901
14
         { "TEID Control Plane", "gtp.teid_cp",
11902
14
           FT_UINT32, BASE_HEX_DEC, NULL, 0,
11903
14
           "Tunnel Endpoint Identifier Control Plane", HFILL}
11904
14
        },
11905
14
        {&hf_gtp_uplink_teid_cp,
11906
14
         { "Uplink TEID Control Plane", "gtp.uplink_teid_cp",
11907
14
           FT_UINT32, BASE_HEX_DEC, NULL, 0,
11908
14
           "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}
11909
14
        },
11910
14
        {&hf_gtp_teid_data,
11911
14
         { "TEID Data I", "gtp.teid_data",
11912
14
           FT_UINT32, BASE_HEX_DEC, NULL, 0,
11913
14
           "Tunnel Endpoint Identifier Data I", HFILL}
11914
14
        },
11915
14
        {&hf_gtp_uplink_teid_data,
11916
14
         { "Uplink TEID Data I", "gtp.uplink_teid_data",
11917
14
           FT_UINT32, BASE_HEX_DEC, NULL, 0,
11918
14
           "UplinkTunnel Endpoint Identifier Data I", HFILL}
11919
14
        },
11920
14
        {&hf_gtp_teid_ii,
11921
14
         { "TEID Data II", "gtp.teid_ii",
11922
14
           FT_UINT32, BASE_HEX_DEC, NULL, 0,
11923
14
           "Tunnel Endpoint Identifier Data II", HFILL}
11924
14
        },
11925
14
        {&hf_gtp_tid,
11926
14
         { "TID", "gtp.tid",
11927
14
           FT_STRING, BASE_NONE, NULL, 0,
11928
14
           "Tunnel Identifier", HFILL}
11929
14
        },
11930
14
        {&hf_gtp_tlli,
11931
14
         { "TLLI", "gtp.tlli",
11932
14
           FT_UINT32, BASE_HEX, NULL, 0,
11933
14
           "Temporary Logical Link Identity", HFILL}
11934
14
        },
11935
14
        {&hf_gtp_tr_comm,
11936
14
         { "Packet transfer command", "gtp.tr_comm",
11937
14
           FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0,
11938
14
           NULL, HFILL}
11939
14
        },
11940
14
        {&hf_gtp_trace_ref,
11941
14
         { "Trace reference", "gtp.trace_ref",
11942
14
           FT_UINT16, BASE_HEX, NULL, 0,
11943
14
           NULL, HFILL}
11944
14
        },
11945
14
        {&hf_gtp_trace_type,
11946
14
         { "Trace type", "gtp.trace_type",
11947
14
           FT_UINT16, BASE_HEX, NULL, 0,
11948
14
           NULL, HFILL}
11949
14
        },
11950
14
        {&hf_gtp_user_addr_pdp_org,
11951
14
         { "PDP type organization", "gtp.user_addr_pdp_org",
11952
14
           FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0,
11953
14
           NULL, HFILL}
11954
14
        },
11955
14
        {&hf_gtp_user_addr_pdp_type,
11956
14
         { "PDP type number", "gtp.user_addr_pdp_type",
11957
14
           FT_UINT8, BASE_HEX, VALS(pdp_type), 0,
11958
14
           NULL, HFILL}
11959
14
        },
11960
14
        {&hf_gtp_user_ipv4,
11961
14
         { "End user address IPv4", "gtp.user_ipv4",
11962
14
           FT_IPv4, BASE_NONE, NULL, 0,
11963
14
           NULL, HFILL}
11964
14
        },
11965
14
        {&hf_gtp_user_ipv6,
11966
14
         { "End user address IPv6", "gtp.user_ipv6",
11967
14
           FT_IPv6, BASE_NONE, NULL, 0,
11968
14
           NULL, HFILL}
11969
14
        },
11970
14
        {&hf_gtp_security_mode,
11971
14
         { "Security Mode", "gtp.security_mode",
11972
14
           FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
11973
14
           NULL, HFILL}
11974
14
        },
11975
14
        {&hf_gtp_no_of_vectors,
11976
14
         { "No of Vectors", "gtp.no_of_vectors",
11977
14
           FT_UINT8, BASE_DEC, NULL, 0x38,
11978
14
           NULL, HFILL}
11979
14
        },
11980
14
        {&hf_gtp_cipher_algorithm,
11981
14
         { "Cipher Algorithm", "gtp.cipher_algorithm",
11982
14
           FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
11983
14
           NULL, HFILL}
11984
14
        },
11985
14
        {&hf_gtp_cksn_ksi,
11986
14
         { "Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
11987
14
           FT_UINT8, BASE_DEC, NULL, 0x07,
11988
14
           "CKSN/KSI", HFILL}
11989
14
        },
11990
14
        {&hf_gtp_cksn,
11991
14
         { "Ciphering Key Sequence Number (CKSN)", "gtp.cksn",
11992
14
           FT_UINT8, BASE_DEC, NULL, 0x07,
11993
14
           "CKSN", HFILL}
11994
14
        },
11995
14
        {&hf_gtp_ksi,
11996
14
         { "Key Set Identifier (KSI)", "gtp.ksi",
11997
14
           FT_UINT8, BASE_DEC, NULL, 0x07,
11998
14
           "KSI", HFILL}
11999
14
        },
12000
14
        {&hf_gtp_ext_length,
12001
14
         { "Length", "gtp.ext_length",
12002
14
           FT_UINT16, BASE_DEC, NULL, 0x0,
12003
14
           "IE Length", HFILL}
12004
14
        },
12005
14
        {&hf_gtp_utran_field,
12006
14
         { "UTRAN Transparent Field", "gtp.utran_field",
12007
14
           FT_BYTES, BASE_NONE, NULL, 0x0,
12008
14
           NULL, HFILL}
12009
14
        },
12010
14
        {&hf_gtp_ext_apn_res,
12011
14
         { "Restriction Type", "gtp.ext_apn_res",
12012
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12013
14
           NULL, HFILL}
12014
14
        },
12015
14
        {&hf_gtp_ext_rat_type,
12016
14
         { "RAT Type", "gtp.ext_rat_type",
12017
14
           FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
12018
14
           NULL, HFILL}
12019
14
        },
12020
14
        {&hf_gtp_ext_imeisv,
12021
14
         { "IMEI(SV)", "gtp.ext_imeisv",
12022
14
           FT_STRING, BASE_NONE, NULL, 0x0,
12023
14
           NULL, HFILL}
12024
14
        },
12025
14
        { &hf_gtp_target_rnc_id,
12026
14
          { "targetRNC-ID", "gtp.targetRNC_ID",
12027
14
            FT_UINT16, BASE_HEX, NULL, 0x0fff,
12028
14
            NULL, HFILL }
12029
14
        },
12030
14
        { &hf_gtp_target_ext_rnc_id,
12031
14
          { "Extended RNC-ID", "gtp.target_ext_RNC_ID",
12032
14
            FT_UINT16, BASE_HEX, NULL, 0,
12033
14
            NULL, HFILL }
12034
14
        },
12035
14
        {&hf_gtp_bssgp_cause,
12036
14
         { "BSSGP Cause", "gtp.bssgp_cause",
12037
14
           FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_cause_vals_ext, 0,
12038
14
           NULL, HFILL}
12039
14
        },
12040
14
        { &hf_gtp_bssgp_ra_discriminator,
12041
14
          { "Routing Address Discriminator", "gtp.bssgp.rad",
12042
14
            FT_UINT8, BASE_DEC, VALS(gtp_bssgp_ra_discriminator_vals), 0x0f,
12043
14
            NULL, HFILL }
12044
14
        },
12045
14
        {&hf_gtp_sapi,
12046
14
         { "PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
12047
14
           FT_UINT8, BASE_DEC, NULL, 0x0F,
12048
14
           NULL, HFILL}
12049
14
        },
12050
14
        {&hf_gtp_xid_par_len,
12051
14
         { "PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
12052
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12053
14
           NULL, HFILL}
12054
14
        },
12055
14
        {&hf_gtp_rep_act_type,
12056
14
         { "Action", "gtp.ms_inf_chg_rep_act",
12057
14
           FT_UINT8, BASE_DEC, VALS(chg_rep_act_type_vals), 0x0,
12058
14
           NULL, HFILL}
12059
14
        },
12060
14
        {&hf_gtp_correlation_id,
12061
14
         { "Correlation-ID", "gtp.correlation_id",
12062
14
           FT_UINT8, BASE_DEC, NULL, 0,
12063
14
           NULL, HFILL}
12064
14
        },
12065
14
        {&hf_gtp_earp_pci,
12066
14
         { "PCI Pre-emption Capability", "gtp.EARP_pre_emption_Capability",
12067
14
           FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
12068
14
           NULL, HFILL}
12069
14
        },
12070
14
        {&hf_gtp_earp_pl,
12071
14
         { "PL Priority Level", "gtp.EARP_priority_level",
12072
14
           FT_UINT8, BASE_DEC, NULL, 0x3C,
12073
14
           NULL, HFILL}
12074
14
        },
12075
14
        {&hf_gtp_earp_pvi,
12076
14
         { "PVI Pre-emption Vulnerability", "gtp.EARP_pre_emption_par_vulnerability",
12077
14
           FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
12078
14
           NULL, HFILL}
12079
14
        },
12080
14
        {&hf_gtp_ext_comm_flags_uasi,
12081
14
         { "UASI", "gtp.ext_comm_flags.uasi",
12082
14
           FT_BOOLEAN, 8, NULL, 0x80,
12083
14
           NULL, HFILL}
12084
14
        },
12085
14
        {&hf_gtp_ext_comm_flags_bdwi,
12086
14
         { "BDWI", "gtp.ext_comm_flags.bdwi",
12087
14
           FT_BOOLEAN, 8, NULL, 0x40,
12088
14
           NULL, HFILL}
12089
14
        },
12090
14
        {&hf_gtp_ext_comm_flags_pcri,
12091
14
         { "PCRI", "gtp.ext_comm_flags.pcri",
12092
14
           FT_BOOLEAN, 8, NULL, 0x20,
12093
14
           NULL, HFILL}
12094
14
        },
12095
14
        {&hf_gtp_ext_comm_flags_vb,
12096
14
         { "VB", "gtp.ext_comm_flags.vb",
12097
14
           FT_BOOLEAN, 8, NULL, 0x10,
12098
14
           NULL, HFILL}
12099
14
        },
12100
14
        {&hf_gtp_ext_comm_flags_retloc,
12101
14
         { "RetLoc", "gtp.ext_comm_flags.retloc",
12102
14
           FT_BOOLEAN, 8, NULL, 0x08,
12103
14
           NULL, HFILL}
12104
14
        },
12105
14
        {&hf_gtp_ext_comm_flags_cpsr,
12106
14
         { "CPSR", "gtp.ext_comm_flags.cpsr",
12107
14
           FT_BOOLEAN, 8, NULL, 0x04,
12108
14
           NULL, HFILL}
12109
14
        },
12110
14
        {&hf_gtp_ext_comm_flags_ccrsi,
12111
14
         { "CCRSI", "gtp.ext_comm_flags.ccrsi",
12112
14
           FT_BOOLEAN, 8, NULL, 0x02,
12113
14
           NULL, HFILL}
12114
14
        },
12115
14
        {&hf_gtp_ext_comm_flags_unauthenticated_imsi,
12116
14
         { "Unauthenticated IMSI", "gtp.ext_comm_flags.unauthenticated_imsi",
12117
14
           FT_BOOLEAN, 8, NULL, 0x01,
12118
14
           NULL, HFILL}
12119
14
        },
12120
14
        {&hf_gtp_csg_id,
12121
14
         { "CSG ID", "gtp.csg_id",
12122
14
           FT_UINT32, BASE_DEC, NULL, 0x07FFFFFF,
12123
14
           NULL, HFILL}
12124
14
        },
12125
14
        {&hf_gtp_access_mode,
12126
14
         { "Access Mode", "gtp.access_mode",
12127
14
           FT_UINT8, BASE_DEC, VALS(gtp_access_mode_vals), 0xC0,
12128
14
           NULL, HFILL }
12129
14
        },
12130
14
        {&hf_gtp_cmi,
12131
14
         { "CSG Membership Indication (CMI)", "gtp.cmi",
12132
14
           FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x01,
12133
14
           NULL, HFILL}
12134
14
        },
12135
14
        {&hf_gtp_csg_inf_rep_act_ucicsg,
12136
14
         { "UCICSG", "gtp.csg_info_rep_act.ucicsg",
12137
14
           FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
12138
14
           "Report UCI when the UE enters/leaves/accesses CSG Cell",
12139
14
           HFILL}
12140
14
        },
12141
14
        {&hf_gtp_csg_inf_rep_act_ucishc,
12142
14
         { "UCISHC", "gtp.csg_info_rep_act.ucishc",
12143
14
           FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
12144
14
           "Report UCI when the UE enters/leaves/accesses Subscribed Hybrid Cell",
12145
14
           HFILL}
12146
14
        },
12147
14
        {&hf_gtp_csg_inf_rep_act_uciuhc,
12148
14
         { "UCIUHC", "gtp.csg_info_rep_act.uciuhc",
12149
14
           FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
12150
14
           "Report UCI when the UE enters/leaves/accesses Unsubscribed Hybrid Cell",
12151
14
           HFILL}
12152
14
        },
12153
14
        {&hf_gtp_ext_comm_flags_II_pnsi,
12154
14
         { "PNSI", "gtp.ext_comm_flags_II_pnsi",
12155
14
           FT_UINT8, BASE_DEC, NULL, 0x01,
12156
14
           NULL, HFILL}
12157
14
        },
12158
14
        {&hf_gtp_ext_comm_flags_II_dtci,
12159
14
         { "DTCI", "gtp.ext_comm_flags_II_dtci",
12160
14
           FT_BOOLEAN, 8, NULL, 0x02,
12161
14
           NULL, HFILL}
12162
14
        },
12163
14
        {&hf_gtp_ext_comm_flags_II_pmtsmi,
12164
14
         { "PMTSMI", "gtp.ext_comm_flags_II_pmtsmi",
12165
14
           FT_UINT8, BASE_DEC, NULL, 0x04,
12166
14
           NULL, HFILL}
12167
14
        },
12168
14
        {&hf_gtp_ext_comm_flags_II_spare,
12169
14
         { "SPARE", "gtp.ext_comm_flags_II_spare",
12170
14
           FT_UINT8, BASE_HEX, NULL, 0xF8,
12171
14
           NULL, HFILL}
12172
14
        },
12173
14
        {&hf_gtp_ciot_opt_sup_ind_sgni_pdn,
12174
14
         { "SGNI PDN", "gtp.ciot_opt_sup_ind_sgni_pdn",
12175
14
           FT_BOOLEAN, 8, NULL, 0x01,
12176
14
           NULL, HFILL}
12177
14
        },
12178
14
        {&hf_gtp_ciot_opt_sup_ind_scni_pdn,
12179
14
         { "SCNI PDN", "gtp.ciot_opt_sup_ind_scni_pdn",
12180
14
           FT_BOOLEAN, 8, NULL, 0x02,
12181
14
           NULL, HFILL}
12182
14
        },
12183
14
        {&hf_gtp_ciot_opt_sup_ind_spare,
12184
14
         { "SPARE", "gtp.ciot_opt_sup_ind_spare",
12185
14
           FT_UINT8, BASE_HEX, NULL, 0xfc,
12186
14
           NULL, HFILL}
12187
14
        },
12188
14
        { &hf_gtp_up_fun_sel_ind_flags_dcnr,
12189
14
          { "DCNR", "gtp.up_fun_sel_ind_flags_dcnr",
12190
14
            FT_BOOLEAN, 8, NULL, 0x01,
12191
14
            NULL, HFILL}
12192
14
        },
12193
14
        { &hf_gtp_up_fun_sel_ind_flags_spare,
12194
14
          { "SPARE", "gtp.up_fun_sel_ind_flags_spare",
12195
14
            FT_UINT8, BASE_HEX, NULL, 0xfe,
12196
14
            NULL, HFILL}
12197
14
        },
12198
14
        {&hf_gtp_cdr_app,
12199
14
         { "Application Identifier", "gtp.cdr_app",
12200
14
           FT_UINT8, BASE_DEC, NULL, 0xf0,
12201
14
           NULL, HFILL}
12202
14
        },
12203
14
        { &hf_gtp_cdr_rel,
12204
14
          { "Release Identifier", "gtp.cdr_rel",
12205
14
            FT_UINT8, BASE_DEC, NULL, 0x0f,
12206
14
            NULL, HFILL}
12207
14
        },
12208
14
        { &hf_gtp_cdr_ver,
12209
14
          { "Version Identifier", "gtp.cdr_ver",
12210
14
            FT_UINT8, BASE_DEC, NULL, 0x0,
12211
14
            NULL, HFILL}
12212
14
        },
12213
14
        { &hf_gtp_cdr_rel_ext,
12214
14
          { "Release Identifier Extension", "gtp.cdr_rel_ext",
12215
14
            FT_UINT8, BASE_DEC, NULL, 0x0,
12216
14
            NULL, HFILL}
12217
14
        },
12218
14
        { &hf_gtp_cdr_length,
12219
14
          { "Length", "gtp.cdr_length",
12220
14
            FT_UINT16, BASE_DEC, NULL, 0x0,
12221
14
            NULL, HFILL}
12222
14
        },
12223
14
        { &hf_gtp_cdr_context,
12224
14
          { "Context", "gtp.cdr_context",
12225
14
            FT_BYTES, BASE_NONE, NULL, 0x0,
12226
14
            NULL, HFILL}
12227
14
        },
12228
14
        {&hf_gtp_cmn_flg_ppc,
12229
14
         { "Prohibit Payload Compression", "gtp.cmn_flg.ppc",
12230
14
           FT_BOOLEAN, 8, NULL, 0x01,
12231
14
           NULL, HFILL}
12232
14
        },
12233
14
        {&hf_gtp_cmn_flg_mbs_srv_type,
12234
14
         { "MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
12235
14
           FT_BOOLEAN, 8, NULL, 0x02,
12236
14
           NULL, HFILL}
12237
14
        },
12238
14
        {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
12239
14
         { "RAN Procedures Ready", "gtp.cmn_flg.mbs_ran_pcd_rdy",
12240
14
           FT_BOOLEAN, 8, NULL, 0x04,
12241
14
           NULL, HFILL}
12242
14
        },
12243
14
        {&hf_gtp_cmn_flg_mbs_cnt_inf,
12244
14
         { "MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
12245
14
           FT_BOOLEAN, 8, NULL, 0x08,
12246
14
           NULL, HFILL}
12247
14
        },
12248
14
        {&hf_gtp_cmn_flg_no_qos_neg,
12249
14
         { "No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
12250
14
           FT_BOOLEAN, 8, NULL, 0x10,
12251
14
           NULL, HFILL}
12252
14
        },
12253
14
        {&hf_gtp_cmn_flg_nrsn,
12254
14
         { "NRSN bit field", "gtp.cmn_flg.nrsn",
12255
14
           FT_BOOLEAN, 8, NULL, 0x20,
12256
14
           NULL, HFILL}
12257
14
        },
12258
14
        {&hf_gtp_cmn_flg_upgrd_qos_sup,
12259
14
         { "Upgrade QoS Supported", "gtp.cmn_flg.upgrd_qos_sup",
12260
14
           FT_BOOLEAN, 8, NULL, 0x40,
12261
14
           NULL, HFILL}
12262
14
        },
12263
14
        {&hf_gtp_cmn_flg_dual_addr_bearer_flg,
12264
14
         { "Dual Address Bearer Flag", "gtp.cmn_flg.dual_addr_bearer_flg",
12265
14
           FT_BOOLEAN, 8, NULL, 0x80,
12266
14
           NULL, HFILL}
12267
14
        },
12268
14
        {&hf_gtp_linked_nsapi,
12269
14
         { "Linked NSAPI", "gtp.linked_nsapi",
12270
14
           FT_UINT8, BASE_DEC, NULL, 0xf0,
12271
14
           NULL, HFILL}
12272
14
        },
12273
14
        {&hf_gtp_enh_nsapi,
12274
14
         { "Enhanced NSAPI", "gtp.enhanced_nsapi",
12275
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12276
14
           NULL, HFILL}
12277
14
        },
12278
14
        {&hf_gtp_tmgi,
12279
14
         { "Temporary Mobile Group Identity (TMGI)", "gtp.tmgi",
12280
14
           FT_BYTES, BASE_NONE, NULL, 0x0,
12281
14
           NULL, HFILL}
12282
14
        },
12283
14
        {&hf_gtp_no_of_mbms_sa_codes,
12284
14
         { "Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
12285
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12286
14
           "Number N of MBMS service area codes", HFILL}
12287
14
        },
12288
12289
14
        {&hf_gtp_mbms_ses_dur_days,
12290
14
         { "Estimated session duration days", "gtp.mbms_ses_dur_days",
12291
14
           FT_UINT24, BASE_DEC, NULL, 0x00007F,
12292
14
           NULL, HFILL}
12293
14
        },
12294
14
        {&hf_gtp_mbms_ses_dur_s,
12295
14
         { "Estimated session duration seconds", "gtp.mbms_ses_dur_s",
12296
14
           FT_UINT24, BASE_DEC, NULL, 0xFFFF80,
12297
14
           NULL, HFILL}
12298
14
        },
12299
14
        {&hf_gtp_mbms_sa_code,
12300
14
         { "MBMS service area code", "gtp.mbms_sa_code",
12301
14
           FT_UINT16, BASE_DEC, NULL, 0x0,
12302
14
           NULL, HFILL}
12303
14
        },
12304
14
        {&hf_gtp_trace_ref2,
12305
14
         { "Trace Reference2", "gtp.trace_ref2",
12306
14
           FT_UINT24, BASE_HEX, NULL, 0,
12307
14
           NULL, HFILL}
12308
14
        },
12309
14
        {&hf_gtp_trace_rec_session_ref,
12310
14
         { "Trace Recording Session Reference", "gtp.trace_rec_session_ref",
12311
14
           FT_UINT16, BASE_HEX, NULL, 0,
12312
14
           NULL, HFILL}
12313
14
        },
12314
14
        {&hf_gtp_trace_triggers_ggsn_mbms,
12315
14
         { "MBMS Context", "gtp.trace_triggers.ggsn.mbms",
12316
14
           FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x2,
12317
14
           NULL, HFILL}
12318
14
        },
12319
14
        {&hf_gtp_trace_triggers_ggsn_pdp,
12320
14
         { "PDP Context", "gtp.trace_triggers.ggsn.pdp",
12321
14
           FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12322
14
           NULL, HFILL}
12323
14
        },
12324
14
        {&hf_gtp_trace_triggers_ggsn,
12325
14
         { "Triggering events in GGSN", "gtp.trace_triggers.ggsn",
12326
14
           FT_UINT8, BASE_HEX, NULL, 0,
12327
14
           NULL, HFILL}
12328
14
        },
12329
14
        {&hf_gtp_trace_depth,
12330
14
         { "Trace Depth", "gtp.trace_depth",
12331
14
           FT_UINT8, BASE_DEC, VALS(gtp_trace_depth_vals), 0,
12332
14
           NULL, HFILL}
12333
14
        },
12334
14
        {&hf_gtp_trace_loi_ggsn_gmb,
12335
14
         { "Gmb", "gtp.trace_loi.ggsn.gmb",
12336
14
           FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x4,
12337
14
           NULL, HFILL}
12338
14
        },
12339
14
        {&hf_gtp_trace_loi_ggsn_gi,
12340
14
         { "Gi", "gtp.trace_loi.ggsn.gi",
12341
14
           FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x2,
12342
14
           NULL, HFILL}
12343
14
        },
12344
14
        {&hf_gtp_trace_loi_ggsn_gn,
12345
14
         { "Gn", "gtp.trace_loi.ggsn.gn",
12346
14
           FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12347
14
           NULL, HFILL}
12348
14
        },
12349
14
        {&hf_gtp_trace_loi_ggsn,
12350
14
         { "List of interfaces in GGSN", "gtp.trace_loi.ggsn",
12351
14
           FT_UINT8, BASE_HEX, NULL, 0,
12352
14
           NULL, HFILL}
12353
14
        },
12354
14
        {&hf_gtp_trace_activity_control,
12355
14
         { "Trace Activity Control", "gtp.trace_activity_control",
12356
14
           FT_UINT8, BASE_DEC, VALS(gtp_trace_activity_control_vals), 0,
12357
14
           NULL, HFILL}
12358
14
        },
12359
14
        {&hf_gtp_hop_count,
12360
14
         { "Hop Counter", "gtp.hop_count",
12361
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12362
14
           NULL, HFILL}
12363
14
        },
12364
14
        {&hf_gtp_mbs_2g_3g_ind,
12365
14
         { "MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
12366
14
           FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
12367
14
           NULL, HFILL}
12368
14
        },
12369
14
        {&hf_gtp_trace_triggers_bm_sc_mbms,
12370
14
         { "MBMS Multicast service activation", "gtp.trace_triggers.bm_sc.mbms",
12371
14
           FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12372
14
           NULL, HFILL}
12373
14
        },
12374
14
        {&hf_gtp_trace_triggers_bm_sc,
12375
14
         { "Triggering events in BM-SC", "gtp.trace_triggers.bm_sc",
12376
14
           FT_UINT8, BASE_HEX, NULL, 0,
12377
14
           NULL, HFILL}
12378
14
        },
12379
14
        {&hf_gtp_trace_loi_bm_sc_gmb,
12380
14
         { "Gmb", "gtp.trace_loi.bm_sc.gmb",
12381
14
           FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12382
14
           NULL, HFILL}
12383
14
        },
12384
14
        {&hf_gtp_trace_loi_bm_sc,
12385
14
         { "List of interfaces in BM-SC", "gtp.trace_loi.bm_sc",
12386
14
           FT_UINT8, BASE_HEX, NULL, 0,
12387
14
           NULL, HFILL}
12388
14
        },
12389
14
        {&hf_gtp_time_2_dta_tr,
12390
14
         { "Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
12391
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12392
14
           NULL, HFILL}
12393
14
        },
12394
14
        {&hf_gtp_target_lac,
12395
14
         { "Target Location Area Code (LAC)", "gtp.target_lac",
12396
14
           FT_UINT16, BASE_DEC, NULL, 0,
12397
14
           NULL, HFILL}
12398
14
        },
12399
14
        {&hf_gtp_target_rac,
12400
14
         { "Target Routing Area Code (RAC)", "gtp.target_rac",
12401
14
           FT_UINT8, BASE_DEC, NULL, 0,
12402
14
           NULL, HFILL}
12403
14
        },
12404
14
        {&hf_gtp_target_ci,
12405
14
         { "Target Cell ID (CI)", "gtp.target_ci",
12406
14
           FT_UINT16, BASE_DEC, NULL, 0,
12407
14
           NULL, HFILL}
12408
14
        },
12409
14
        { &hf_gtp_source_type,
12410
14
          { "Source Type", "gtp.source_type",
12411
14
            FT_UINT8, BASE_DEC, VALS(gtp_source_type_vals), 0x0,
12412
14
            NULL, HFILL}
12413
14
        },
12414
14
        {&hf_gtp_source_lac,
12415
14
         { "Source Location Area Code (LAC)", "gtp.source_lac",
12416
14
           FT_UINT16, BASE_DEC, NULL, 0,
12417
14
           NULL, HFILL}
12418
14
        },
12419
14
        {&hf_gtp_source_rac,
12420
14
         { "Source Routing Area Code (RAC)", "gtp.source_rac",
12421
14
           FT_UINT8, BASE_DEC, NULL, 0,
12422
14
           NULL, HFILL}
12423
14
        },
12424
14
        {&hf_gtp_source_ci,
12425
14
         { "Source Cell ID (CI)", "gtp.source_ci",
12426
14
           FT_UINT16, BASE_DEC, NULL, 0,
12427
14
           NULL, HFILL}
12428
14
        },
12429
14
        { &hf_gtp_source_rnc_id,
12430
14
          { "Source RNC-ID", "gtp.source.rnc_id",
12431
14
            FT_UINT16, BASE_DEC, NULL, 0x0fff,
12432
14
            NULL, HFILL }
12433
14
        },
12434
14
        { &hf_gtp_ext_ei,
12435
14
          { "Error Indication (EI)", "gtp.ei",
12436
14
            FT_UINT8, BASE_DEC, NULL, 0x04,
12437
14
            NULL, HFILL}
12438
14
        },
12439
14
        {&hf_gtp_ext_gcsi,
12440
14
         { "GPRS-CSI (GCSI)", "gtp.gcsi",
12441
14
           FT_UINT8, BASE_DEC, NULL, 0x02,
12442
14
           NULL, HFILL}
12443
14
        },
12444
14
        { &hf_gtp_ext_dti,
12445
14
          { "Direct Tunnel Indicator (DTI)", "gtp.dti",
12446
14
            FT_UINT8, BASE_DEC, NULL, 0x01,
12447
14
            NULL, HFILL}
12448
14
        },
12449
14
        { &hf_gtp_ra_prio_lcs,
12450
14
          { "Radio Priority LCS", "gtp.raplcs",
12451
14
            FT_UINT8, BASE_DEC, NULL, 0x07,
12452
14
            NULL, HFILL}
12453
14
        },
12454
14
        { &hf_gtp_bcm,
12455
14
          { "Bearer Control Mode", "gtp.bcm",
12456
14
            FT_UINT8, BASE_DEC, VALS(gtp_pdp_bcm_type_vals), 0,
12457
14
            NULL, HFILL}
12458
14
        },
12459
14
        { &hf_gtp_fqdn,
12460
14
          { "FQDN", "gtp.fqdn",
12461
14
            FT_STRING, BASE_NONE, NULL, 0,
12462
14
            "Fully Qualified Domain Name", HFILL}
12463
14
        },
12464
14
        { &hf_gtp_rim_routing_addr,
12465
14
          { "RIM Routing Address value", "gtp.rim_routing_addr_val",
12466
14
            FT_BYTES, BASE_NONE, NULL, 0,
12467
14
            NULL, HFILL}
12468
14
        },
12469
14
        { &hf_gtp_mbms_flow_id,
12470
14
          { "MBMS Flow Identifier", "gtp.mbms_flow_id",
12471
14
            FT_BYTES, BASE_NONE, NULL, 0,
12472
14
            NULL, HFILL}
12473
14
        },
12474
14
        { &hf_gtp_mbms_dist_indic,
12475
14
          { "Distribution Indication", "gtp.mbms_dist_indic",
12476
14
            FT_UINT8, BASE_DEC, VALS(gtp_mbms_dist_indic_vals), 0x03,
12477
14
            NULL, HFILL}
12478
14
        },
12479
14
        { &hf_gtp_ext_apn_ambr_ul,
12480
14
          { "APN-AMBR for Uplink", "gtp.apn_ambr_ul",
12481
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12482
14
            NULL, HFILL}
12483
14
        },
12484
14
        { &hf_gtp_ext_apn_ambr_dl,
12485
14
          { "APN-AMBR for Downlink", "gtp.apn_ambr_dl",
12486
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12487
14
            NULL, HFILL}
12488
14
        },
12489
14
        { &hf_gtp_ext_sub_ue_ambr_ul,
12490
14
          { "Subscribed UE-AMBR for Uplink", "gtp.sub_ue_ambr_ul",
12491
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12492
14
            NULL, HFILL}
12493
14
        },
12494
14
        { &hf_gtp_ext_sub_ue_ambr_dl,
12495
14
          { "Subscribed UE-AMBR for Downlink", "gtp.sub_ue_ambr_dl",
12496
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12497
14
            NULL, HFILL}
12498
14
        },
12499
14
        { &hf_gtp_ext_auth_ue_ambr_ul,
12500
14
          { "Authorized UE-AMBR for Uplink", "gtp.auth_ue_ambr_ul",
12501
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12502
14
            NULL, HFILL}
12503
14
        },
12504
14
        { &hf_gtp_ext_auth_ue_ambr_dl,
12505
14
          { "Authorized UE-AMBR for Downlink", "gtp.auth_ue_ambr_dl",
12506
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12507
14
            NULL, HFILL}
12508
14
        },
12509
14
        { &hf_gtp_ext_auth_apn_ambr_ul,
12510
14
          { "Authorized APN-AMBR for Uplink", "gtp.auth_apn_ambr_ul",
12511
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12512
14
            NULL, HFILL}
12513
14
        },
12514
14
        { &hf_gtp_ext_auth_apn_ambr_dl,
12515
14
          { "Authorized APN-AMBR for Downlink", "gtp.auth_apn_ambr_dl",
12516
14
            FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12517
14
            NULL, HFILL}
12518
14
        },
12519
14
        { &hf_gtp_ext_ggsn_back_off_time_units,
12520
14
          { "Timer unit", "gtp.ggsn_back_off_time_units",
12521
14
            FT_UINT8, BASE_DEC, VALS(gtp_ggsn_back_off_time_units_vals), 0xe0,
12522
14
            NULL, HFILL}
12523
14
        },
12524
14
        { &hf_gtp_ext_ggsn_back_off_timer,
12525
14
          { "Timer value", "gtp.ggsn_back_off_timer",
12526
14
            FT_UINT8, BASE_DEC, NULL, 0x1f,
12527
14
            NULL, HFILL}
12528
14
        },
12529
14
        { &hf_gtp_lapi,
12530
14
          { "LAPI", "gtp.lapi",
12531
14
            FT_BOOLEAN, 8, TFS(&gtp_lapi_tfs), 0x01,
12532
14
            "Low Access Priority Indication", HFILL}
12533
14
        },
12534
14
        { &hf_gtp_higher_br_16mb_flg,
12535
14
          { "Higher bitrates than 16 Mbps flag", "gtp.higher_br_16mb_flg",
12536
14
            FT_UINT8, BASE_DEC, VALS(gtp_higher_br_16mb_flg_vals), 0x0,
12537
14
            NULL, HFILL}
12538
14
        },
12539
14
        { &hf_gtp_max_mbr_apn_ambr_ul,
12540
14
          { "Max MBR/APN-AMBR for uplink", "gtp.max_mbr_apn_ambr_ul",
12541
14
            FT_UINT32, BASE_DEC, NULL, 0x0,
12542
14
            NULL, HFILL}
12543
14
        },
12544
14
        { &hf_gtp_max_mbr_apn_ambr_dl,
12545
14
          { "Max MBR/APN-AMBR for downlink", "gtp.max_mbr_apn_ambr_dl",
12546
14
            FT_UINT32, BASE_DEC, NULL, 0x0,
12547
14
            NULL, HFILL}
12548
14
        },
12549
14
        { &hf_gtp_uli_timestamp,
12550
14
          { "ULI Timestamp", "gtp.uli_timestamp",
12551
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
12552
14
            NULL, HFILL }
12553
14
        },
12554
14
        { &hf_gtp_lhn_id,
12555
14
          { "Local Home Network ID", "gtp.lhn_id",
12556
14
            FT_STRING, BASE_NONE, NULL, 0,
12557
14
            NULL, HFILL}
12558
14
        },
12559
14
        { &hf_gtp_sel_entity,
12560
14
          { "Selection Entity", "gtp.selection_entity",
12561
14
            FT_UINT8, BASE_DEC, VALS(gtp_sel_entity_vals), 0x3,
12562
14
            NULL, HFILL}
12563
14
        },
12564
14
        { &hf_gtp_ue_usage_type_value,
12565
14
          { "UE Usage Type value", "gtp.ue_usage_type_value",
12566
14
            FT_UINT32, BASE_DEC, NULL, 0x0,
12567
14
            NULL, HFILL}
12568
14
        },
12569
14
        { &hf_gtp_scef_id_length,
12570
14
          { "SCEF-ID length", "gtp.scef_id_length",
12571
14
            FT_UINT16, BASE_DEC, NULL, 0x0,
12572
14
            NULL, HFILL}
12573
14
        },
12574
14
        { &hf_gtp_scef_id,
12575
14
          { "SCEF-ID", "gtp.scef_id",
12576
14
            FT_STRING, BASE_NONE, NULL, 0x0,
12577
14
            NULL, HFILL}
12578
14
        },
12579
14
        { &hf_gtp_iov_updates_counter,
12580
14
          { "IOV_updates counter", "gtp.iov_updates_counter",
12581
14
            FT_UINT8, BASE_DEC, NULL, 0x0,
12582
14
            NULL, HFILL}
12583
14
        },
12584
14
        { &hf_gtp_mapped_ue_usage_type,
12585
14
          { "Mapped UE Usage Type", "gtp.mapped_ue_usage_type",
12586
14
            FT_UINT16, BASE_DEC, NULL, 0x0,
12587
14
            NULL, HFILL}
12588
14
        },
12589
12590
14
      { &hf_gtp_rand, { "RAND", "gtp.rand", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12591
14
      { &hf_gtp_sres, { "SRES", "gtp.sres", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12592
14
      { &hf_gtp_kc, { "Kc", "gtp.kc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12593
14
      { &hf_gtp_xres_length, { "XRES length", "gtp.xres_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12594
14
      { &hf_gtp_xres, { "XRES", "gtp.xres", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12595
14
      { &hf_gtp_quintuplet_ciphering_key, { "Quintuplet Ciphering Key", "gtp.quintuplet_ciphering_key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12596
14
      { &hf_gtp_quintuplet_integrity_key, { "Quintuplet Integrity Key", "gtp.quintuplet_integrity_key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12597
14
      { &hf_gtp_authentication_length, { "Authentication length", "gtp.authentication_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12598
14
      { &hf_gtp_auth, { "AUTH", "gtp.auth", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12599
14
      { &hf_gtp_ciphering_key_ck, { "Ciphering key CK", "gtp.ciphering_key_ck", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12600
14
      { &hf_gtp_integrity_key_ik, { "Integrity key IK", "gtp.integrity_key_ik", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12601
14
      { &hf_gtp_quintuplets_length, { "Quintuplets length", "gtp.quintuplets_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
12602
14
      { &hf_gtp_ciphering_key_kc, { "Ciphering key Kc", "gtp.ciphering_key_kc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12603
14
      { &hf_gtp_container_length, { "Container length", "gtp.container_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12604
14
      { &hf_gtp_extended_end_user_address, { "Extended End User Address", "gtp.extended_end_user_address", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
12605
14
      { &hf_gtp_vplmn_address_allowed, { "VPLMN address allowed", "gtp.vplmn_address_allowed", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
12606
14
      { &hf_gtp_activity_status_indicator, { "Activity Status Indicator", "gtp.activity_status_indicator", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
12607
14
      { &hf_gtp_reordering_required, { "Reordering required", "gtp.reordering_required", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
12608
14
      { &hf_gtp_pdp_cntxt_sapi, { "SAPI", "gtp.pdp_cntxt.sapi", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
12609
14
      { &hf_gtp_sequence_number_down, { "Sequence number down", "gtp.sequence_number_down", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12610
14
      { &hf_gtp_sequence_number_up, { "Sequence number up", "gtp.sequence_number_up", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12611
14
      { &hf_gtp_send_n_pdu_number, { "Send N-PDU number", "gtp.send_n_pdu_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12612
14
      { &hf_gtp_receive_n_pdu_number, { "Receive N-PDU number", "gtp.receive_n_pdu_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12613
14
      { &hf_gtp_uplink_flow_label_signalling, { "Uplink flow label signalling", "gtp.uplink_flow_label_signalling", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12614
14
      { &hf_gtp_pdp_context_identifier, { "PDP context identifier", "gtp.pdp_context_identifier", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12615
14
      { &hf_gtp_pdp_organization, { "PDP organization", "gtp.pdp_organization", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0x0F, NULL, HFILL }},
12616
14
      { &hf_gtp_pdp_type, { "PDP type", "gtp.pdp_type", FT_UINT8, BASE_DEC, VALS(pdp_type), 0x0, NULL, HFILL }},
12617
14
      { &hf_gtp_pdp_address_length, { "PDP address length", "gtp.pdp_address_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12618
14
      { &hf_gtp_pdp_address_ipv4, { "PDP address", "gtp.pdp_address.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12619
14
      { &hf_gtp_pdp_address_ipv6, { "PDP address", "gtp.pdp_address.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12620
14
      { &hf_gtp_sgsn_address_for_control_plane_ipv4, { "SGSN Address for control plane", "gtp.sgsn_address_for_control_plane.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12621
14
      { &hf_gtp_sgsn_address_for_control_plane_ipv6, { "SGSN Address for control plane", "gtp.sgsn_address_for_control_plane.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12622
14
      { &hf_gtp_sgsn_address_for_user_traffic_ipv4, { "SGSN Address for User Traffic", "gtp.sgsn_address_for_user_traffic.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12623
14
      { &hf_gtp_sgsn_address_for_user_traffic_ipv6, { "SGSN Address for User Traffic", "gtp.sgsn_address_for_user_traffic.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12624
14
      { &hf_gtp_ggsn_address_length, { "GGSN address length", "gtp.ggsn_address_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12625
14
      { &hf_gtp_ggsn_address_for_control_plane_ipv4, { "GGSN Address for control plane", "gtp.ggsn_address_for_control_plane.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12626
14
      { &hf_gtp_ggsn_address_for_control_plane_ipv6, { "GGSN Address for control plane", "gtp.ggsn_address_for_control_plane.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12627
14
      { &hf_gtp_ggsn_address_for_user_traffic_ipv4, { "GGSN Address for User Traffic", "gtp.ggsn_address_for_user_traffic.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12628
14
      { &hf_gtp_ggsn_address_for_user_traffic_ipv6, { "GGSN Address for User Traffic", "gtp.ggsn_address_for_user_traffic.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12629
14
      { &hf_gtp_apn_length, { "APN length", "gtp.apn_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12630
14
      { &hf_gtp_transaction_identifier, { "Transaction identifier", "gtp.transaction_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12631
14
      { &hf_gtp_gsn_address_length, { "GSN address length", "gtp.gsn_address_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12632
14
      { &hf_gtp_gsn_address_information_element_length, { "GSN address Information Element length", "gtp.gsn_address_information_element_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12633
14
      { &hf_gtp_tft_length, { "TFT length", "gtp.tft_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12634
14
      { &hf_gtp_rab_setup_length, { "RAB setup length", "gtp.rab_setup_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12635
14
      { &hf_gtp_timezone, { "Timezone", "gtp.timezone", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12636
14
      { &hf_gtp_timezone_dst, { "DST", "gtp.timezone_dst", FT_UINT8, BASE_DEC, VALS(daylight_saving_time_vals), 0x03, NULL, HFILL }},
12637
14
      { &hf_gtp_rfsp_index, { "RFSP Index", "gtp.rfsp_index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12638
14
      { &hf_gtp_fqdn_length, { "FQDN length", "gtp.fqdn_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12639
14
      { &hf_gtp_number_of_data_records, { "Number of data records", "gtp.number_of_data_records", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12640
14
      { &hf_gtp_data_record_format, { "Data record format", "gtp.data_record_format", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12641
14
      { &hf_gtp_node_address_length, { "Node address length", "gtp.node_address_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12642
14
      { &hf_gtp_seq_num_released, { "Sequence number released", "gtp.seq_num_released", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12643
14
      { &hf_gtp_seq_num_canceled, { "Sequence number cancelled", "gtp.seq_num_canceled", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12644
14
      { &hf_gtp_requests_responded, { "Requests responded", "gtp.requests_responded", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12645
14
      { &hf_gtp_hyphen_separator, { "Hyphen separator: -", "gtp.hyphen_separator", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12646
14
      { &hf_gtp_ms_network_cap_content_len, { "Length of MS network capability contents", "gtp.ms_network_cap_content_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12647
14
      { &hf_gtp_iei, { "IEI", "gtp.iei", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12648
14
      { &hf_gtp_iei_mobile_id_len, { "Length", "gtp.iei.mobile_id_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12649
14
      { &hf_gtp_qos_umts_length, { "Length", "gtp.qos_umts_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12650
14
      { &hf_gtp_num_ext_hdr_types, { "Number of Extension Header Types in list (i.e., length)", "gtp.num_ext_hdr_types", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12651
14
      { &hf_gtp_ext_hdr_type, { "Extension Header Type", "gtp.ext_hdr_type", FT_UINT8, BASE_DEC, VALS(next_extension_header_fieldvals), 0x0, NULL, HFILL }},
12652
14
      { &hf_gtp_tpdu_data, { "T-PDU Data", "gtp.tpdu_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
12653
14
      { &hf_gtp_ext_enb_type, { "enb_type", "gtp.enb_type", FT_UINT8, BASE_DEC, VALS(gtp_enb_type_vals), 0x0, NULL, HFILL } },
12654
14
      { &hf_gtp_macro_enodeb_id,
12655
14
      { "Macro eNodeB ID", "gtp.macro_enodeb_id",
12656
14
      FT_UINT24, BASE_HEX, NULL, 0x0fffff,
12657
14
      NULL, HFILL }
12658
14
      },
12659
14
      { &hf_gtp_home_enodeb_id,
12660
14
      { "Home eNodeB ID", "gtp.home_enodeb_id",
12661
14
      FT_UINT32, BASE_HEX, NULL, 0x0fffffff,
12662
14
      NULL, HFILL }
12663
14
      },
12664
14
      { &hf_gtp_dummy_octets,
12665
14
      { "Dummy octets", "gtp.dummy_octets",
12666
14
            FT_BYTES, BASE_NONE, NULL, 0x0,
12667
14
            NULL, HFILL }
12668
14
      },
12669
14
      { &hf_gtp_spare_b0,
12670
14
      { "Spare", "gtp.spare",
12671
14
      FT_UINT8, BASE_HEX, NULL, 0x01,
12672
14
      NULL, HFILL }
12673
14
      },
12674
14
      { &hf_gtp_spare_b4b0,
12675
14
      { "Spare", "gtp.spare",
12676
14
      FT_UINT8, BASE_HEX, NULL, 0x1f,
12677
14
      NULL, HFILL }
12678
14
      },
12679
14
      { &hf_gtp_spare_b7b1,
12680
14
      { "Spare", "gtp.spare",
12681
14
      FT_UINT8, BASE_HEX, NULL, 0xfe,
12682
14
      NULL, HFILL }
12683
14
      },
12684
14
      { &hf_gtp_rnc_ip_addr_v4,
12685
14
      { "RNC IP address", "gtp.rnc_ip_addr_v4",
12686
14
      FT_IPv4, BASE_NONE, NULL, 0x0,
12687
14
      NULL, HFILL }
12688
14
      },
12689
14
      { &hf_gtp_rnc_ip_addr_v6,
12690
14
      { "RNC IP address", "gtp.rnc_ip_addr_v6",
12691
14
      FT_IPv6, BASE_NONE, NULL, 0x0,
12692
14
      NULL, HFILL }
12693
14
      },
12694
14
      { &hf_gtp_ms_cm_2_len,
12695
14
      { "Length of the Mobile Station Classmark 2", "gtp.ms_cm_2_len",
12696
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
12697
14
      NULL, HFILL }
12698
14
      },
12699
14
      { &hf_gtp_ms_cm_3_len,
12700
14
      { "Length of the Mobile Station Classmark 3", "gtp.ms_cm_3_len",
12701
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
12702
14
      NULL, HFILL }
12703
14
      },
12704
14
      { &hf_gtp_sup_codec_lst_len,
12705
14
      { "Length of the Supported Codec List", "gtp.sup_codec_lst_len",
12706
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
12707
14
      NULL, HFILL }
12708
14
      },
12709
14
      { &hf_gtp_add_flg_for_srvcc_ics,
12710
14
      { "ICS (IMS Centralized Service)", "gtp.add_flg_for_srvcc_ics",
12711
14
      FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
12712
14
      NULL, HFILL }
12713
14
      },
12714
14
      { &hf_gtp_sel_mode_val,
12715
14
      { "Selection Mode Value", "gtp.sel_mode_val",
12716
14
      FT_UINT8, BASE_DEC, VALS(gtp_sel_mode_vals), 0x03,
12717
14
      NULL, HFILL }
12718
14
      },
12719
14
};
12720
12721
12722
14
   static hf_register_info hf_nrup[] =
12723
14
   {
12724
14
      {&hf_nrup_pdu_type,
12725
14
        { "PDU Type", "nrup.pdu_type",
12726
14
          FT_UINT8, BASE_DEC, VALS(nr_pdu_type_cnst), 0xf0,
12727
14
          NULL, HFILL}
12728
14
      },
12729
14
      {&hf_nrup_spr_bit_extnd_flag,
12730
14
        { "Spare", "nrup.spr_bit",
12731
14
          FT_BOOLEAN, 8, NULL, 0x08,
12732
14
          NULL, HFILL}
12733
14
      },
12734
14
      {&hf_nrup_dl_discrd_blks,
12735
14
        { "DL Discard Blocks", "nrup.dl_disc_blks",
12736
14
          FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
12737
14
          "Presence of DL discard Number of blocks, discard NR PDCP PDU SN start and Discarded Block size", HFILL}
12738
14
      },
12739
14
      {&hf_nrup_dl_flush,
12740
14
       { "DL Flush", "nrup.dl_flush",
12741
14
         FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
12742
14
         "Presence of DL discard NR PDCP PDU SN", HFILL}
12743
14
      },
12744
14
      {&hf_nrup_rpt_poll,
12745
14
        { "Report Polling", "nrup.report_polling",
12746
14
          FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
12747
14
          "Indicates that the node hosting the NR PDCP entity requests providing the downlink delivery status report", HFILL}
12748
14
      },
12749
14
      {&hf_nrup_retransmission_flag,
12750
14
        { "Retransmission Flag", "nrup.retransmission_flag",
12751
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12752
14
           "Indicates whether the NR PDCP PDU is a retransmission NR-U packet sent by the node hosting the NR PDCP entity to the corresponding node", HFILL}
12753
14
      },
12754
14
      { &hf_nrup_ass_inf_rep_poll_flag,
12755
14
        { "Assistance Info. Report Polling Flag", "nrup.ass_inf_rep_poll_flag",
12756
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12757
14
           NULL, HFILL }
12758
14
      },
12759
14
      { &hf_nrup_spare,
12760
14
        { "Spare", "nrup.spare",
12761
14
           FT_UINT8, BASE_DEC, NULL, 0xe0,
12762
14
           NULL, HFILL }
12763
14
      },
12764
14
      { &hf_nrup_request_out_of_seq_report,
12765
14
        { "Request Out Of Seq Report", "nrup.request_out_of_seq_report",
12766
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12767
14
           NULL, HFILL}
12768
14
      },
12769
12770
14
      {&hf_nrup_report_delivered,
12771
14
         { "Report Delivered", "nrup.report_delivered",
12772
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12773
14
           "Presence of DL report NR PDCP PDU SN", HFILL}
12774
14
      },
12775
14
      {&hf_nrup_user_data_existence_flag,
12776
14
         { "User Data Existence Flag", "nrup.user_data_existence_flag",
12777
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12778
14
           "Whether the node hosting the NR PDCP entity has some user data for the concerned data radio bearer", HFILL}
12779
14
      },
12780
14
      {&hf_nrup_nr_u_seq_num,
12781
14
         { "NR-U Sequence Number", "nrup.seq_num",
12782
14
           FT_UINT24, BASE_DEC, NULL, 0,
12783
14
           "NR-U sequence number as assigned by the node hosting the NR PDCP entity", HFILL}
12784
14
      },
12785
14
      {&hf_nrup_dl_disc_nr_pdcp_pdu_sn,
12786
14
         { "DL discard NR PDCP PDU SN", "nrup.dl_disc_nr_pdcp_pdu_sn",
12787
14
           FT_UINT24, BASE_DEC, NULL, 0,
12788
14
           NULL, HFILL}
12789
14
      },
12790
14
      {&hf_nrup_dl_disc_num_blks,
12791
14
         { "DL discard Number of blocks", "nrup.dl_disc_num_blks",
12792
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12793
14
           NULL, HFILL}
12794
14
      },
12795
14
      {&hf_nrup_dl_disc_nr_pdcp_pdu_sn_start,
12796
14
         { "DL discard NR PDCP PDU SN Start", "nrup.dl_disc_nr_pdcp_pdu_sn_start",
12797
14
           FT_UINT24, BASE_DEC, NULL, 0,
12798
14
           NULL, HFILL}
12799
14
      },
12800
14
      {&hf_nrup_dl_disc_blk_sz,
12801
14
         { "Discarded block size", "nrup.disc_blk_sz",
12802
14
           FT_UINT8, BASE_DEC, NULL, 0,
12803
14
           "The number of NR PDCP PDUs counted from the starting SN to be discarded", HFILL}
12804
14
      },
12805
14
       {&hf_nrup_dl_report_nr_pdcp_pdu_sn,
12806
14
          { "DL report NR PDCP PDU SN", "nrup.dl_report_nr_pdcp_pdu_sn",
12807
14
            FT_UINT24, BASE_DEC, NULL, 0,
12808
14
            "DL delivery status report wanted when this SN has been delivered", HFILL}
12809
14
       },
12810
12811
14
      {&hf_nrup_high_tx_nr_pdcp_sn_ind,
12812
14
         { "Highest Transmitted NR PDCP SN Ind", "nrup.high_tx_nr_pdcp_sn_ind",
12813
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12814
14
           NULL, HFILL}
12815
14
      },
12816
14
      {&hf_nrup_high_delivered_nr_pdcp_sn_ind,
12817
14
         { "Highest Delivered NR PDCP SN Ind", "nrup.high_delivered_nr_pdcp_sn_ind",
12818
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12819
14
           NULL, HFILL}
12820
14
      },
12821
14
      {&hf_nrup_final_frame_ind,
12822
14
         { "Final Frame Indication", "nrup.final_frame_ind",
12823
14
           FT_BOOLEAN, 8, TFS(&tfs_final_frame_indication), 0x02,
12824
14
           "Whether the frame is the last DL status report", HFILL}
12825
14
      },
12826
14
      {&hf_nrup_lost_pkt_rpt,
12827
14
         { "Lost Packet Report", "nrup.lost_pkt_rpt",
12828
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12829
14
           "Indicates the presence of Number of lost NR-U Sequence Number ranges reported" , HFILL}
12830
14
      },
12831
14
      {&hf_nrup_high_retx_nr_pdcp_sn_ind,
12832
14
         { "Highest Retransmitted NR PDCP SN Ind", "nrup.high_retx_nr_pdcp_sn_ind",
12833
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12834
14
           NULL, HFILL}
12835
14
      },
12836
14
      {&hf_nrup_cause_rpt,
12837
14
         { "Cause Report", "nrup.cause_rpt",
12838
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12839
14
           "Presence of Cause Value", HFILL}
12840
14
      },
12841
14
      {&hf_nrup_delivered_nr_pdcp_sn_range_ind,
12842
14
         { "Delivered NR PDCP SN Range Ind", "nrup.delivered_nr_pdcp_sn_range_ind",
12843
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12844
14
           NULL, HFILL}
12845
14
      },
12846
14
      {&hf_nrup_data_rate_ind,
12847
14
         { "Data Rate Ind", "nrup.data_rate_ind",
12848
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12849
14
           NULL, HFILL}
12850
14
      },
12851
14
      {&hf_nrup_desrd_buff_sz_data_radio_bearer,
12852
14
         { "Desired buffer size for the data radio bearer", "nrup.desrd_buff_sz_data_radio_bearer",
12853
14
           FT_UINT32, BASE_DEC, NULL, 0,
12854
14
           NULL, HFILL}
12855
14
      },
12856
14
      {&hf_nrup_high_delivered_retx_nr_pdcp_sn_ind,
12857
14
         { "Highest Delivered Retransmitted NR PDCP SN Ind", "nrup.high_delivered_retx_nr_pdcp_sn_ind",
12858
14
           FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12859
14
           NULL, HFILL}
12860
14
      },
12861
14
      {&hf_nrup_desrd_data_rate,
12862
14
         { "Desired data rate", "nrup.desrd_data_rate",
12863
14
           FT_UINT32, BASE_DEC, NULL, 0,
12864
14
           NULL, HFILL}
12865
14
      },
12866
14
      {&hf_nrup_num_lost_nru_seq_num,
12867
14
         { "Number of lost NR-U Sequence Number ranges reported", "nrup.num_lost_nru_seq_num",
12868
14
           FT_UINT8, BASE_DEC, NULL, 0,
12869
14
           NULL, HFILL}
12870
14
      },
12871
14
      {&hf_nrup_start_lost_nru_seq_num,
12872
14
         { "Start of lost NR-U Sequence Number range", "nrup.start_num_lost_nru_seq_num",
12873
14
           FT_UINT24, BASE_DEC, NULL, 0,
12874
14
           NULL, HFILL}
12875
14
      },
12876
14
      {&hf_nrup_end_lost_nru_seq_num,
12877
14
         { "End of lost NR-U Sequence Number range", "nrup.end_num_lost_nru_seq_num",
12878
14
           FT_UINT24, BASE_DEC, NULL, 0,
12879
14
           NULL, HFILL}
12880
14
      },
12881
14
      {&hf_nrup_high_success_delivered_nr_pdcp_sn,
12882
14
         { "Highest Successfully Delivered NR PDCP SN", "nrup.high_success_delivered_nr_pdcp_sn",
12883
14
           FT_UINT24, BASE_DEC, NULL, 0,
12884
14
           NULL, HFILL}
12885
14
      },
12886
14
      {&hf_nrup_high_tx_nr_pdcp_sn,
12887
14
         { "Highest transmitted NR PDCP SN", "nrup.high_tx_nr_pdcp_sn",
12888
14
           FT_UINT24, BASE_DEC, NULL, 0,
12889
14
           NULL, HFILL}
12890
14
      },
12891
14
      {&hf_nrup_cause_val ,
12892
14
         { "Cause Value", "nrup.cause_val",
12893
14
           FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(nr_up_cause_vals), 0,
12894
14
           "Indicates specific events reported by the corresponding node", HFILL}
12895
14
      },
12896
14
      {&hf_nrup_high_success_delivered_retx_nr_pdcp_sn,
12897
14
         { "Highest Successfully Delivered Retransmitted NR PDCP SN", "nrup.high_success_delivered_retx_nr_pdcp_sn",
12898
14
           FT_UINT24, BASE_DEC, NULL, 0,
12899
14
           NULL, HFILL}
12900
14
      },
12901
14
      {&hf_nrup_high_retx_nr_pdcp_sn,
12902
14
         { "Highest Retransmitted NR PDCP SN Ind", "nrup.high_retx_nr_pdcp_sn",
12903
14
           FT_UINT24, BASE_DEC, NULL, 0,
12904
14
           NULL, HFILL}
12905
14
      },
12906
12907
14
      {&hf_nrup_pdcp_duplication_ind,
12908
14
         { "PDCP Duplication Indication", "nrup.pdcp_duplication_ind",
12909
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
12910
14
           NULL, HFILL}
12911
14
      },
12912
14
      {&hf_nrup_assistance_information_ind,
12913
14
         { "Assistance Information Indication", "nrup.assistance_information_ind",
12914
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
12915
14
           NULL, HFILL}
12916
14
      },
12917
14
      {&hf_nrup_ul_delay_ind,
12918
14
         { "UL Delay Indicator", "nrup.ul_delay_ind",
12919
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
12920
14
           NULL, HFILL}
12921
14
      },
12922
14
      {&hf_nrup_dl_delay_ind,
12923
14
         { "DL Delay Indicator", "nrup.dl_delay_ind",
12924
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
12925
14
           NULL, HFILL}
12926
14
      },
12927
14
      {&hf_nrup_spare_2,
12928
14
         { "Spare", "nrup.spare",
12929
14
           FT_UINT8, BASE_HEX, NULL, 0xfe,
12930
14
           NULL, HFILL}
12931
14
      },
12932
14
      {&hf_nrup_pdcp_duplication_activation_suggestion,
12933
14
         { "PDCP Duplication Activation Suggestion", "nrup.pdcp_duplication_activation_suggestion",
12934
14
           FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
12935
14
           NULL, HFILL}
12936
14
      },
12937
14
      {&hf_nrup_num_assistance_info_fields,
12938
14
         { "Number of Assistance Information Fields", "nrup.num_assistance_info_fields",
12939
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12940
14
           NULL, HFILL}
12941
14
      },
12942
14
      {&hf_nrup_assistance_information_type,
12943
14
         { "Assistance Information Type", "nrup.assistance_info_type",
12944
14
           FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(assistance_info_type), 0x0,
12945
14
           NULL, HFILL}
12946
14
      },
12947
14
      {&hf_nrup_num_octets_radio_qa_info,
12948
14
         { "Number of octets for Radio Quality Assistance Information Fields", "nrup.num_octets_radio_qa_info",
12949
14
           FT_UINT8, BASE_DEC, NULL, 0x0,
12950
14
           NULL, HFILL}
12951
14
      },
12952
14
      {&hf_nrup_radio_qa_info,
12953
14
         { "Radio Quality Assistance Information", "nrup.radio_qa_info",
12954
14
           FT_BYTES, BASE_NONE, NULL, 0x0,
12955
14
           NULL, HFILL}
12956
14
      },
12957
14
      {&hf_nrup_ul_delay_du_result,
12958
14
         { "UL Delay DU Result", "nrup.ul_delay_du_result",
12959
14
           FT_UINT32, BASE_DEC, NULL, 0x0,
12960
14
           NULL, HFILL}
12961
14
      },
12962
14
      {&hf_nrup_dl_delay_du_result,
12963
14
         { "DL Delay DU Result", "nrup.dl_delay_du_result",
12964
14
           FT_UINT32, BASE_DEC, NULL, 0x0,
12965
14
           NULL, HFILL}
12966
14
      }
12967
14
    };
12968
12969
12970
14
    static ei_register_info ei[] = {
12971
14
        { &ei_gtp_ext_length_mal, { "gtp.ext_length.invalid", PI_MALFORMED, PI_ERROR, "Malformed length", EXPFILL }},
12972
14
        { &ei_gtp_ext_hdr_pdcpsn, { "gtp.ext_hdr.pdcp_sn.non_zero", PI_PROTOCOL, PI_NOTE, "3GPP TS 29.281 v9.0.0: When used between two eNBs at the X2 interface in E-UTRAN, bit 8 of octet 2 is spare. The meaning of the spare bits shall be set to zero.", EXPFILL }},
12973
14
        { &ei_gtp_ext_length_warn, { "gtp.ext_length.invalid", PI_PROTOCOL, PI_WARN, "Length warning", EXPFILL }},
12974
14
        { &ei_gtp_undecoded, { "gtp.undecoded", PI_UNDECODED, PI_WARN, "Data not decoded yet", EXPFILL }},
12975
14
        { &ei_gtp_message_not_found, { "gtp.message_not_found", PI_PROTOCOL, PI_WARN, "Message not found", EXPFILL }},
12976
14
        { &ei_gtp_field_not_present, { "gtp.field_not_present", PI_PROTOCOL, PI_WARN, "Field not present", EXPFILL }},
12977
14
        { &ei_gtp_wrong_next_field, { "gtp.wrong_next_field", PI_PROTOCOL, PI_WARN, "Wrong next field", EXPFILL }},
12978
14
        { &ei_gtp_field_not_support_in_version, { "gtp.field_not_support_in_version", PI_PROTOCOL, PI_WARN, "GTP version not supported for field", EXPFILL }},
12979
14
        { &ei_gtp_guaranteed_bit_rate_value, { "gtp.guaranteed_bit_rate_value", PI_PROTOCOL, PI_NOTE, "Use the value indicated by the Guaranteed bit rate", EXPFILL }},
12980
14
        { &ei_gtp_max_bit_rate_value, { "gtp.max_bit_rate_value", PI_PROTOCOL, PI_NOTE, "Use the value indicated by the Maximum bit rate", EXPFILL }},
12981
14
        { &ei_gtp_ext_geo_loc_type, { "gtp.ext_geo_loc_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown Location type data", EXPFILL }},
12982
14
        { &ei_gtp_iei, { "gtp.iei.unknown", PI_PROTOCOL, PI_WARN, "Unknown IEI - Later spec than TS 29.060 9.4.0 used?", EXPFILL }},
12983
14
        { &ei_gtp_unknown_extension_header, { "gtp.unknown_extension_header", PI_PROTOCOL, PI_WARN, "Unknown extension header", EXPFILL }},
12984
14
        { &ei_gtp_unknown_pdu_type, { "gtp.unknown_pdu_type", PI_PROTOCOL, PI_WARN, "Unknown PDU type", EXPFILL }},
12985
14
        { &ei_gtp_source_type_unknown, { "gtp.source_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown source type", EXPFILL }},
12986
14
        { &ei_gtp_cdr_rel_ext_invalid, { "gtp.cdr_rel_ext.invalid", PI_PROTOCOL, PI_WARN, "If Release Identifier is 0, Release Identifier Extension must be >= 16", EXPFILL}},
12987
14
    };
12988
12989
    /* Setup protocol subtree array */
12990
14
#define GTP_NUM_INDIVIDUAL_ELEMS    39
12991
14
    static int *ett_gtp_array[GTP_NUM_INDIVIDUAL_ELEMS + NUM_GTP_IES];
12992
12993
14
    ett_gtp_array[0] = &ett_gtp;
12994
14
    ett_gtp_array[1] = &ett_gtp_flags;
12995
14
    ett_gtp_array[2] = &ett_gtp_ext;
12996
14
    ett_gtp_array[3] = &ett_gtp_cdr_dr;
12997
14
    ett_gtp_array[4] = &ett_gtp_qos;
12998
14
    ett_gtp_array[5] = &ett_gtp_qos_arp;
12999
14
    ett_gtp_array[6] = &ett_gtp_flow_ii;
13000
14
    ett_gtp_array[7] = &ett_gtp_ext_hdr;
13001
14
    ett_gtp_array[8] = &ett_gtp_rp;
13002
14
    ett_gtp_array[9] = &ett_gtp_pkt_flow_id;
13003
14
    ett_gtp_array[10] = &ett_gtp_data_resp;
13004
14
    ett_gtp_array[11] = &ett_gtp_cdr_ver;
13005
14
    ett_gtp_array[12] = &ett_gtp_tmgi;
13006
14
    ett_gtp_array[13] = &ett_gtp_trip;
13007
14
    ett_gtp_array[14] = &ett_gtp_quint;
13008
14
    ett_gtp_array[15] = &ett_gtp_drx;
13009
14
    ett_gtp_array[16] = &ett_gtp_net_cap;
13010
14
    ett_gtp_array[17] = &ett_gtp_can_pack;
13011
14
    ett_gtp_array[18] = &ett_gtp_proto;
13012
14
    ett_gtp_array[19] = &ett_gtp_gsn_addr;
13013
14
    ett_gtp_array[20] = &ett_gtp_tft;
13014
14
    ett_gtp_array[21] = &ett_gtp_rab_setup;
13015
14
    ett_gtp_array[22] = &ett_gtp_hdr_list;
13016
14
    ett_gtp_array[23] = &ett_gtp_rel_pack;
13017
14
    ett_gtp_array[24] = &ett_gtp_node_addr;
13018
14
    ett_gtp_array[25] = &ett_gtp_mm_cntxt;
13019
14
    ett_gtp_array[26] = &ett_gtp_utran_cont;
13020
14
    ett_gtp_array[27] = &ett_gtp_nr_ran_cont;
13021
14
    ett_gtp_array[28] = &ett_gtp_pdcp_no_conf;
13022
14
    ett_gtp_array[29] = &ett_pdu_session_cont;
13023
14
    ett_gtp_array[30] = &ett_gtp_trace_triggers_ggsn;
13024
14
    ett_gtp_array[31] = &ett_gtp_trace_loi_ggsn;
13025
14
    ett_gtp_array[32] = &ett_gtp_trace_triggers_bm_sc;
13026
14
    ett_gtp_array[33] = &ett_gtp_trace_loi_bm_sc;
13027
14
    ett_gtp_array[34] = &ett_gtp_bss_cont;
13028
14
    ett_gtp_array[35] = &ett_gtp_lst_set_up_pfc;
13029
14
    ett_gtp_array[36] = &ett_gtp_rrc_cont;
13030
14
    ett_gtp_array[37] = &ett_gtp_rim_routing_adr;
13031
14
    ett_gtp_array[38] = &ett_nrup;
13032
13033
14
    last_offset = GTP_NUM_INDIVIDUAL_ELEMS;
13034
13035
3.58k
    for (i=0; i < NUM_GTP_IES; i++, last_offset++)
13036
3.57k
    {
13037
3.57k
        ett_gtp_array[last_offset] = &ett_gtp_ies[i];
13038
3.57k
    }
13039
13040
13041
14
    proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
13042
14
    proto_gtpprime = proto_register_protocol("GPRS Tunneling Protocol Prime", "GTP (Prime)", "gtpprime");
13043
13044
14
    proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
13045
14
    proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
13046
14
    expert_gtp = expert_register_protocol(proto_gtp);
13047
14
    expert_register_field_array(expert_gtp, ei, array_length(ei));
13048
13049
14
    proto_nrup = proto_register_protocol("NRUP", "NRUP", "nrup");
13050
14
    proto_register_field_array(proto_nrup, hf_nrup, array_length(hf_nrup));
13051
13052
13053
14
    gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
13054
    /* For reading older preference files with "gtpv0." or "gtpv1." preferences */
13055
14
    prefs_register_module_alias("gtpv0", gtp_module);
13056
14
    prefs_register_module_alias("gtpv1", gtp_module);
13057
13058
14
    prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 and GTP' port", "GTPv0 and GTP' port (default 3386)", 10, &g_gtpv0_port);
13059
14
    prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 or GTPv2 control plane (GTP-C, GTPv2-C) port", "GTPv1 and GTPv2 control plane port (default 2123)", 10,
13060
14
                                   &g_gtpv1c_port);
13061
14
    prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
13062
14
                                   &g_gtpv1u_port);
13063
14
    prefs_register_enum_preference(gtp_module, "dissect_tpdu_as",
13064
14
                                               "Dissect T-PDU as",
13065
14
                                               "Dissect T-PDU as",
13066
14
                                               &dissect_tpdu_as,
13067
14
                                               gtp_decode_tpdu_as,
13068
14
                                               false);
13069
14
    prefs_register_uint_preference(gtp_module, "pair_max_interval", "Max interval allowed in pair matching", "Request/reply pair matches only if their timestamps are closer than that value, in ms (default 0, i.e. don't use timestamps)", 10, &pref_pair_matching_max_interval_ms);
13070
13071
14
    prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
13072
14
    prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
13073
14
    prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
13074
14
    prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
13075
14
    prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
13076
14
    prefs_register_obsolete_preference(gtp_module, "dissect_tpdu");
13077
13078
    /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
13079
     * The preference is set to true by default forbackward compatibility
13080
     */
13081
14
    prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
13082
14
    prefs_register_bool_preference(gtp_module, "track_gtp_session", "Track GTP session", "Track GTP session", &g_gtp_session);
13083
13084
    /* --- PDCP DECODE ADDITIONS --- */
13085
13086
14
    static uat_field_t pdcp_lte_keys_uat_flds[] = {
13087
14
        UAT_FLD_CSTRING_OTHER(pdcp_lte_users, ip_addr_str, "Dst IP address", pdcp_uat_fld_ip_chk_cb, "IPv4 or IPv6 address"),
13088
14
        UAT_FLD_CSTRING_OTHER(pdcp_lte_users, teid_str, "TEID value  or \"" PDCP_TEID_WILDCARD "\"", pdcp_uat_fld_teid_chk_cb, "Tunnel Endpoint Identifier"),
13089
14
        UAT_FLD_VS(pdcp_lte_users, direction, "Direction", vs_direction, "Direction of frames"),
13090
14
        UAT_FLD_VS(pdcp_lte_users, header_present, "Header present", vs_header_present, "Header present flag"),
13091
14
        UAT_FLD_VS(pdcp_lte_users, plane, "Plane", vs_pdcp_plane, "Signaling or user plane"),
13092
14
        UAT_FLD_VS(pdcp_lte_users, lte_sn_length, "PDCP SN length", vs_pdcp_lte_sn_length, "Length of PDCP sequence number"),
13093
14
        UAT_FLD_VS(pdcp_lte_users, rohc_compression, "ROHC compression", vs_rohc_compression, "Header compression"),
13094
        //UAT_FLD_VS(pdcp_lte_users, rohc_mode, "ROHC mode", vs_rohc_mode, "ROHC mode"),
13095
14
        UAT_FLD_VS(pdcp_lte_users, rohc_profile, "ROHC profile", vs_rohc_profile, "ROHC profile"),
13096
14
        UAT_FLD_DEC(pdcp_lte_users, ue_id, "UE Id", "UE Identifier to match other PDCP config"),
13097
14
        UAT_FLD_DEC(pdcp_lte_users, rb_id, "RB Id", "Radio Bearer Identifier"),
13098
14
        UAT_END_FIELDS
13099
14
    };
13100
13101
14
    pdcp_lte_keys_uat = uat_new("PDCP-LTE Keys",
13102
14
        sizeof(uat_pdcp_lte_keys_record_t), /* record size */
13103
14
        "gtp_pdcp_lte_keys2",                /* filename */
13104
14
        true,                               /* from_profile */
13105
14
        &uat_pdcp_lte_keys_records,         /* data_ptr */
13106
14
        &num_pdcp_lte_keys_uat,             /* numitems_ptr */
13107
14
        UAT_AFFECTS_DISSECTION,             /* affects dissection of packets, but not set of named fields */
13108
14
        NULL,                               /* help */
13109
14
        pdcp_lte_copy_cb,                   /* copy callback */
13110
14
        pdcp_lte_update_cb,                 /* update callback */
13111
14
        pdcp_lte_free_cb,                   /* free callback */
13112
14
        NULL,                               /* post update callback */
13113
14
        NULL,                               /* reset callback */
13114
14
        pdcp_lte_keys_uat_flds);            /* UAT field definitions */
13115
13116
13117
14
    prefs_register_uat_preference(gtp_module,
13118
14
        "pdcp_lte_table",
13119
14
        "GTP PDCP-LTE Keys",
13120
14
        "Preconfigured PDCP-LTE Keys",
13121
14
        pdcp_lte_keys_uat);
13122
13123
14
    static uat_field_t pdcp_nr_keys_uat_flds[] = {
13124
14
        UAT_FLD_CSTRING_OTHER(pdcp_nr_users, ip_addr_str, "Dst IP address", pdcp_uat_fld_ip_chk_cb, "IPv4 or IPv6 address"),
13125
14
        UAT_FLD_CSTRING_OTHER(pdcp_nr_users, teid_str, "TEID value or \"" PDCP_TEID_WILDCARD "\"", pdcp_uat_fld_teid_chk_cb, "Tunnel Endpoint Identifier"),
13126
14
        UAT_FLD_VS(pdcp_nr_users, direction, "Direction", vs_direction, "Direction of frames"),
13127
14
        UAT_FLD_VS(pdcp_nr_users, sdap_header_present, "SDAP header present flag", vs_sdap_header_present, "SDAP header present flag"),
13128
14
        UAT_FLD_VS(pdcp_nr_users, mac_i_present, "MAC-I present flag", vs_mac_i_present, "MAC-I present flag"),
13129
14
        UAT_FLD_VS(pdcp_nr_users, plane, "Plane", vs_pdcp_plane, "Signaling or user plane"),
13130
14
        UAT_FLD_VS(pdcp_nr_users, pdcp_nr_sn_length, "PDCP SN length", vs_pdcp_nr_sn_length, "Length of PDCP sequence number"),
13131
14
        UAT_FLD_VS(pdcp_nr_users, rohc_compression, "ROHC compression", vs_rohc_compression, "Header compression"),
13132
        //UAT_FLD_VS(pdcp_nr_users, rohc_mode, "ROHC mode", vs_rohc_mode, "ROHC mode"),
13133
14
        UAT_FLD_VS(pdcp_nr_users, rohc_profile, "ROHC profile", vs_rohc_profile, "ROHC profile"),
13134
14
        UAT_FLD_DEC(pdcp_nr_users, ue_id, "UE Id", "UE Identifier to match other PDCP config"),
13135
14
        UAT_FLD_DEC(pdcp_nr_users, rb_id, "RB Id", "Radio Bearer Identifier"),
13136
14
        UAT_END_FIELDS
13137
14
    };
13138
13139
14
    pdcp_nr_keys_uat = uat_new("PDCP-NR Keys",
13140
14
        sizeof(uat_pdcp_nr_keys_record_t), /* record size */
13141
14
        "gtp_pdcp_nr_keys2",                /* filename */
13142
14
        true,                              /* from_profile */
13143
14
        &uat_pdcp_nr_keys_records,         /* data_ptr */
13144
14
        &num_pdcp_nr_keys_uat,             /* numitems_ptr */
13145
14
        UAT_AFFECTS_DISSECTION,            /* affects dissection of packets, but not set of named fields */
13146
14
        NULL,                              /* help */
13147
14
        pdcp_nr_copy_cb,                   /* copy callback */
13148
14
        pdcp_nr_update_cb,                 /* update callback */
13149
14
        pdcp_nr_free_cb,                   /* free callback */
13150
14
        NULL,                              /* post update callback */
13151
14
        NULL,                              /* reset callback */
13152
14
        pdcp_nr_keys_uat_flds);            /* UAT field definitions */
13153
13154
    /* Set default values for new entries to this table.  Choosing SRB-1 (DL) */
13155
    /* N.B. currently doesn't seem to work.. */
13156
14
    static const char *nr_keys_uat_defaults_[] = {
13157
14
        NULL, /*dst-address*/
13158
14
        "*",  /*teid*/
13159
14
        PDCP_DIRECTION_DOWNLINK_STR, PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR, MAC_I_PRESENT_TRUE_STR,
13160
14
        SIGNALING_PLANE_STR, PDCP_SN_LENGTH_12_BITS_STR, ROHC_COMPRESSION_FALSE_STR, ROHC_PROFILE_UNCOMPRESSED_STR,
13161
14
        "1", /*ueid*/ "1" /*rb*/
13162
14
    };
13163
14
    uat_set_default_values(pdcp_nr_keys_uat, nr_keys_uat_defaults_);
13164
13165
13166
14
    prefs_register_uat_preference(gtp_module,
13167
14
        "pdcp_nr_table",
13168
14
        "GTP PDCP-NR Keys",
13169
14
        "Preconfigured PDCP-NR Keys",
13170
14
        pdcp_nr_keys_uat);
13171
13172
    /* --- END PDCP NR DECODE ADDITIONS ---*/
13173
13174
14
    gtp_handle = register_dissector("gtp", dissect_gtp, proto_gtp);
13175
14
    gtp_prime_handle = register_dissector("gtpprime", dissect_gtpprime, proto_gtpprime);
13176
14
    nrup_handle = register_dissector("nrup", dissect_nrup, proto_nrup);
13177
13178
14
    gtp_priv_ext_dissector_table = register_dissector_table("gtp.priv_ext", "GTP Private Extension", proto_gtp, FT_UINT16, BASE_DEC);
13179
14
    gtp_cdr_fmt_dissector_table = register_dissector_table("gtp.cdr_fmt", "GTP Data Record Type", proto_gtp, FT_UINT16, BASE_DEC);
13180
14
    gtp_hdr_ext_dissector_table = register_dissector_table("gtp.hdr_ext", "GTP Header Extension", proto_gtp, FT_UINT16, BASE_DEC);
13181
13182
14
    session_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
13183
14
    frame_map = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), gtp_info_hash, gtp_info_equal);
13184
14
    register_init_routine(gtp_init);
13185
14
    gtp_tap = register_tap("gtp");
13186
14
    gtpv1_tap = register_tap("gtpv1");
13187
13188
14
    register_srt_table(proto_gtp, NULL, 1, gtpstat_packet, gtpstat_init, NULL);
13189
13190
14
    heur_subdissector_list = register_heur_dissector_list("gtp.tpdu", proto_gtp);
13191
14
}
13192
/* TS 132 295 V9.0.0 (2010-02)
13193
 * 5.1.3 Port usage
13194
 * - The UDP Destination Port may be the server port number 3386 which has been reserved for GTP'.
13195
 * Alternatively another port can be used, which has been configured by O&M, except Port Number 2123
13196
 * which is used by GTPv2-C.
13197
 * :
13198
 * The TCP Destination Port may be the server port number 3386, which has been reserved for G-PDUs. Alternatively,
13199
 * another port may be used as configured by O&M. Extra implementation-specific destination ports are possible but
13200
 * all CGFs shall support the server port number.
13201
 */
13202
13203
void
13204
proto_reg_handoff_gtp(void)
13205
14
{
13206
14
    static bool               Initialized = false;
13207
14
    static bool               gtp_over_tcp;
13208
14
    static unsigned           gtpv0_port;
13209
14
    static unsigned           gtpv1c_port;
13210
14
    static unsigned           gtpv1u_port;
13211
13212
14
    if (!Initialized) {
13213
13214
14
        radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
13215
14
        radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
13216
13217
14
        eth_handle           = find_dissector_add_dependency("eth_withoutfcs", proto_gtp);
13218
14
        ip_handle            = find_dissector_add_dependency("ip", proto_gtp);
13219
14
        ipv6_handle          = find_dissector_add_dependency("ipv6", proto_gtp);
13220
14
        ppp_handle           = find_dissector_add_dependency("ppp", proto_gtp);
13221
14
        sync_handle          = find_dissector_add_dependency("sync", proto_gtp);
13222
14
        gtpcdr_handle        = find_dissector_add_dependency("gtpcdr", proto_gtp);
13223
14
        sndcpxid_handle      = find_dissector_add_dependency("sndcpxid", proto_gtp);
13224
14
        gtpv2_handle         = find_dissector_add_dependency("gtpv2", proto_gtp);
13225
14
        bssgp_handle         = find_dissector_add_dependency("bssgp", proto_gtp);
13226
14
        pdcp_nr_handle       = find_dissector_add_dependency("pdcp-nr", proto_gtp);
13227
14
        pdcp_lte_handle      = find_dissector_add_dependency("pdcp-lte", proto_gtp);
13228
14
        proto_pdcp_lte       = dissector_handle_get_protocol_index(pdcp_lte_handle);
13229
13230
14
        bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
13231
        /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
13232
14
        dissector_add_uint("diameter.3gpp", 5, create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
13233
        /* AVP Code: 903 MBMS-Service-Area */
13234
14
        dissector_add_uint("diameter.3gpp", 903, create_dissector_handle(dissect_gtp_3gpp_mbms_service_area, proto_gtp));
13235
        /* AVP Code: 904 MBMS-Session-Duration */
13236
14
        dissector_add_uint("diameter.3gpp", 904, create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
13237
        /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
13238
14
        dissector_add_uint("diameter.3gpp", 911, create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
13239
13240
        // TPDU payload detection
13241
14
        int eth_proto_id = dissector_handle_get_protocol_index(eth_handle);
13242
14
        heur_dissector_add("gtp.tpdu", dissect_eth_heur, "Ethernet over GTP", "eth_gtp.tpdu", eth_proto_id, HEURISTIC_ENABLE);
13243
13244
14
        Initialized = true;
13245
14
    } else {
13246
0
        dissector_delete_uint("udp.port", gtpv0_port,  gtp_prime_handle);
13247
0
        dissector_delete_uint("udp.port", gtpv1c_port, gtp_handle);
13248
0
        dissector_delete_uint("udp.port", gtpv1u_port, gtp_handle);
13249
13250
0
        if (gtp_over_tcp) {
13251
0
            dissector_delete_uint("tcp.port", gtpv0_port,  gtp_prime_handle);
13252
0
            dissector_delete_uint("tcp.port", gtpv1c_port, gtp_handle);
13253
0
            dissector_delete_uint("tcp.port", gtpv1u_port, gtp_handle);
13254
0
        }
13255
0
    }
13256
13257
14
    gtp_over_tcp = g_gtp_over_tcp;
13258
14
    gtpv0_port   = g_gtpv0_port;
13259
14
    gtpv1c_port  = g_gtpv1c_port;
13260
14
    gtpv1u_port  = g_gtpv1u_port;
13261
13262
    /* This doesn't use the "auto preference" API because the port
13263
        description is too specific */
13264
14
    dissector_add_uint("udp.port", g_gtpv0_port, gtp_prime_handle);
13265
14
    dissector_add_uint("udp.port", g_gtpv1c_port, gtp_handle);
13266
14
    dissector_add_uint("udp.port", g_gtpv1u_port, gtp_handle);
13267
13268
14
    if (g_gtp_over_tcp) {
13269
        /* This doesn't use the "auto preference" API because the port
13270
           description is too specific */
13271
14
        dissector_add_uint("tcp.port", g_gtpv0_port, gtp_prime_handle);
13272
14
        dissector_add_uint("tcp.port", g_gtpv1c_port, gtp_handle);
13273
14
        dissector_add_uint("tcp.port", g_gtpv1u_port, gtp_handle);
13274
14
    }
13275
14
}
13276
13277
/*
13278
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
13279
 *
13280
 * Local variables:
13281
 * c-basic-offset: 4
13282
 * tab-width: 8
13283
 * indent-tabs-mode: nil
13284
 * End:
13285
 *
13286
 * vi: set shiftwidth=4 tabstop=8 expandtab:
13287
 * :indentSize=4:tabSize=8:noTabs=true:
13288
 */