MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-gtpv2.c
blobed022bc552c860e5f46d98b284c51962269733ed
1 /* packet-gtpv2.c
3 * Routines for GTPv2 dissection
4 * Copyright 2009 - 2012, Anders Broman <anders.broman [at] ericcsson.com>
6 * $Id$
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * Ref: 3GPP TS 29.274 version 11.1.0 Release 11 ETSI TS 129 274 V8.1.1 (2009-04)
28 #include "config.h"
30 #include <glib.h>
32 #include <epan/packet.h>
33 #include <epan/to_str.h>
34 #include <epan/asn1.h>
35 #include <epan/expert.h>
36 #include <epan/sminmpec.h>
38 #include "packet-gsm_a_common.h"
39 #include "packet-gsm_map.h"
40 #include "packet-e164.h"
41 #include "packet-e212.h"
42 #include "packet-s1ap.h"
43 #include "packet-ranap.h"
44 #include "packet-bssgp.h"
45 #include "packet-ntp.h"
47 static dissector_handle_t nas_eps_handle;
48 static dissector_table_t gtpv2_priv_ext_dissector_table;
51 /*GTPv2 Message->GTP Header(SB)*/
52 static int proto_gtpv2 = -1;
54 static int hf_gtpv2_reserved = -1;
55 static int hf_gtpv2_spare_half_octet = -1;
56 static int hf_gtpv2_spare_bits = -1;
57 static int hf_gtpv2_flags = -1;
58 static int hf_gtpv2_version = -1;
59 static int hf_gtpv2_p = -1;
60 static int hf_gtpv2_t = -1;
61 static int hf_gtpv2_message_type = -1;
62 static int hf_gtpv2_msg_length = -1;
63 static int hf_gtpv2_teid = -1;
64 static int hf_gtpv2_seq = -1;
65 static int hf_gtpv2_spare = -1;
68 static int hf_gtpv2_ie = -1;
69 static int hf_gtpv2_ie_len = -1;
70 static int hf_gtpv2_cr = -1;
71 static int hf_gtpv2_instance = -1;
72 static int hf_gtpv2_cause = -1;
73 static int hf_gtpv2_cause_cs = -1;
74 static int hf_gtpv2_cause_bce = -1;
75 static int hf_gtpv2_cause_pce = -1;
76 static int hf_gtpv2_cause_off_ie_t = -1;
77 static int hf_gtpv2_rec = -1;
78 /*Start SRVCC Messages*/
79 static int hf_gtpv2_stn_sr = -1;
80 static int hf_gtpv2_len_trans_con = -1;
81 static int hf_gtpv2_eksi = -1;
82 static int hf_gtpv2_ck = -1;
83 static int hf_gtpv2_ik = -1;
84 static int hf_gtpv2_len_ms_classmark2 = -1;
85 static int hf_gtpv2_len_ms_classmark3 = -1;
86 static int hf_gtpv2_len_supp_codec_list = -1;
87 static int hf_gtpv2_ksi = -1;
88 /*static int hf_gtpv2_kc = -1; */
89 static int hf_gtpv2_cksn = -1;
90 static int hf_gtpv2_srvcc_cause = -1;
91 static int hf_gtpv2_rac = -1;
92 static int hf_gtpv2_rnc_id = -1;
93 static int hf_gtpv2_ext_rnc_id = -1;
94 static int hf_gtpv2_lac = -1;
95 static int hf_gtpv2_sac = -1;
96 static int hf_gtpv2_tgt_g_cell_id = -1;
97 static int hf_gtpv2_teid_c = -1;
98 static int hf_gtpv2_sv_sti = -1;
99 static int hf_gtpv2_sv_ics = -1;
100 static int hf_gtpv2_sv_emind = -1;
101 /*End SRVCC Messages*/
102 static int hf_gtpv2_apn = -1;
103 static int hf_gtpv2_ebi = -1;
104 static int hf_gtpv2_daf = -1;
105 static int hf_gtpv2_dtf = -1;
106 static int hf_gtpv2_hi = -1;
107 static int hf_gtpv2_dfi = -1;
108 static int hf_gtpv2_oi = -1;
109 static int hf_gtpv2_isrsi = -1;
110 static int hf_gtpv2_israi = -1;
111 static int hf_gtpv2_sgwci = -1;
112 static int hf_gtpv2_sqci = -1;
113 static int hf_gtpv2_uimsi = -1;
114 static int hf_gtpv2_cfsi = -1;
115 static int hf_gtpv2_crsi = -1;
116 static int hf_gtpv2_pt = -1;
117 static int hf_gtpv2_ps = -1;
118 static int hf_gtpv2_si = -1;
119 static int hf_gtpv2_msv = -1;
120 static int hf_gtpv2_spare1 = -1;
121 static int hf_gtpv2_spare2 = -1;
122 static int hf_gtpv2_spare3 = -1;
123 static int hf_gtpv2_s6af = -1;
124 static int hf_gtpv2_s4af = -1;
125 static int hf_gtpv2_mbmdt = -1;
126 static int hf_gtpv2_israu = -1;
127 static int hf_gtpv2_ccrsi = -1;
128 static int hf_gtpv2_pdn_type = -1;
129 static int hf_gtpv2_pdn_ipv4 = -1;
130 static int hf_gtpv2_pdn_ipv6_len = -1;
131 static int hf_gtpv2_pdn_ipv6 = -1;
132 static int hf_gtpv2_pdn_numbers_nsapi = -1;
133 static int hf_gtpv2_p_tmsi = -1;
134 static int hf_gtpv2_p_tmsi_sig = -1;
135 static int hf_gtpv2_mmbr_ul = -1;
136 static int hf_gtpv2_mmbr_dl = -1;
138 static int hf_gtpv2_rat_type = -1;
139 static int hf_gtpv2_uli_ecgi_flg = -1;
140 static int hf_gtpv2_uli_lai_flg = -1;
141 static int hf_gtpv2_uli_tai_flg = -1;
142 static int hf_gtpv2_uli_rai_flg = -1;
143 static int hf_gtpv2_uli_sai_flg = -1;
144 static int hf_gtpv2_uli_cgi_flg = -1;
145 static int hf_gtpv2_glt = -1;
146 static int hf_gtpv2_cng_rep_act = -1;
148 static int hf_gtpv2_selec_mode = -1;
149 static int hf_gtpv2_source_type = -1;
150 static int hf_gtpv2_f_teid_v4 = -1;
151 static int hf_gtpv2_f_teid_v6 = -1;
152 static int hf_gtpv2_f_teid_interface_type= -1;
153 static int hf_gtpv2_f_teid_gre_key= -1;
154 static int hf_gtpv2_f_teid_ipv4= -1;
155 static int hf_gtpv2_f_teid_ipv6= -1;
156 static int hf_gtpv2_tmsi = -1;
157 static int hf_gtpv2_hsgw_addr_f_len = -1;
158 static int hf_gtpv2_hsgw_addr_ipv4 = -1;
159 static int hf_gtpv2_hsgw_addr_ipv6 = -1;
160 static int hf_gtpv2_gre_key = -1;
161 static int hf_gtpv2_sgw_addr_ipv4 = -1;
162 static int hf_gtpv2_sgw_addr_ipv6 = -1;
163 static int hf_gtpv2_sgw_s1u_teid = -1;
164 static int hf_gtpv2_imsi= -1;
165 static int hf_gtpv2_ipv4_addr = -1;
168 static int hf_gtpv2_ambr_up= -1;
169 static int hf_gtpv2_ambr_down= -1;
170 static int hf_gtpv2_ip_address_ipv4= -1;
171 static int hf_gtpv2_ip_address_ipv6= -1;
172 static int hf_gtpv2_mei= -1;
174 /* Trace Information */
175 /* static int hf_gtpv2_tra_info = -1; */
176 static int hf_gtpv2_tra_info_msc_momt_calls = -1;
177 static int hf_gtpv2_tra_info_msc_momt_sms = -1;
178 static int hf_gtpv2_tra_info_msc_lu_imsi_ad = -1;
179 static int hf_gtpv2_tra_info_msc_handovers = -1;
180 static int hf_gtpv2_tra_info_msc_ss = -1;
181 static int hf_gtpv2_tra_info_mgw_context = -1;
182 static int hf_gtpv2_tra_info_sgsn_pdp_context = -1;
183 static int hf_gtpv2_tra_info_sgsn_momt_sms = -1;
184 static int hf_gtpv2_tra_info_sgsn_rau_gprs_ad = -1;
185 static int hf_gtpv2_tra_info_sgsn_mbms = -1;
186 static int hf_gtpv2_tra_info_sgsn_reserved = -1;
187 static int hf_gtpv2_tra_info_ggsn_pdp = -1;
188 static int hf_gtpv2_tra_info_ggsn_mbms = -1;
189 static int hf_gtpv2_tra_info_bm_sc = -1;
190 static int hf_gtpv2_tra_info_mme_sgw_ss = -1;
191 static int hf_gtpv2_tra_info_mme_sgw_sr = -1;
192 static int hf_gtpv2_tra_info_mme_sgw_iataud = -1;
193 static int hf_gtpv2_tra_info_lne_msc_s = -1;
194 static int hf_gtpv2_tra_info_lne_mgw = -1;
195 static int hf_gtpv2_tra_info_lne_sgsn = -1;
196 static int hf_gtpv2_tra_info_lne_ggsn = -1;
197 static int hf_gtpv2_tra_info_lne_rnc = -1;
198 static int hf_gtpv2_tra_info_lne_bm_sc = -1;
199 static int hf_gtpv2_tra_info_lne_mme = -1;
200 static int hf_gtpv2_tra_info_lne_sgw = -1;
201 static int hf_gtpv2_tra_info_lne_pdn_gw = -1;
202 static int hf_gtpv2_tra_info_lne_enb = -1;
203 static int hf_gtpv2_tra_info_tdl = -1;
204 static int hf_gtpv2_tra_info_lmsc_a = -1;
205 static int hf_gtpv2_tra_info_lmsc_lu = -1;
206 static int hf_gtpv2_tra_info_lmsc_mc = -1;
207 static int hf_gtpv2_tra_info_lmsc_map_g = -1;
208 static int hf_gtpv2_tra_info_lmsc_map_b = -1;
209 static int hf_gtpv2_tra_info_lmsc_map_e = -1;
210 static int hf_gtpv2_tra_info_lmsc_map_f = -1;
211 static int hf_gtpv2_tra_info_lmsc_cap = -1;
212 static int hf_gtpv2_tra_info_lmsc_map_d = -1;
213 static int hf_gtpv2_tra_info_lmsc_map_c = -1;
214 static int hf_gtpv2_tra_info_lmgw_mc = -1;
215 static int hf_gtpv2_tra_info_lmgw_nb_up = -1;
216 static int hf_gtpv2_tra_info_lmgw_lu_up = -1;
217 static int hf_gtpv2_tra_info_lsgsn_gb = -1;
218 static int hf_gtpv2_tra_info_lsgsn_lu = -1;
219 static int hf_gtpv2_tra_info_lsgsn_gn = -1;
220 static int hf_gtpv2_tra_info_lsgsn_map_gr = -1;
221 static int hf_gtpv2_tra_info_lsgsn_map_gd = -1;
222 static int hf_gtpv2_tra_info_lsgsn_map_gf = -1;
223 static int hf_gtpv2_tra_info_lsgsn_gs = -1;
224 static int hf_gtpv2_tra_info_lsgsn_ge = -1;
225 static int hf_gtpv2_tra_info_lggsn_gn = -1;
226 static int hf_gtpv2_tra_info_lggsn_gi = -1;
227 static int hf_gtpv2_tra_info_lggsn_gmb = -1;
228 static int hf_gtpv2_tra_info_lrnc_lu = -1;
229 static int hf_gtpv2_tra_info_lrnc_lur = -1;
230 static int hf_gtpv2_tra_info_lrnc_lub = -1;
231 static int hf_gtpv2_tra_info_lrnc_uu = -1;
232 static int hf_gtpv2_tra_info_lbm_sc_gmb = -1;
233 static int hf_gtpv2_tra_info_lmme_s1_mme = -1;
234 static int hf_gtpv2_tra_info_lmme_s3 = -1;
235 static int hf_gtpv2_tra_info_lmme_s6a = -1;
236 static int hf_gtpv2_tra_info_lmme_s10 = -1;
237 static int hf_gtpv2_tra_info_lmme_s11 = -1;
238 static int hf_gtpv2_tra_info_lsgw_s4 = -1;
239 static int hf_gtpv2_tra_info_lsgw_s5 = -1;
240 static int hf_gtpv2_tra_info_lsgw_s8b = -1;
241 static int hf_gtpv2_tra_info_lsgw_s11 = -1;
242 static int hf_gtpv2_tra_info_lpdn_gw_s2a = -1;
243 static int hf_gtpv2_tra_info_lpdn_gw_s2b = -1;
244 static int hf_gtpv2_tra_info_lpdn_gw_s2c = -1;
245 static int hf_gtpv2_tra_info_lpdn_gw_s5 = -1;
246 static int hf_gtpv2_tra_info_lpdn_gw_s6c = -1;
247 static int hf_gtpv2_tra_info_lpdn_gw_gx = -1;
248 static int hf_gtpv2_tra_info_lpdn_gw_s8b = -1;
249 static int hf_gtpv2_tra_info_lpdn_gw_sgi = -1;
250 static int hf_gtpv2_tra_info_lenb_s1_mme = -1;
251 static int hf_gtpv2_tra_info_lenb_x2 = -1;
252 static int hf_gtpv2_tra_info_lenb_uu = -1;
254 static int hf_gtpv2_address_digits = -1;
255 static int hf_gtpv2_ti = -1;
257 static int hf_gtpv2_bearer_qos_pvi= -1;
258 static int hf_gtpv2_bearer_qos_pl= -1;
259 static int hf_gtpv2_bearer_qos_pci= -1;
260 static int hf_gtpv2_bearer_qos_label_qci = -1;
261 static int hf_gtpv2_bearer_qos_mbr_up = -1;
262 static int hf_gtpv2_bearer_qos_mbr_down = -1;
263 static int hf_gtpv2_bearer_qos_gbr_up = -1;
264 static int hf_gtpv2_bearer_qos_gbr_down = -1;
265 static int hf_gtpv2_flow_qos_label_qci = -1;
266 static int hf_gtpv2_flow_qos_mbr_up = -1;
267 static int hf_gtpv2_flow_qos_mbr_down = -1;
268 static int hf_gtpv2_flow_qos_gbr_up = -1;
269 static int hf_gtpv2_flow_qos_gbr_down = -1;
271 static int hf_gtpv2_delay_value = -1;
272 static int hf_gtpv2_charging_id = -1;
273 static int hf_gtpv2_charging_characteristic = -1;
274 static int hf_gtpv2_bearer_flag_ppc = -1;
275 static int hf_gtpv2_bearer_flag_vb = -1;
276 static int hf_gtpv2_ue_time_zone_dst = -1;
277 static int hf_gtpv2_fq_csid_type = -1;
278 static int hf_gtpv2_fq_csid_nr = -1;
279 static int hf_gtpv2_fq_csid_ipv4 = -1;
280 static int hf_gtpv2_fq_csid_ipv6 = -1;
281 static int hf_gtpv2_fq_csid_id = -1;
282 static int hf_gtpv2_complete_req_msg_type = -1;
283 static int hf_gtpv2_mme_grp_id = -1;
284 static int hf_gtpv2_mme_code = -1;
285 static int hf_gtpv2_m_tmsi = -1;
286 static int hf_gtpv2_container_type = -1;
287 static int hf_gtpv2_cause_type = -1;
288 static int hf_gtpv2_CauseRadioNetwork = -1;
289 static int hf_gtpv2_CauseTransport = -1;
290 static int hf_gtpv2_CauseNas = -1;
291 static int hf_gtpv2_CauseProtocol = -1;
292 static int hf_gtpv2_CauseMisc = -1;
293 static int hf_gtpv2_target_type = -1;
294 static int hf_gtpv2_macro_enodeb_id = -1;
296 static int hf_gtpv2_node_type= -1;
297 static int hf_gtpv2_fqdn = -1;
298 static int hf_gtpv2_enterprise_id = -1;
299 static int hf_gtpv2_apn_rest= -1;
300 static int hf_gtpv2_pti= -1;
301 static int hf_gtpv2_mm_context_sm = -1;
302 static int hf_gtpv2_mm_context_nhi = -1;
303 static int hf_gtpv2_mm_context_drxi = -1;
304 static int hf_gtpv2_mm_context_cksn = -1;
305 static int hf_gtpv2_mm_context_cksn_ksi = -1;
306 static int hf_gtpv2_mm_context_kasme = -1;
307 static int hf_gtpv2_mm_context_rand = -1;
308 static int hf_gtpv2_mm_context_xres_len = -1;
309 static int hf_gtpv2_mm_context_xres = -1;
310 static int hf_gtpv2_mm_context_autn_len = -1;
311 static int hf_gtpv2_mm_context_autn = -1;
312 static int hf_gtpv2_mm_context_drx = -1;
313 static int hf_gtpv2_mm_context_ue_net_cap_len = -1;
314 static int hf_gtpv2_mm_context_ms_net_cap_len = -1;
315 static int hf_gtpv2_mm_context_mei_len = -1;
316 static int hf_gtpv2_mm_context_vdp_len = -1;
317 static int hf_gtpv2_mm_context_higher_br_16mb_flg_len = -1;
318 static int hf_gtpv2_mm_context_higher_br_16mb_flg = -1;
319 static int hf_gtpv2_vdp_length = -1;
321 static int hf_gtpv2_una = -1;
322 static int hf_gtpv2_gena = -1;
323 static int hf_gtpv2_gana = -1;
324 static int hf_gtpv2_ina = -1;
325 static int hf_gtpv2_ena = -1;
326 static int hf_gtpv2_hnna = -1;
327 static int hf_gtpv2_mm_context_ksi_a= -1;
328 static int hf_gtpv2_mm_context_ksi = -1;
329 static int hf_gtpv2_mm_context_nr_tri = -1;
330 static int hf_gtpv2_mm_context_used_cipher = -1;
331 static int hf_gtpv2_mm_context_nr_qui = -1;
332 static int hf_gtpv2_mm_context_nr_qua = -1;
333 static int hf_gtpv2_mm_context_uamb_ri = -1;
334 static int hf_gtpv2_mm_context_osci = -1;
335 static int hf_gtpv2_mm_context_samb_ri = -1;
336 static int hf_gtpv2_mm_context_unipa = -1;
337 static int hf_gtpv2_mm_context_unc = -1;
338 static int hf_gtpv2_mm_context_nas_dl_cnt = -1;
339 static int hf_gtpv2_mm_context_nas_ul_cnt = -1;
341 static int hf_gtpv2_uli_cgi_lac= -1;
342 static int hf_gtpv2_uli_cgi_ci= -1;
343 static int hf_gtpv2_uli_sai_lac= -1;
344 static int hf_gtpv2_uli_sai_sac= -1;
345 static int hf_gtpv2_uli_rai_lac= -1;
346 static int hf_gtpv2_uli_rai_rac= -1;
347 static int hf_gtpv2_uli_tai_tac= -1;
348 static int hf_gtpv2_uli_ecgi_eci= -1;
349 static int hf_gtpv2_uli_lai_lac = -1;
350 static int hf_gtpv2_uli_ecgi_eci_spare= -1;
351 static int hf_gtpv2_nsapi = -1;
352 static int hf_gtpv2_bearer_control_mode= -1;
354 static int hf_gtpv2_bss_container_phx = -1;
355 static int hf_gtpv2_bss_con_sapi_flg = -1;
356 static int hf_gtpv2_bss_con_rp_flg = -1;
357 static int hf_gtpv2_bss_con_pfi_flg = -1;
358 static int hf_gtpv2_bss_con_pfi = -1;
359 static int hf_gtpv2_bss_con_rp = -1;
360 static int hf_gtpv2_bss_con_sapi = -1;
361 static int hf_gtpv2_bss_con_xid_len = -1;
362 static int hf_gtpv2_bss_con_xid = -1;
363 static int hf_gtpv2_home_enodeb_id = -1;
364 static int hf_gtpv2_tac = -1;
366 /* MBMS */
367 static int hf_gtpv2_mbms_service_area_nr = -1;
368 static int hf_gtpv2_mbms_service_area_id = -1;
369 static int hf_gtpv2_mbms_session_id = -1;
370 static int hf_gtpv2_mbms_flow_id = -1;
371 static int hf_gtpv2_cteid = -1;
372 static int hf_gtpv2_ip_addr_type = -1;
373 static int hf_gtpv2_ip_addr_len = -1;
374 static int hf_gtpv2_mbms_ip_mc_dist_addrv4 = -1;
375 static int hf_gtpv2_mbms_ip_mc_dist_addrv6 = -1;
376 static int hf_gtpv2_mbms_ip_mc_src_addrv4 = -1;
377 static int hf_gtpv2_mbms_ip_mc_src_addrv6 = -1;
378 static int hf_gtpv2_mbms_hc_indicator = -1;
379 static int hf_gtpv2_mbms_dist_indication = -1;
380 static int hf_gtpv2_subscriber_rfsp = -1;
381 static int hf_gtpv2_rfsp_inuse = -1;
382 static int hf_gtpv2_mbms_service_id = -1;
383 static int hf_gtpv2_add_flags_for_srvcc_ics = -1;
384 static int hf_gtpv2_vsrvcc_flag = -1;
385 static int hf_gtpv2_abs_time_mbms_data = -1;
386 static int hf_gtpv2_henb_info_report_fti = -1;
387 static int hf_gtpv2_ip4cp_subnet_prefix_len = -1;
388 static int hf_gtpv2_ip4cp_ipv4 = -1;
389 static int hf_gtpv2_change_report_flags_sncr = -1;
390 static int hf_gtpv2_change_report_flags_tzcr = -1;
391 static int hf_gtpv2_action_indication_val = -1;
392 static int hf_gtpv2_mbms_session_duration_days = -1;
393 static int hf_gtpv2_mbms_session_duration_secs = -1;
394 static int hf_gtpv2_node_features_prn = -1;
395 static int hf_gtpv2_node_features_mabr =-1;
396 static int hf_gtpv2_node_features_ntsr = -1;
397 static int hf_gtpv2_time_to_data_xfer = -1;
398 static int hf_gtpv2_arp_pvi = -1;
399 static int hf_gtpv2_arp_pl = -1;
400 static int hf_gtpv2_arp_pci = -1;
401 static int hf_gtpv2_timer_unit = -1;
402 static int hf_gtpv2_timer_value = -1;
403 static int hf_gtpv2_lapi = -1;
405 static gint ett_gtpv2 = -1;
406 static gint ett_gtpv2_flags = -1;
407 static gint ett_gtpv2_ie = -1;
408 static gint ett_gtpv2_uli_flags = -1;
409 static gint ett_gtpv2_uli_field = -1;
410 static gint ett_gtpv2_bearer_ctx = -1;
411 static gint ett_gtpv2_PDN_conn = -1;
412 static gint ett_gtpv2_mm_context_flag = -1;
413 static gint ett_gtpv2_pdn_numbers_nsapi = -1;
414 static gint ett_gtpv2_tra_info_trigg = -1;
415 static gint ett_gtpv2_tra_info_trigg_msc_server = -1;
416 static gint ett_gtpv2_tra_info_trigg_mgw = -1;
417 static gint ett_gtpv2_tra_info_trigg_sgsn = -1;
418 static gint ett_gtpv2_tra_info_trigg_ggsn = -1;
419 static gint ett_gtpv2_tra_info_trigg_bm_sc = -1;
420 static gint ett_gtpv2_tra_info_trigg_sgw_mme = -1;
421 static gint ett_gtpv2_tra_info_interfaces = -1;
422 static gint ett_gtpv2_tra_info_interfaces_imsc_server = -1;
423 static gint ett_gtpv2_tra_info_interfaces_lmgw = -1;
424 static gint ett_gtpv2_tra_info_interfaces_lsgsn = -1;
425 static gint ett_gtpv2_tra_info_interfaces_lggsn = -1;
426 static gint ett_gtpv2_tra_info_interfaces_lrnc = -1;
427 static gint ett_gtpv2_tra_info_interfaces_lbm_sc = -1;
428 static gint ett_gtpv2_tra_info_interfaces_lmme = -1;
429 static gint ett_gtpv2_tra_info_interfaces_lsgw = -1;
430 static gint ett_gtpv2_tra_info_interfaces_lpdn_gw = -1;
431 static gint ett_gtpv2_tra_info_interfaces_lpdn_lenb = -1;
432 static gint ett_gtpv2_tra_info_ne_types = -1;
433 static gint ett_gtpv2_rai = -1;
434 static gint ett_gtpv2_ms_mark = -1;
435 static gint ett_gtpv2_stn_sr = -1;
436 static gint ett_gtpv2_supp_codec_list = -1;
437 static gint ett_gtpv2_bss_con = -1;
438 static gint ett_gtpv2_mm_context_auth_qua = -1;
439 static gint ett_gtpv2_mm_context_auth_qui = -1;
440 static gint ett_gtpv2_mm_context_auth_tri = -1;
441 static gint ett_gtpv2_mm_context_net_cap = -1;
442 static gint ett_gtpv2_ms_network_capability = -1;
443 static gint ett_gtpv2_vd_pref = -1;
444 static gint ett_gtpv2_access_rest_data = -1;
445 static gint ett_gtpv2_qua = -1;
446 static gint ett_gtpv2_qui = -1;
448 static expert_field ei_gtpv2_ie_data_not_dissected = EI_INIT;
449 static expert_field ei_gtpv2_ie_len_invalid = EI_INIT;
450 static expert_field ei_gtpv2_source_type_unknown = EI_INIT;
451 static expert_field ei_gtpv2_fq_csid_type_bad = EI_INIT;
453 /* Definition of User Location Info (AVP 22) masks */
454 #define GTPv2_ULI_CGI_MASK 0x01
455 #define GTPv2_ULI_SAI_MASK 0x02
456 #define GTPv2_ULI_RAI_MASK 0x04
457 #define GTPv2_ULI_TAI_MASK 0x08
458 #define GTPv2_ULI_ECGI_MASK 0x10
459 #define GTPv2_ULI_LAI_MASK 0x20
461 #define GTPV2_CREATE_SESSION_REQUEST 32
462 #define GTPV2_CREATE_SESSION_RESPONSE 33
463 #define GTPV2_CONTEXT_RESPONSE 131
464 #define GTPV2_FORWARD_RELOCATION_REQ 133
465 #define GTPV2_FORWARD_CTX_NOTIFICATION 137
466 #define GTPV2_RAN_INFORMATION_RELAY 152
468 static void dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, gint offset, guint8 message_type);
470 /*Message Types for GTPv2 (Refer Pg19 29.274) (SB)*/
471 static const value_string gtpv2_message_type_vals[] = {
472 { 0, "Reserved"},
473 { 1, "Echo Request"},
474 { 2, "Echo Response"},
475 { 3, "Version Not Supported Indication"},
476 /* 4-24 Reserved for S101 interface TS 29.276 */
477 { 4, "Node Alive Request"},
478 { 5, "Node Alive Response"},
479 { 6, "Redirection Request"},
480 { 7, "Redirection Response"},
481 /* 25-31 Reserved for Sv interface TS 29.280 */
482 /*Start SRVCC Messages ETSI TS 129 280 V10.1.0 (2011-06) 5.2.1*/
483 { 25, "SRVCC PS to CS Request"},
484 { 26, "SRVCC PS to CS Response"},
485 { 27, "SRVCC PS to CS Complete Notification"},
486 { 28, "SRVCC PS to CS Complete Acknowledge"},
487 { 29, "SRVCC PS to CS Cancel Notification"},
488 { 30, "SRVCC PS to CS Cancel Acknowledge"},
489 { 31, "For Future Sv interface use"},
490 /*End SRVCC Messages*/
491 /* SGSN/MME to PGW (S4/S11, S5/S8) */
492 { 32, "Create Session Request"},
493 { 33, "Create Session Response"},
494 { 34, "Modify Bearer Request"},
495 { 35, "Modify Bearer Response"},
496 { 36, "Delete Session Request"},
497 { 37, "Delete Session Response"},
498 /* SGSN to PGW (S4, S5/S8) */
499 { 38, "Change Notification Request"},
500 { 39, "Change Notification Response"},
501 /* 40-63 For future use */
502 /* Messages without explicit response */
503 { 64, "Modify Bearer Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */
504 { 65, "Modify Bearer Failure Indication"}, /*(PGW to MME/SGSN -S5/S8, S11/S4) */
505 { 66, "Delete Bearer Command"}, /* (MME to PGW -S11, S5/S8) */
506 { 67, "Delete Bearer Failure Indication"}, /* (PGW to MME -S5/S8, S11) */
507 { 68, "Bearer Resource Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */
508 { 69, "Bearer Resource Failure Indication"}, /* (PGW to MME/SGSN -S5/S8, S11/S4) */
509 { 70, "Downlink Data Notification Failure Indication"}, /*(SGSN/MME to SGW -S4/S11) */
510 { 71, "Trace Session Activation"},
511 { 72, "Trace Session Deactivation"},
512 { 73, "Stop Paging Indication"},
513 /* 74-94 For future use */
514 /* PDN-GW to SGSN/MME (S5/S8, S4/S11) */
515 { 95, "Create Bearer Request"},
516 { 96, "Create Bearer Response"},
517 { 97, "Update Bearer Request"},
518 { 98, "Update Bearer Response"},
519 { 99, "Delete Bearer Request"},
520 {100, "Delete Bearer Response"},
521 /* PGW to MME, MME to PGW, SGW to PGW, SGW to MME (S5/S8, S11) */
522 {101, "Delete PDN Connection Set Request"},
523 {102, "Delete PDN Connection Set Response"},
524 /* 103-127 For future use */
525 /* MME to MME, SGSN to MME, MME to SGSN, SGSN to SGSN (S3/10/S16) */
526 {128, "Identification Request"},
527 {129, "Identification Response"},
528 {130, "Context Request"},
529 {131, "Context Response"},
530 {132, "Context Acknowledge"},
531 {133, "Forward Relocation Request"},
532 {134, "Forward Relocation Response"},
533 {135, "Forward Relocation Complete Notification"},
534 {136, "Forward Relocation Complete Acknowledge"},
535 {137, "Forward Access Context Notification"},
536 {138, "Forward Access Context Acknowledge"},
537 {139, "Relocation Cancel Request"},
538 {140, "Relocation Cancel Response"},
539 {141, "Configuration Transfer Tunnel"},
540 /* 142-148 For future use */
541 /* SGSN to MME, MME to SGSN (S3)*/
542 {149, "Detach Notification"},
543 {150, "Detach Acknowledge"},
544 {151, "CS Paging Indication"},
545 {152, "RAN Information Relay"},
546 {153, "Alert MME Notification"},
547 {154, "Alert MME Acknowledge"},
548 {155, "UE Activity Notification"},
549 {156, "UE Activity Acknowledge"},
550 /* 157 to 159 For future use */
551 /* MME to SGW (S11) */
552 {160, "Create Forwarding Tunnel Request"},
553 {161, "Create Forwarding Tunnel Response"},
554 {162, "Suspend Notification"},
555 {163, "Suspend Acknowledge"},
556 {164, "Resume Notification"},
557 {165, "Resume Acknowledge"},
558 {166, "Create Indirect Data Forwarding Tunnel Request"},
559 {167, "Create Indirect Data Forwarding Tunnel Response"},
560 {168, "Delete Indirect Data Forwarding Tunnel Request"},
561 {169, "Delete Indirect Data Forwarding Tunnel Response"},
562 {170, "Release Access Bearers Request"},
563 {171, "Release Access Bearers Response"},
564 /* 172-175 For future use */
565 /* SGW to SGSN/MME (S4/S11) */
566 {176, "Downlink Data Notification"},
567 {177, "Downlink Data Notification Acknowledgement"},
568 {178, "Reserved. Allocated in earlier version of the specification."},
569 {179, "PGW Restart Notification"},
570 {180, "PGW Restart Notification Acknowledge"},
571 /* 181-199 For future use */
572 /* SGW to PGW, PGW to SGW (S5/S8) */
573 {200, "Update PDN Connection Set Request"},
574 {201, "Update PDN Connection Set Response"},
575 /* 202 to 210 For future use */
576 /* MME to SGW (S11) */
577 {211, "Modify Access Bearers Request"},
578 {212, "Modify Access Bearers Response"},
579 /* 213 to 230 For future use */
580 /* MBMS GW to MME/SGSN (Sm/Sn) */
581 {231, "MBMS Session Start Request"},
582 {232, "MBMS Session Start Response"},
583 {233, "MBMS Session Update Request"},
584 {234, "MBMS Session Update Response"},
585 {235, "MBMS Session Stop Request"},
586 {236, "MBMS Session Stop Response"},
587 /* 237 to 239 For future use */
588 /* 240-255 Reserved for GTP-U TS 29.281 [13] */
589 {240, "Data Record Transfer Request"},
590 {241, "Data Record Transfer Response"},
591 {0, NULL}
593 static value_string_ext gtpv2_message_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_message_type_vals);
595 #define GTPV2_IE_RESERVED 0
596 #define GTPV2_IE_IMSI 1
597 #define GTPV2_IE_CAUSE 2
598 #define GTPV2_REC_REST_CNT 3
599 /*Start SRVCC Messages*/
600 #define GTPV2_IE_STN_SR 51
601 #define GTPV2_IE_SRC_TGT_TRANS_CON 52
602 #define GTPV2_IE_TGT_SRC_TRANS_CON 53
603 #define GTPV2_IE_MM_CON_EUTRAN_SRVCC 54
604 #define GTPV2_IE_MM_CON_UTRAN_SRVCC 55
605 #define GTPV2_IE_SRVCC_CAUSE 56
606 #define GTPV2_IE_TGT_RNC_ID 57
607 #define GTPV2_IE_TGT_GLOGAL_CELL_ID 58
608 #define GTPV2_IE_TEID_C 59
609 #define GTPV2_IE_SV_FLAGS 60
610 #define GTPV2_IE_SAI 61
611 /* 61 - 70 for future sv interface use*/
612 /*End SRVCC Messages*/
613 #define GTPV2_APN 71
614 #define GTPV2_AMBR 72
615 #define GTPV2_EBI 73
616 #define GTPV2_IP_ADDRESS 74
617 #define GTPV2_MEI 75
618 #define GTPV2_IE_MSISDN 76
619 #define GTPV2_INDICATION 77
620 #define GTPV2_PCO 78
621 #define GTPV2_PAA 79
622 #define GTPV2_BEARER_QOS 80
623 #define GTPV2_IE_FLOW_QOS 81
624 #define GTPV2_IE_RAT_TYPE 82
625 #define GTPV2_IE_SERV_NET 83
626 #define GTPV2_IE_BEARER_TFT 84
627 #define GTPV2_IE_TAD 85
628 #define GTPV2_IE_ULI 86
629 #define GTPV2_IE_F_TEID 87
630 #define GTPV2_IE_TMSI 88
631 #define GTPV2_IE_GLOBAL_CNID 89
632 #define GTPV2_IE_S103PDF 90
633 #define GTPV2_IE_S1UDF 91
634 #define GTPV2_IE_DEL_VAL 92
635 #define GTPV2_IE_BEARER_CTX 93
636 #define GTPV2_IE_CHAR_ID 94
637 #define GTPV2_IE_CHAR_CHAR 95
638 #define GTPV2_IE_TRA_INFO 96
639 #define GTPV2_BEARER_FLAG 97
640 /* define GTPV2_IE_PAGING_CAUSE 98 (void) */
641 #define GTPV2_IE_PDN_TYPE 99
642 #define GTPV2_IE_PTI 100
643 #define GTPV2_IE_DRX_PARAM 101
644 #define GTPV2_IE_UE_NET_CAPABILITY 102
645 #define GTPV2_IE_MM_CONTEXT_GSM_T 103
646 #define GTPV2_IE_MM_CONTEXT_UTMS_CQ 104
647 #define GTPV2_IE_MM_CONTEXT_GSM_CQ 105
648 #define GTPV2_IE_MM_CONTEXT_UTMS_Q 106
649 #define GTPV2_IE_MM_CONTEXT_EPS_QQ 107
650 #define GTPV2_IE_MM_CONTEXT_UTMS_QQ 108
651 #define GTPV2_IE_PDN_CONNECTION 109
652 #define GTPV2_IE_PDN_NUMBERS 110
653 #define GTPV2_IE_P_TMSI 111
654 #define GTPV2_IE_P_TMSI_SIG 112
655 #define GTPV2_IE_HOP_COUNTER 113
656 #define GTPV2_IE_UE_TIME_ZONE 114
657 #define GTPV2_IE_TRACE_REFERENCE 115
658 #define GTPV2_IE_COMPLETE_REQUEST_MSG 116
659 #define GTPV2_IE_GUTI 117
660 #define GTPV2_IE_F_CONTAINER 118
661 #define GTPV2_IE_F_CAUSE 119
662 #define GTPV2_IE_SEL_PLMN_ID 120
663 #define GTPV2_IE_TARGET_ID 121
664 /* GTPV2_IE_NSAPI 122 */
665 #define GTPV2_IE_PKT_FLOW_ID 123
666 #define GTPV2_IE_RAB_CONTEXT 124
667 #define GTPV2_IE_S_RNC_PDCP_CTX_INFO 125
668 #define GTPV2_IE_UDP_S_PORT_NR 126
669 #define GTPV2_IE_APN_RESTRICTION 127
670 #define GTPV2_IE_SEL_MODE 128
671 #define GTPV2_IE_SOURCE_IDENT 129
672 #define GTPV2_IE_BEARER_CONTROL_MODE 130
673 #define GTPV2_IE_CNG_REP_ACT 131
674 #define GTPV2_IE_FQ_CSID 132
675 #define GTPV2_IE_CHANNEL_NEEDED 133
676 #define GTPV2_IE_EMLPP_PRI 134
677 #define GTPV2_IE_NODE_TYPE 135
678 #define GTPV2_IE_FQDN 136
679 #define GTPV2_IE_TI 137
680 #define GTPV2_IE_MBMS_SESSION_DURATION 138
681 #define GTPV2_IE_MBMS_SERVICE_AREA 139
682 #define GTPV2_IE_MBMS_SESSION_ID 140
683 #define GTPV2_IE_MBMS_FLOW_ID 141
684 #define GTPV2_IE_MBMS_IP_MC_DIST 142
685 #define GTPV2_IE_MBMS_DIST_ACK 143
686 #define GTPV2_IE_RFSP_INDEX 144
687 #define GTPV2_IE_UCI 145
688 #define GTPV2_IE_CSG_INFO_REP_ACTION 146
689 #define GTPV2_IE_CSG_ID 147
690 #define GTPV2_IE_CMI 148
691 #define GTPV2_IE_SERVICE_INDICATOR 149
692 #define GTPV2_IE_DETACH_TYPE 150
693 #define GTPV2_IE_LDN 151
694 #define GTPV2_IE_NODE_FEATURES 152
695 #define GTPV2_IE_MBMS_TIME_TO_DATA_XFER 153
696 #define GTPV2_IE_THROTTLING 154
697 #define GTPV2_IE_ARP 155
698 #define GTPV2_IE_EPC_TIMER 156
699 #define GTPV2_IE_SIG_PRIO_IND 157
700 #define GTPV2_IE_TMGI 158
701 #define GTPV2_IE_ADD_MM_CONT_FOR_SRVCC 159
702 #define GTPV2_IE_ADD_FLAGS_FOR_SRVCC 160
703 #define GTPV2_IE_MMBR 161
704 #define GTPV2_IE_MDT_CONFIG 162
705 #define GTPV2_IE_APCO 163
706 #define GTPV2_IE_ABS_MBMS_DATA_TF_TIME 164
707 #define GTPV2_IE_HENB_INFO_REPORT 165
708 #define GTPV2_IE_IP4CP 166
709 #define GTPV2_IE_CHANGE_TO_REPORT_FLAGS 167
710 #define GTPV2_IE_ACTION_INDICATION 168
711 /* 169 to 254 reserved for future use */
712 #define GTPV2_IE_PRIVATE_EXT 255
714 #define SPARE 0X0
715 #define CREATE_NEW_TFT 0X20
716 #define DELETE_TFT 0X40
717 #define ADD_PACKET_FILTERS_TFT 0X60
718 #define REPLACE_PACKET_FILTERS_TFT 0X80
719 #define DELETE_PACKET_FILTERS_TFT 0XA0
720 #define NO_TFT_OPERATION 0XC0
721 #define RESERVED 0XE0
724 /* Table 8.1-1: Information Element types for GTPv2 */
725 static const value_string gtpv2_element_type_vals[] = {
726 { 0, "Reserved"},
727 { 1, "International Mobile Subscriber Identity (IMSI)"}, /* Variable Length / 8.3 */
728 { 2, "Cause"}, /* Variable Length / 8.4 */
729 { 3, "Recovery (Restart Counter)"}, /* Variable Length / 8.5 */
730 /* 4-50 Reserved for S101 interface Extendable / See 3GPP TS 29.276 [14] */
731 /* 51-70 Reserved for Sv interface Extendable / See 3GPP TS 29.280 [15] */
732 /*Start SRVCC Messages ETSI TS 129 280 V10.1.0 (2011-06) 6.1*/
733 { 51, "STN-SR"}, /* Variable Length / 6.2 */
734 { 52, "Source to Target Transparent Container"}, /* Variable Length / 6.3 */
735 { 53, "Target to Source Transparent Container"}, /* Variable Length / 6.4 */
736 { 54, "MM Context for E-UTRAN SRVCC"}, /* Variable Length / 6.5 */
737 { 55, "MM Context for UTRAN SRVCC"}, /* Variable Length / 6.6 */
738 { 56, "SRVCC Cause"}, /* Fixed Length / 6.7 */
739 { 57, "Target RNC ID"}, /* Variable Length / 6.8 */
740 { 58, "Target Global Cell ID"}, /* Variable Length / 6.9 */
741 { 59, "TEID-C"}, /* Extendable / 6.10 */
742 { 60, "Sv Flags"}, /* Extendable / 6.11 */
743 { 61, "Service Area Identifier"}, /* Extendable / 6.12 */
744 /* 62-70 For future Sv interface use */
745 /*End SRVCC Messages*/
746 { 71, "Access Point Name (APN)"}, /* Variable Length / 8.6 */
747 { 72, "Aggregate Maximum Bit Rate (AMBR)"}, /* Fixed Length / 8.7 */
748 { 73, "EPS Bearer ID (EBI)"}, /* Extendable / 8.8 */
749 { 74, "IP Address"}, /* Extendable / 8.9 */
750 { 75, "Mobile Equipment Identity (MEI)"}, /* Variable Length / 8.10 */
751 { 76, "MSISDN"}, /* Variable Length / 8.11 */
752 { 77, "Indication"}, /* Extendable / 8.12 */
753 { 78, "Protocol Configuration Options (PCO)"}, /* Variable Length / 8.13 */
754 { 79, "PDN Address Allocation (PAA)"}, /* Variable Length / 8.14 */
755 { 80, "Bearer Level Quality of Service (Bearer QoS)"}, /* Variable Length / 8.15 */
756 { 81, "Flow Quality of Service (Flow QoS)"}, /* Extendable / 8.16 */
757 { 82, "RAT Type"}, /* Extendable / 8.17 */
758 { 83, "Serving Network"}, /* Extendable / 8.18 */
759 { 84, "EPS Bearer Level Traffic Flow Template (Bearer TFT)"}, /* Variable Length / 8.19 */
760 { 85, "Traffic Aggregation Description (TAD)"}, /* Variable Length / 8.20 */
761 { 86, "User Location Info (ULI)"}, /* Variable Length / 8.21 */
762 { 87, "Fully Qualified Tunnel Endpoint Identifier (F-TEID)"}, /* Extendable / 8.22 */
763 { 88, "TMSI"}, /* Variable Length / 8.23 */
764 { 89, "Global CN-Id"}, /* Variable Length / 8.24 */
765 { 90, "S103 PDN Data Forwarding Info (S103PDF)"}, /* Variable Length / 8.25 */
766 { 91, "S1-U Data Forwarding Info (S1UDF)"}, /* Variable Length/ 8.26 */
767 { 92, "Delay Value"}, /* Extendable / 8.27 */
768 { 93, "Bearer Context"}, /* Extendable / 8.28 */
769 { 94, "Charging ID"}, /* Extendable / 8.29 */
770 { 95, "Charging Characteristics"}, /* Extendable / 8.30 */
771 { 96, "Trace Information"}, /* Extendable / 8.31 */
772 { 97, "Bearer Flags"}, /* Extendable / 8.32 */
773 { 98, "Paging Cause"}, /* Variable Length / 8.33 */
774 { 99, "PDN Type"}, /* Extendable / 8.34 */
775 {100, "Procedure Transaction ID"}, /* Extendable / 8.35 */
776 {101, "DRX Parameter"}, /* Variable Length/ 8.36 */
777 {102, "UE Network Capability"}, /* Variable Length / 8.37 */
778 {103, "MM Context (GSM Key and Triplets)"}, /* Variable Length / 8.38 */
779 {104, "MM Context (UMTS Key, Used Cipher and Quintuplets)"}, /* Variable Length / 8.38 */
780 {105, "MM Context (GSM Key, Used Cipher and Quintuplets)"}, /* Variable Length / 8.38 */
781 {106, "MM Context (UMTS Key and Quintuplets)"}, /* Variable Length / 8.38 */
782 {107, "MM Context (EPS Security Context, Quadruplets and Quintuplets)"}, /* Variable Length / 8.38 */
783 {108, "MM Context (UMTS Key, Quadruplets and Quintuplets)"}, /* Variable Length / 8.38 */
784 {109, "PDN Connection"}, /* Extendable / 8.39 */
785 {110, "PDU Numbers"}, /* Extendable / 8.40 */
786 {111, "P-TMSI"}, /* Variable Length / 8.41 */
787 {112, "P-TMSI Signature"}, /* Variable Length / 8.42 */
788 {113, "Hop Counter"}, /* Extendable / 8.43 */
789 {114, "UE Time Zone"}, /* Variable Length / 8.44 */
790 {115, "Trace Reference"}, /* Fixed Length / 8.45 */
791 {116, "Complete Request Message"}, /* Variable Length / 8.46 */
792 {117, "GUTI"}, /* Variable Length / 8.47 */
793 {118, "F-Container"}, /* Variable Length / 8.48 */
794 {119, "F-Cause"}, /* Variable Length / 8.49 */
795 {120, "Selected PLMN ID"}, /* Variable Length / 8.50 */
796 {121, "Target Identification"}, /* Variable Length / 8.51 */
797 {122, "NSAPI"}, /* Extendable / 8.52 */
798 {123, "Packet Flow ID"}, /* Variable Length / 8.53 */
799 {124, "RAB Context"}, /* Fixed Length / 8.54 */
800 {125, "Source RNC PDCP Context Info"}, /* Variable Length / 8.55 */
801 {126, "UDP Source Port Number"}, /* Extendable / 8.56 */
802 {127, "APN Restriction"}, /* Extendable / 8.57 */
803 {128, "Selection Mode"}, /* Extendable / 8.58 */
804 {129, "Source Identification"}, /* Variable Length / 8.50 */
805 {130, "Bearer Control Mode"}, /* Extendable / 8.60 */
806 {131, "Change Reporting Action"}, /* Variable Length / 8.61 */
807 {132, "Fully Qualified PDN Connection Set Identifier (FQ-CSID)"}, /* Variable Length / 8.62 */
808 {133, "Channel needed"}, /* Extendable / 8.63 */
809 {134, "eMLPP Priority"}, /* Extendable / 8.64 */
810 {135, "Node Type"}, /* Extendable / 8.65 */
811 {136, "Fully Qualified Domain Name (FQDN)"}, /* Variable Length / 8.66 */
812 {137, "Transaction Identifier (TI)"}, /* Variable Length / 8.68 */
813 {138, "MBMS Session Duration"}, /* Duration Extendable / 8.69 */
814 {139, "MBMS Service Area"}, /* Extendable / 8.70 */
815 {140, "MBMS Session Identifier"}, /* Extendable / 8.71 */
816 {141, "MBMS Flow Identifier"}, /* Extendable / 8.72 */
817 {142, "MBMS IP Multicast Distribution"}, /* Extendable / 8.73 */
818 {143, "MBMS Distribution Acknowledge"}, /* Extendable / 8.74 */
819 {144, "RFSP Index"}, /* Fixed Length / 8.77 */
820 {145, "User CSG Information (UCI)"}, /* Extendable / 8.75 */
821 {146, "CSG Information Reporting Action"}, /* Extendable / 8.76 */
822 {147, "CSG ID"}, /* Extendable / 8.78 */
823 {148, "CSG Membership Indication (CMI)"}, /* Extendable / 8.79 */
824 {149, "Service indicator"}, /* Fixed Length / 8.80 */
825 {150, "Detach Type"}, /* Fixed Length / 8.81 */
826 {151, "Local Distiguished Name (LDN)"}, /* Variable Length / 8.82 */
827 {152, "Node Features"}, /* Extendable / 8.83 */
828 {153, "MBMS Time to Data Transfer"}, /* Extendable / 8.84 */
829 {154, "Throttling"}, /* Extendable / 8.85 */
830 {155, "Allocation/Retention Priority (ARP)"}, /* Extendable / 8.86 */
831 {156, "EPC Timer"}, /* Extendable / 8.87 */
832 {157, "Signalling Priority Indication"}, /* Extendable / 8.88 */
833 {158, "Temporary Mobile Group Identity"}, /* Extendable / 8.89 */
834 {159, "Additional MM context for SRVCC"}, /* Extendable / 8.90 */
835 {160, "Additional flags for SRVCC"}, /* Extendable / 8.91 */
836 {161, "Max MBR/APN-AMBR (MMBR)"}, /* Extendable / 8.92 */
837 {162, "MDT Configuration"}, /* Extendable / 8.93 */
838 {163, "Additional Protocol Configuration Options (APCO)"}, /* Extendable / 8.94 */
839 {164, "Absolute Time of MBMS Data Transfer"}, /* Extendable / 8.95 */
840 {165, "H(e)NB Information Reporting"}, /* Extendable / 8.96*/
841 {166, "IPv4 Configuration Parameters (IP4CP)"}, /* Extendable / 8.97*/
842 {167, "Change to Report Flags"}, /* Extendable / 8.98 */
843 {168, "Action Indication"}, /* Extendable / 8.99 */
844 /* 169 to 254 Spare. For future use. */ /* For future use. FFS */
845 {255, "Private Extension"}, /* Variable Length / 8.67 */
846 {0, NULL}
848 static value_string_ext gtpv2_element_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_element_type_vals);
850 /* Code to dissect IE's */
852 static void
853 dissect_gtpv2_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
855 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
859 * 8.3 International Mobile Subscriber Identity (IMSI)
861 * IMSI is defined in 3GPP TS 23.003
862 * Editor's note: IMSI coding will be defined in 3GPP TS 24.301
863 * Editor's note: In the first release of GTPv2 spec (TS 29.274v8.0.0) n = 8.
864 * That is, the overall length of the IE is 11 octets.
867 static void
868 dissect_gtpv2_imsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
870 int offset = 0;
871 const gchar *imsi_str;
873 /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
874 * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
875 * allocated string will be returned.
877 imsi_str = tvb_bcd_dig_to_wmem_packet_str( tvb, offset, length, NULL, FALSE);
879 proto_tree_add_string(tree, hf_gtpv2_imsi, tvb, offset, length, imsi_str);
880 proto_item_append_text(item, "%s", imsi_str);
885 * 8.4 Cause
888 /* Table 8.4-1: Cause values */
889 static const value_string gtpv2_cause_vals[] = {
890 {0, "Reserved"},
891 /* Request / Initial message */
892 { 1, "Reserved"},
893 { 2, "Local Detach"},
894 { 3, "Complete Detach"},
895 { 4, "RAT changed from 3GPP to Non-3GPP"},
896 { 5, "ISR deactivation"},
897 { 6, "Error Indication received from RNC/eNodeB/S4-SGSN"},
898 { 7, "IMSI Detach Only"},
899 { 8, "Reactivation Requested"},
900 { 9, "PDN reconnection to this APN disallowed"},
901 { 10, "Access changed from Non-3GPP to 3GPP"},
902 { 11, "PDN connection inactivity timer expires"},
903 { 12, "PGW not responding"},
904 { 13, "Network Failure"},
905 { 14, "QoS parameter mismatch"},
906 /* 15 Spare. This value range is reserved for Cause values in a request message */
907 { 15, "Spare"},
908 /* Acceptance in a Response / triggered message */
909 { 16, "Request accepted"},
910 { 17, "Request accepted partially"},
911 { 18, "New PDN type due to network preference"},
912 { 19, "New PDN type due to single address bearer only"},
913 /* 20-63 Spare. This value range shall be used by Cause values in an acceptance response/triggered message */
914 { 20, "Spare"},
915 { 21, "Spare"},
916 { 22, "Spare"},
917 { 23, "Spare"},
918 { 24, "Spare"},
919 { 25, "Spare"},
920 { 26, "Spare"},
921 { 27, "Spare"},
922 { 28, "Spare"},
923 { 29, "Spare"},
924 { 30, "Spare"},
925 { 31, "Spare"},
926 { 32, "Spare"},
927 { 33, "Spare"},
928 { 34, "Spare"},
929 { 35, "Spare"},
930 { 36, "Spare"},
931 { 37, "Spare"},
932 { 38, "Spare"},
933 { 39, "Spare"},
934 { 40, "Spare"},
935 { 41, "Spare"},
936 { 42, "Spare"},
937 { 43, "Spare"},
938 { 44, "Spare"},
939 { 45, "Spare"},
940 { 46, "Spare"},
941 { 47, "Spare"},
942 { 48, "Spare"},
943 { 49, "Spare"},
944 { 50, "Spare"},
945 { 51, "Spare"},
946 { 52, "Spare"},
947 { 53, "Spare"},
948 { 54, "Spare"},
949 { 55, "Spare"},
950 { 56, "Spare"},
951 { 57, "Spare"},
952 { 58, "Spare"},
953 { 59, "Spare"},
954 { 60, "Spare"},
955 { 61, "Spare"},
956 { 62, "Spare"},
957 { 63, "Spare"},
958 /* Rejection in a Response / triggered message */
959 { 64, "Context Not Found"},
960 { 65, "Invalid Message Format"},
961 { 66, "Version not supported by next peer"},
962 { 67, "Invalid length"},
963 { 68, "Service not supported"},
964 { 69, "Mandatory IE incorrect"},
965 { 70, "Mandatory IE missing"},
966 { 71, "Shall not be used"},
967 { 72, "System failure"},
968 { 73, "No resources available"},
969 { 74, "Semantic error in the TFT operation"},
970 { 75, "Syntactic error in the TFT operation"},
971 { 76, "Semantic errors in packet filter(s)"},
972 { 77, "Syntactic errors in packet filter(s)"},
973 { 78, "Missing or unknown APN"},
974 { 79, "Shall not be used"},
975 { 80, "GRE key not found"},
976 { 81, "Relocation failure"},
977 { 82, "Denied in RAT"},
978 { 83, "Preferred PDN type not supported"},
979 { 84, "All dynamic addresses are occupied"},
980 { 85, "UE context without TFT already activated"},
981 { 86, "Protocol type not supported"},
982 { 87, "UE not responding"},
983 { 88, "UE refuses"},
984 { 89, "Service denied"},
985 { 90, "Unable to page UE"},
986 { 91, "No memory available"},
987 { 92, "User authentication failed"},
988 { 93, "APN access denied - no subscription"},
989 { 94, "Request rejected(reason not specified)"},
990 { 95, "P-TMSI Signature mismatch"},
991 { 96, "IMSI/IMEI not known"},
992 { 97, "Semantic error in the TAD operation"},
993 { 98, "Syntactic error in the TAD operation"},
994 { 99, "Shall not be used"},
995 {100, "Remote peer not responding"},
996 {101, "Collision with network initiated request"},
997 {102, "Unable to page UE due to Suspension"},
998 {103, "Conditional IE missing"},
999 {104, "APN Restriction type Incompatible with currently active PDN connection"},
1000 {105, "Invalid overall length of the triggered response message and a piggybacked initial message"},
1001 {106, "Data forwarding not supported"},
1002 {107, "Invalid reply from remote peer"},
1003 {108, "Fallback to GTPv1"},
1004 {109, "Invalid peer"},
1005 {110, "Temporarily rejected due to handover procedure in progress"},
1006 {111, "Modifications not limited to S1-U bearers"},
1007 {112, "Request rejected for a PMIPv6 reason "},
1008 {113, "APN Congestion"},
1009 {114, "Bearer handling not supported"},
1010 {115, "UE already re-attached"},
1011 {116, "Multiple PDN connections for a given APN not allowed"},
1012 /* 117-239 Spare. For future use in a triggered/response message */
1013 /* 240-255 Spare. For future use in an initial/request message */
1014 {0, NULL}
1016 value_string_ext gtpv2_cause_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_cause_vals);
1018 /* Table 8.4-1: CS (Cause Source) */
1019 static const true_false_string gtpv2_cause_cs = {
1020 "Originated by remote node",
1021 "Originated by node sending the message",
1024 static void
1025 dissect_gtpv2_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1027 int offset = 0;
1028 guint8 tmp;
1030 /* Cause value octet 5 */
1031 tmp = tvb_get_guint8(tvb, offset);
1032 proto_tree_add_item(tree, hf_gtpv2_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
1034 /* Add Cause to ie_tree */
1035 proto_item_append_text(item, "%s (%u)", val_to_str_ext_const(tmp, &gtpv2_cause_vals_ext, "Unknown"), tmp);
1036 offset += 1;
1038 /* Octet 6 Spare PCE BCE CS */
1039 proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset << 3, 5, ENC_BIG_ENDIAN);
1040 proto_tree_add_item(tree, hf_gtpv2_cause_pce, tvb, offset, 1, ENC_BIG_ENDIAN);
1041 proto_tree_add_item(tree, hf_gtpv2_cause_bce, tvb, offset, 1, ENC_BIG_ENDIAN);
1042 proto_tree_add_item(tree, hf_gtpv2_cause_cs, tvb, offset, 1, ENC_BIG_ENDIAN);
1043 offset += 1;
1045 /* If n = 2, a = 0 and the Cause IE shall be 6 octets long.
1046 * Therefore, octets "a(n+1) to a(n+4)" will not be present.
1047 * If n = 6, a = 1 and the Cause IE will be 10 octets long.
1049 if ( length == 2 ) {
1050 return;
1053 * If the rejection is due to a mandatory IE or a verifiable conditional IE is faulty
1054 * or missing, the offending IE shall be included within an additional field "a(n+1)
1055 * to a(n+4)". Only Type and Instance fields of the offending IE that caused the
1056 * rejection have a meaning. The length in the Octet 8-9 and spare bits in the Octet 10
1057 * shall be set to "0". In this case, the value of "n" shall be "6".
1058 * Otherwise, the value of "n" is equal to "2".
1061 /* Type of the offending IE */
1062 proto_tree_add_item(tree, hf_gtpv2_cause_off_ie_t, tvb, offset, 1, ENC_BIG_ENDIAN);
1063 offset += 1;
1065 /* Length */
1066 proto_tree_add_item(tree, hf_gtpv2_ie_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1067 offset += 2;
1068 /* a(n+4) Spare Instance */
1069 proto_tree_add_bits_item(tree, hf_gtpv2_spare_half_octet, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
1070 proto_tree_add_item(tree, hf_gtpv2_instance, tvb, offset, 1, ENC_BIG_ENDIAN);
1075 * 8.5 Recovery (Restart Counter)
1077 static void
1078 dissect_gtpv2_recovery(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1080 int offset = 0;
1081 guint8 recovery;
1083 recovery = tvb_get_guint8(tvb, offset);
1084 proto_tree_add_item(tree, hf_gtpv2_rec, tvb, offset, 1, ENC_BIG_ENDIAN);
1085 proto_item_append_text(item, "%u", recovery);
1090 /*Start SRVCC Messages*/
1092 /* 6.2 STN-SR */
1093 static void
1094 dissect_gtpv2_stn_sr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1096 proto_item *stn_sr_item;
1097 proto_tree *sub_tree;
1098 tvbuff_t *new_tvb;
1099 int offset = 0;
1101 stn_sr_item = proto_tree_add_item(tree, hf_gtpv2_stn_sr, tvb, offset, length, ENC_NA);
1102 new_tvb = tvb_new_subset(tvb, offset, length, length );
1103 sub_tree = proto_item_add_subtree(stn_sr_item, ett_gtpv2_stn_sr);
1105 /* Octet 5
1106 * contains the Nature of Address and Numbering Plan Indicator (NANPI) of the "AddressString" ASN.1 type (see 3GPP
1107 * TS 29.002 [11]). Octets 6 to (n+4) contain the actual STN-SR (digits of an address encoded as a TBCD-STRING as in
1108 * the "AddressString" ASN.1 type). For an odd number of STN-SR digits, bits 8 to 5 of the last octet are encoded with the
1109 * filler "1111".
1111 dissect_gsm_map_msisdn(new_tvb, pinfo, sub_tree);
1114 /* 6.3 Source to Target Transparent Container */
1116 static void
1117 dissect_gtpv2_src_tgt_trans_con(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1119 int offset = 0;
1120 proto_tree_add_item(tree, hf_gtpv2_len_trans_con, tvb, offset, 1, ENC_BIG_ENDIAN);
1121 offset += 1;
1122 /*ra_type_flag = 0;*/
1124 /* Transparent Container
1125 * When target network is GERAN, this container carries the Old BSS to New BSS
1126 * Information IE defined in 3GPP TS 48.008 [8]. When target network is UTRAN, this container carries the Source RNC
1127 * to Target RNC Transparent Container IE defined in 3GPP TS 25.413 [9]. The Transparent container field includes the
1128 * IE value part as it is specified in the respective specification.
1130 proto_tree_add_text(tree, tvb, offset, length-1, "Transparent Container: %s", tvb_bytes_to_str(tvb, offset, length-1));
1132 * bssmap_old_bss_to_new_bss_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo);
1133 * dissect_ranap_SourceRNC_ToTargetRNC_TransparentContainer_PDU
1138 /* 6.4 Target to Source Transparent Container */
1139 static void
1140 dissect_gtpv2_tgt_src_trans_con(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1142 int offset = 0;
1143 proto_tree_add_item(tree, hf_gtpv2_len_trans_con, tvb, offset, 1, ENC_BIG_ENDIAN);
1144 offset += 1;
1146 /* Transparent Container */
1147 proto_tree_add_text(tree, tvb, offset, length-1, "Transparent Container: %s", tvb_bytes_to_str(tvb, offset, length-1));
1152 /* 6.5 MM Context for E-UTRAN SRVCC */
1153 static void
1154 dissect_gtpv2_mm_con_eutran_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1156 int offset = 0;
1157 guint8 elm_len;
1158 proto_tree *ms_tree, *fi;
1160 proto_tree_add_item(tree, hf_gtpv2_eksi, tvb, offset, 1, ENC_BIG_ENDIAN);
1161 offset += 1;
1162 proto_tree_add_text(tree, tvb, offset , 16, "CKsrvcc: %s ", tvb_bytes_to_str(tvb, offset, 16));
1163 offset += 16;
1164 proto_tree_add_text(tree, tvb, offset, 16, "IKsrvcc: %s ", tvb_bytes_to_str(tvb, offset, 16));
1165 offset += 16;
1167 /* Length of Mobile Station Classmark2 */
1168 elm_len = tvb_get_guint8(tvb, offset);
1169 proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark2, tvb, offset, 1, ENC_BIG_ENDIAN);
1170 offset += 1;
1171 fi = proto_tree_add_text(tree, tvb, offset, elm_len, "Mobile Station Classmark2 %s", tvb_bytes_to_str(tvb, offset, elm_len));
1172 ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
1173 de_ms_cm_2(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
1174 offset += elm_len;
1176 /* Length of Mobile Station Classmark3 */
1177 elm_len = tvb_get_guint8(tvb, offset);
1178 proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark3, tvb, offset, 1, ENC_BIG_ENDIAN);
1179 offset += 1;
1180 fi = proto_tree_add_text(tree, tvb, offset, elm_len, "Mobile Station Classmark3 %s", tvb_bytes_to_str(tvb, offset, elm_len));
1181 ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
1182 de_ms_cm_3(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
1183 offset += elm_len;
1185 /*Length of Supported Codec List */
1186 elm_len = tvb_get_guint8(tvb, offset);
1187 proto_tree_add_item(tree, hf_gtpv2_len_supp_codec_list, tvb, offset, 1, ENC_BIG_ENDIAN);
1188 offset += 1;
1189 fi = proto_tree_add_text(tree, tvb, offset, elm_len, "Supported Codec List %s", tvb_bytes_to_str(tvb, offset, elm_len));
1190 ms_tree = proto_item_add_subtree(fi, ett_gtpv2_supp_codec_list);
1191 de_sup_codec_list(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
1195 /* 6.6 MM Context for UTRAN SRVCC */
1196 static void
1197 dissect_gtpv2_mm_con_utran_srvcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1199 int offset = 0;
1200 guint8 elm_len;
1201 proto_tree *ms_tree, *fi;
1203 proto_tree_add_item(tree, hf_gtpv2_ksi, tvb, offset, 1, ENC_BIG_ENDIAN);
1204 offset += 1;
1206 proto_tree_add_text(tree, tvb, offset, 16, "CK'cs: %s", tvb_bytes_to_str(tvb, offset, 16));
1207 offset += 16;
1208 proto_tree_add_text(tree, tvb, offset, 16, "IK'cs: %s", tvb_bytes_to_str(tvb, offset, 16));
1209 offset += 16;
1210 proto_tree_add_text(tree, tvb, offset, 8, "Kc': %s", tvb_bytes_to_str(tvb, offset, 8));
1211 offset += 8;
1212 proto_tree_add_item(tree, hf_gtpv2_cksn, tvb, offset, 1, ENC_BIG_ENDIAN);
1213 offset += 1;
1215 /*Length of Mobile Station Classmark2 */
1216 elm_len = tvb_get_guint8(tvb, offset);
1217 proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark2, tvb, offset, 1, ENC_BIG_ENDIAN);
1218 offset += 1;
1219 fi = proto_tree_add_text(tree, tvb, offset, elm_len, "Mobile Station Classmark2 %s", tvb_bytes_to_str(tvb, offset, elm_len));
1220 ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
1221 de_ms_cm_2(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
1222 offset += elm_len;
1224 /*Length of Mobile Station Classmark3 */
1225 elm_len = tvb_get_guint8(tvb, offset);
1226 proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark3, tvb, offset, 1, ENC_BIG_ENDIAN);
1227 offset += 1;
1228 fi = proto_tree_add_text(tree, tvb, offset, elm_len, "Mobile Station Classmark3 %s", tvb_bytes_to_str(tvb, offset, elm_len));
1229 ms_tree = proto_item_add_subtree(fi, ett_gtpv2_ms_mark);
1230 de_ms_cm_3(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
1231 offset += elm_len;
1233 /*Length of Supported Codec List */
1234 elm_len = tvb_get_guint8(tvb, offset);
1235 proto_tree_add_item(tree, hf_gtpv2_len_supp_codec_list, tvb, offset, 1, ENC_BIG_ENDIAN);
1236 offset += 1;
1237 fi = proto_tree_add_text(tree, tvb, offset, elm_len, "Supported Codec List %s", tvb_bytes_to_str(tvb, offset, elm_len));
1238 ms_tree = proto_item_add_subtree(fi, ett_gtpv2_supp_codec_list);
1239 de_sup_codec_list(tvb, ms_tree, pinfo, offset, elm_len, NULL, 0);
1243 /* 6.7 SRVCC Cause */
1244 static const value_string gtpv2_srvcc_cause_vals[] = {
1245 {0, "Reserved"},
1246 {1, "Unspecified"},
1247 {2, "Handover/Relocation cancelled by source system "},
1248 {3, "Handover /Relocation Failure with Target system"},
1249 {4, "Handover/Relocation Target not allowed"},
1250 {5, "Unknown Target ID"},
1251 {6, "Target Cell not available"},
1252 {7, "No Radio Resources Available in Target Cell"},
1253 {8, "Failure in Radio Interface Procedure"},
1254 {0, NULL}
1256 static value_string_ext gtpv2_srvcc_cause_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_srvcc_cause_vals);
1258 static void
1259 dissect_gtpv2_srvcc_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1261 int offset = 0;
1262 guint8 srvcc_cause;
1264 srvcc_cause = tvb_get_guint8(tvb, offset);
1265 proto_tree_add_item(tree, hf_gtpv2_srvcc_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
1266 proto_item_append_text(item, "%s (%u)", val_to_str_ext_const(srvcc_cause, &gtpv2_srvcc_cause_vals_ext, "Unknown"), srvcc_cause);
1271 * 3GPP TS 29.280 version 10.3.0
1272 * 6.8 Target RNC ID
1274 static void
1275 dissect_gtpv2_tgt_rnc_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1277 int offset = 0;
1278 guint16 rnc_id;
1279 proto_tree *subtree;
1280 proto_item *rai_item;
1281 guint32 mcc;
1282 guint32 mnc;
1283 guint32 lac;
1284 guint32 curr_offset;
1286 /*ra_type_flag = 1;*/ /*Flag to be set to differentiate GERAN and UTRAN*/
1287 curr_offset = offset;
1289 mcc = (tvb_get_guint8(tvb, curr_offset) & 0x0f) << 8;
1290 mcc |= (tvb_get_guint8(tvb, curr_offset) & 0xf0);
1291 mcc |= (tvb_get_guint8(tvb, curr_offset+1) & 0x0f);
1292 mnc = (tvb_get_guint8(tvb, curr_offset+2) & 0x0f) << 8;
1293 mnc |= (tvb_get_guint8(tvb, curr_offset+2) & 0xf0);
1294 mnc |= (tvb_get_guint8(tvb, curr_offset+1) & 0xf0) >> 4;
1295 if ((mnc & 0x000f) == 0x000f)
1296 mnc = mnc >> 4;
1298 lac = tvb_get_ntohs(tvb, curr_offset + 3);
1299 rnc_id = tvb_get_ntohs(tvb, curr_offset + 5);
1301 rai_item = proto_tree_add_text(tree,
1302 tvb, curr_offset, 6,
1303 "Routing area identification: %x-%x-%u-%u",
1304 mcc, mnc, lac, rnc_id);
1306 subtree = proto_item_add_subtree(rai_item, ett_gtpv2_rai);
1307 dissect_e212_mcc_mnc(tvb, pinfo, subtree, offset, TRUE);
1308 curr_offset+=3;
1310 proto_tree_add_item(subtree, hf_gtpv2_lac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1311 curr_offset+=2;
1312 proto_tree_add_item(subtree, hf_gtpv2_rnc_id, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1313 /*curr_offset+=2;*/
1315 /* no length check possible */
1321 * 3GPP TS 29.280
1322 * 6.9 Target Global Cell ID
1323 * The encoding of this IE is defined in 3GPP TS 29.002
1324 * GlobalCellId ::= OCTET STRING (SIZE (5..7))
1325 * -- Refers to Cell Global Identification defined in TS 3GPP TS 23.003 [17].
1326 * -- The internal structure is defined as follows:
1327 * -- octet 1 bits 4321 Mobile Country Code 1st digit
1328 * -- bits 8765 Mobile Country Code 2nd digit
1329 * -- octet 2 bits 4321 Mobile Country Code 3rd digit
1330 * -- bits 8765 Mobile Network Code 3rd digit
1331 * -- or filler (1111) for 2 digit MNCs
1332 * -- octet 3 bits 4321 Mobile Network Code 1st digit
1333 * -- bits 8765 Mobile Network Code 2nd digit
1334 * -- octets 4 and 5 Location Area Code according to TS 3GPP TS 24.008 [35]
1335 * -- octets 6 and 7 Cell Identity (CI) according to TS 3GPP TS 24.008 [35]
1337 static void
1338 dissect_gtpv2_tgt_global_cell_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1340 int offset = 0;
1341 guint8 tgt_cell_id;
1342 proto_tree *subtree;
1343 proto_item *rai_item;
1344 guint32 mcc;
1345 guint32 mnc;
1346 guint32 lac;
1347 guint32 curr_offset;
1349 curr_offset = offset;
1351 mcc = (tvb_get_guint8(tvb, curr_offset) & 0x0f) << 8;
1352 mcc |= (tvb_get_guint8(tvb, curr_offset) & 0xf0);
1353 mcc |= (tvb_get_guint8(tvb, curr_offset+1) & 0x0f);
1354 mnc = (tvb_get_guint8(tvb, curr_offset+2) & 0x0f) << 8;
1355 mnc |= (tvb_get_guint8(tvb, curr_offset+2) & 0xf0);
1356 mnc |= (tvb_get_guint8(tvb, curr_offset+1) & 0xf0) >> 4;
1357 if ((mnc & 0x000f) == 0x000f)
1358 mnc = mnc >> 4;
1360 lac = tvb_get_ntohs(tvb, curr_offset + 3);
1361 tgt_cell_id = tvb_get_guint8(tvb, curr_offset + 5);
1363 rai_item = proto_tree_add_text(tree,
1364 tvb, curr_offset, 6,
1365 "Routing area identification: %x-%x-%u-%u",
1366 mcc, mnc, lac, tgt_cell_id);
1368 subtree = proto_item_add_subtree(rai_item, ett_gtpv2_rai);
1369 dissect_e212_mcc_mnc(tvb, pinfo, subtree, offset, TRUE);
1371 proto_tree_add_item(subtree, hf_gtpv2_lac, tvb, curr_offset + 3, 2, ENC_BIG_ENDIAN);
1372 proto_tree_add_item(subtree, hf_gtpv2_tgt_g_cell_id, tvb, curr_offset + 5, 2, ENC_BIG_ENDIAN);
1374 proto_item_append_text(item, "%x-%x-%u-%u", mcc, mnc, lac, tgt_cell_id);
1375 /* no length check possible */
1379 /* 6.10 Tunnel Endpoint Identifier for Control Plane (TEID-C) */
1380 static void
1381 dissect_gtpv2_teid_c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1383 int offset = 0;
1385 proto_tree_add_item(tree, hf_gtpv2_teid_c, tvb, offset, 4, ENC_BIG_ENDIAN);
1386 offset += 4;
1387 if (length > 4)
1388 proto_tree_add_text(tree, tvb, offset, length-4, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-4));
1390 proto_item_append_text(item, "%u", tvb_get_ntohl(tvb, offset-4));
1393 /* 6.11 Sv Flags */
1394 static void
1395 dissect_gtpv2_sv_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1397 int offset = 0;
1398 proto_tree_add_item(tree, hf_gtpv2_sv_sti, tvb, offset, 1, ENC_BIG_ENDIAN);
1399 proto_tree_add_item(tree, hf_gtpv2_sv_ics, tvb, offset, 1, ENC_BIG_ENDIAN);
1400 proto_tree_add_item(tree, hf_gtpv2_sv_emind, tvb, offset, 1, ENC_BIG_ENDIAN);
1401 offset += 1;
1402 if (length > 1)
1403 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
1406 /* 6.12 Service Area Identifier */
1408 static void
1409 dissect_gtpv2_sai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1411 int offset = 0;
1413 /* 5 MCC digit 2 MCC digit 1
1414 * 6 MNC digit 3 MCC digit 3
1415 * 7 MNC digit 2 MNC digit 1
1417 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
1418 offset += 3;
1420 /* The Location Area Code (LAC) consists of 2 octets. Bit 8 of Octet 8 is the most significant bit and bit 1 of Octet 9 the
1421 * least significant bit. The coding of the location area code is the responsibility of each administration. Coding using full
1422 * hexadecimal representation shall be used.
1424 proto_tree_add_item(tree, hf_gtpv2_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
1425 offset += 2;
1427 /* The Service Area Code (SAC) consists of 2 octets. Bit 8 of Octet 10 is the most significant bit and bit 1 of Octet 11 the
1428 * least significant bit. The SAC is defined by the operator. See 3GPP TS 23.003 [4] subclause 12.5 for more information
1430 proto_tree_add_item(tree, hf_gtpv2_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
1433 /*End SRVCC Messages*/
1437 * 8.6 Access Point Name (APN)
1438 * The encoding the APN field follows 3GPP TS 23.003 [2] subclause 9.1.
1439 * The content of the APN field shall be the full APN with both the APN Network Identifier
1440 * and APN Operator Identifier being present as specified in 3GPP TS 23.003 [2]
1441 * subclauses 9.1.1 and 9.1.2, 3GPP TS 23.060 [35] Annex A and 3GPP TS 23.401 [3] subclauses 4.3.8.1.
1443 static void
1444 dissect_gtpv2_apn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1446 int offset = 0;
1447 guint8 *apn = NULL;
1448 int name_len, tmp;
1450 if (length > 0) {
1451 name_len = tvb_get_guint8(tvb, offset);
1453 if (name_len < 0x20) {
1454 apn = tvb_get_string(wmem_packet_scope(), tvb, offset + 1, length - 1);
1455 for (;;) {
1456 if (name_len >= length - 1)
1457 break;
1458 tmp = name_len;
1459 name_len = name_len + apn[tmp] + 1;
1460 apn[tmp] = '.';
1462 } else{
1463 apn = tvb_get_string(wmem_packet_scope(), tvb, offset, length);
1465 proto_tree_add_string(tree, hf_gtpv2_apn, tvb, offset, length, apn);
1468 if (apn)
1469 proto_item_append_text(item, "%s", apn);
1474 * 8.7 Aggregate Maximum Bit Rate (AMBR)
1477 static void
1478 dissect_gtpv2_ambr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1480 int offset = 0;
1482 proto_tree_add_item(tree, hf_gtpv2_ambr_up, tvb, offset, 4, ENC_BIG_ENDIAN);
1483 offset += 4;
1484 proto_tree_add_item(tree, hf_gtpv2_ambr_down, tvb, offset, 4, ENC_BIG_ENDIAN);
1488 * 8.8 EPS Bearer ID (EBI)
1490 static void
1491 dissect_gtpv2_ebi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1494 int offset = 0;
1495 guint8 ebi;
1497 /* Spare (all bits set to 0) B8 - B5*/
1498 proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset, 4, ENC_BIG_ENDIAN);
1499 /* EPS Bearer ID (EBI) B4 - B1 */
1500 ebi = tvb_get_guint8(tvb, offset);
1501 proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 1, ENC_BIG_ENDIAN);
1502 proto_item_append_text(item, "%u", ebi);
1506 * 8.9 IP Address
1508 static void
1509 dissect_gtpv2_ip_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1511 int offset = 0;
1512 struct e_in6_addr ipv6_address;
1514 if (length == 4)
1516 proto_tree_add_item(tree, hf_gtpv2_ip_address_ipv4, tvb, offset, length, ENC_BIG_ENDIAN);
1517 proto_item_append_text(item, "IPv4 %s", tvb_ip_to_str(tvb, offset));
1519 else if (length == 16)
1521 proto_tree_add_item(tree, hf_gtpv2_ip_address_ipv6, tvb, offset, length, ENC_NA);
1522 tvb_get_ipv6(tvb, offset, &ipv6_address);
1523 proto_item_append_text(item, "IPv6 %s", ip6_to_str(&ipv6_address));
1527 * 8.10 Mobile Equipment Identity (MEI)
1528 * The ME Identity field contains either the IMEI or the IMEISV
1529 * as defined in clause 6.2 of 3GPP TS 23.003 [2]. It is encoded
1530 * as specified in clause 7.7.53 of 3GPP TS 29.060 [4], beginning
1531 * with octet 4 of Figure 7.7.53.1. The IMEI(SV) digits are encoded
1532 * using BCD coding where IMEI is 15 BCD digits and IMEISV is 16 BCD
1533 * digits. For IMEI, bits 5 to 8 of the last octet shall be filled
1534 * with an end mark coded as '1111'.
1537 static void
1538 dissect_gtpv2_mei(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1540 int offset = 0;
1541 const gchar *mei_str;
1543 /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
1544 * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
1545 * allocated string will be returned.
1547 mei_str = tvb_bcd_dig_to_wmem_packet_str( tvb, 0, length, NULL, FALSE);
1549 proto_tree_add_string(tree, hf_gtpv2_mei, tvb, offset, length, mei_str);
1550 proto_item_append_text(item, "%s", mei_str);
1554 * 8.11 MSISDN
1556 * MSISDN is defined in 3GPP TS 23.003
1557 * Editor's note: MSISDN coding will be defined in TS 24.301.
1559 static void
1560 dissect_gtpv2_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1562 const char *digit_str;
1564 /* Octets 5 to (n+4) represent the MSISDN value is in international number format
1565 * as described in ITU-T Rec E.164 [25] and 3GPP TS 29.002 [41].
1566 * MSISDN value contains only the actual MSISDN number (does not contain the "nature of
1567 * address indicator" octet, which indicates "international number"
1568 * as in 3GPP TS 29.002 [41]) and is encoded as TBCD digits, i.e.
1569 * digits from 0 through 9 are encoded "0000" to "1001".
1570 * When there is an odd number of digits, bits 8 to 5 of the last octet are encoded with
1571 * the filler "1111".
1573 dissect_e164_cc(tvb, tree, 0, TRUE);
1574 /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
1575 * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
1576 * allocated string will be returned.
1578 digit_str = tvb_bcd_dig_to_wmem_packet_str( tvb, 0, length, NULL, FALSE);
1580 proto_tree_add_string(tree, hf_gtpv2_address_digits, tvb, 0, length, digit_str);
1581 proto_item_append_text(item, "%s", digit_str);
1585 * 8.12 Indication
1587 static void
1588 dissect_gtpv2_ind(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1590 int offset = 0;
1591 /* Octet 5 DAF DTF HI DFI OI ISRSI ISRAI SGWCI */
1592 proto_tree_add_item(tree, hf_gtpv2_daf, tvb, offset, 1, ENC_BIG_ENDIAN);
1593 proto_tree_add_item(tree, hf_gtpv2_dtf, tvb, offset, 1, ENC_BIG_ENDIAN);
1594 proto_tree_add_item(tree, hf_gtpv2_hi, tvb, offset, 1, ENC_BIG_ENDIAN);
1595 proto_tree_add_item(tree, hf_gtpv2_dfi, tvb, offset, 1, ENC_BIG_ENDIAN);
1596 proto_tree_add_item(tree, hf_gtpv2_oi, tvb, offset, 1, ENC_BIG_ENDIAN);
1597 proto_tree_add_item(tree, hf_gtpv2_isrsi, tvb, offset, 1, ENC_BIG_ENDIAN);
1598 proto_tree_add_item(tree, hf_gtpv2_israi, tvb, offset, 1, ENC_BIG_ENDIAN);
1599 proto_tree_add_item(tree, hf_gtpv2_sgwci, tvb, offset, 1, ENC_BIG_ENDIAN);
1601 if (length == 1) {
1602 proto_tree_add_text(tree, tvb, 0, length, "Older version?, should be 2 octets in 8.0.0");
1603 return;
1606 offset += 1;
1608 /* Octet 6 SQCI UIMSI CFSI CRSI P PT SI MSV
1609 * 3GPP TS 29.274 version 9.4.0 Release 9
1611 proto_tree_add_item(tree, hf_gtpv2_sqci, tvb, offset, 1, ENC_BIG_ENDIAN);
1612 proto_tree_add_item(tree, hf_gtpv2_uimsi, tvb, offset, 1, ENC_BIG_ENDIAN);
1613 proto_tree_add_item(tree, hf_gtpv2_cfsi, tvb, offset, 1, ENC_BIG_ENDIAN);
1614 proto_tree_add_item(tree, hf_gtpv2_crsi, tvb, offset, 1, ENC_BIG_ENDIAN);
1616 proto_tree_add_item(tree, hf_gtpv2_ps, tvb, offset, 1, ENC_BIG_ENDIAN);
1617 proto_tree_add_item(tree, hf_gtpv2_pt, tvb, offset, 1, ENC_BIG_ENDIAN);
1618 proto_tree_add_item(tree, hf_gtpv2_si, tvb, offset, 1, ENC_BIG_ENDIAN);
1619 proto_tree_add_item(tree, hf_gtpv2_msv, tvb, offset, 1, ENC_BIG_ENDIAN);
1620 offset += 1;
1622 if (length == 2) {
1623 return;
1625 /* Only present in version 9 and higher */
1626 /* Octet 7 Spare Spare Spare Spare Spare Spare Spare CCRSI */
1627 proto_tree_add_item(tree, hf_gtpv2_spare1, tvb, offset, 1, ENC_BIG_ENDIAN);
1628 proto_tree_add_item(tree, hf_gtpv2_spare2, tvb, offset, 1, ENC_BIG_ENDIAN);
1629 proto_tree_add_item(tree, hf_gtpv2_spare3, tvb, offset, 1, ENC_BIG_ENDIAN);
1630 proto_tree_add_item(tree, hf_gtpv2_s6af, tvb, offset, 1, ENC_BIG_ENDIAN);
1631 proto_tree_add_item(tree, hf_gtpv2_s4af, tvb, offset, 1, ENC_BIG_ENDIAN);
1632 proto_tree_add_item(tree, hf_gtpv2_mbmdt, tvb, offset, 1, ENC_BIG_ENDIAN);
1633 proto_tree_add_item(tree, hf_gtpv2_israu, tvb, offset, 1, ENC_BIG_ENDIAN);
1634 proto_tree_add_item(tree, hf_gtpv2_ccrsi, tvb, offset, 1, ENC_BIG_ENDIAN);
1640 * 8.13 Protocol Configuration Options (PCO)
1641 * Protocol Configuration Options (PCO) is transferred via GTP tunnels. The sending entity copies the value part of the
1642 * PCO into the Value field of the PCO IE. The detailed coding of the PCO field from octets 5 to (n+4) shall be specified
1643 * as per clause 10.5.6.3 of 3GPP TS 24.008 [5], starting with octet 3.
1644 * Dissected in packet-gsm_a_gm.c
1646 static void
1647 dissect_gtpv2_pco(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1649 switch (message_type) {
1650 case GTPV2_CREATE_SESSION_REQUEST:
1651 /* PCO options as MS to network direction */
1652 pinfo->link_dir = P2P_DIR_UL;
1653 break;
1654 case GTPV2_CREATE_SESSION_RESPONSE:
1655 /* PCO options as Network to MS direction: */
1656 pinfo->link_dir = P2P_DIR_DL;
1657 break;
1658 default:
1659 break;
1661 de_sm_pco(tvb, tree, pinfo, 0, length, NULL, 0);
1665 * 8.14 PDN Address Allocation (PAA)
1668 static const value_string gtpv2_pdn_type_vals[] = {
1669 {1, "IPv4"},
1670 {2, "IPv6"},
1671 {3, "IPv4/IPv6"},
1672 {0, NULL}
1675 static void
1676 dissect_gtpv2_paa(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1678 int offset = 0;
1679 guint8 pdn_type;
1681 pdn_type = tvb_get_guint8(tvb, offset);
1682 proto_tree_add_item(tree, hf_gtpv2_pdn_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1683 offset += 1;
1684 switch (pdn_type)
1686 case 1:
1687 /* IPv4 */
1688 proto_tree_add_item(tree, hf_gtpv2_pdn_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
1689 break;
1690 case 2:
1691 /* IPv6*/
1692 /* If PDN type value indicates IPv6, octet 6 contains the IPv6 Prefix Length.
1693 * Octets 7 through 22 contain an IPv6 Prefix and Interface Identifier.
1694 * Bit 8 of octet 7 represents the most significant bit of the IPv6 Prefix
1695 * and Interface Identifier and bit 1 of octet 22 the least significant bit.
1697 proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1698 offset += 1;
1699 proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6, tvb, offset, 16, ENC_NA);
1700 break;
1701 case 3:
1702 /* IPv4/IPv6 */
1703 /* If PDN type value indicates IPv4v6, octet 6 contains the IPv6 Prefix Length.
1704 * Octets 7 through 22 contain an IPv6 Prefix and Interface Identifier.
1705 * Bit 8 of octet 7 represents the most significant bit of the IPv6 Prefix
1706 * and Interface Identifier and bit 1 of octet 22 the least significant bit.
1707 * Octets 23 through 26 contain an IPv4 address. Bit 8 of octet 23 represents
1708 * the most significant bit of the IPv4 address and bit 1 of octet 26 the least
1709 * significant bit.
1711 proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1712 offset += 1;
1713 proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6, tvb, offset, 16, ENC_NA);
1714 offset += 16;
1715 proto_tree_add_item(tree, hf_gtpv2_pdn_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
1716 break;
1717 default:
1718 break;
1722 * 8.15 Bearer Quality of Service (Bearer QoS)
1725 static void
1726 dissect_gtpv2_bearer_qos(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1728 int offset = 0;
1729 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
1730 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
1731 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
1732 offset += 1;
1733 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_label_qci, tvb, offset, 1, ENC_BIG_ENDIAN);
1734 offset += 1;
1735 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_mbr_up, tvb, offset, 5, ENC_BIG_ENDIAN);
1736 offset += 5;
1737 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_mbr_down, tvb, offset, 5, ENC_BIG_ENDIAN);
1738 offset += 5;
1739 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_gbr_up, tvb, offset, 5, ENC_BIG_ENDIAN);
1740 offset += 5;
1741 proto_tree_add_item(tree, hf_gtpv2_bearer_qos_gbr_down, tvb, offset, 5, ENC_BIG_ENDIAN);
1745 * 8.16 Flow Quality of Service (Flow QoS)
1748 static void
1749 dissect_gtpv2_flow_qos(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1751 int offset = 0;
1752 proto_tree_add_item(tree, hf_gtpv2_flow_qos_label_qci, tvb, offset, 1, ENC_BIG_ENDIAN);
1753 offset += 1;
1754 proto_tree_add_item(tree, hf_gtpv2_flow_qos_mbr_up, tvb, offset, 5, ENC_BIG_ENDIAN);
1755 offset += 5;
1756 proto_tree_add_item(tree, hf_gtpv2_flow_qos_mbr_down, tvb, offset, 5, ENC_BIG_ENDIAN);
1757 offset += 5;
1758 proto_tree_add_item(tree, hf_gtpv2_flow_qos_gbr_up, tvb, offset, 5, ENC_BIG_ENDIAN);
1759 offset += 5;
1760 proto_tree_add_item(tree, hf_gtpv2_flow_qos_gbr_down, tvb, offset, 5, ENC_BIG_ENDIAN);
1764 * 8.17 RAT Type
1766 static const value_string gtpv2_rat_type_vals[] = {
1767 {0, "Reserved"},
1768 {1, "UTRAN"},
1769 {2, "GERAN"},
1770 {3, "WLAN"},
1771 {4, "GAN"},
1772 {5, "HSPA Evolution"},
1773 {6, "EUTRAN"},
1774 {7, "Virtual"},
1775 {0, NULL}
1777 static value_string_ext gtpv2_rat_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_rat_type_vals);
1780 static void
1781 dissect_gtpv2_rat_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1783 guint8 rat_type;
1785 rat_type = tvb_get_guint8(tvb, 0);
1786 proto_tree_add_item(tree, hf_gtpv2_rat_type, tvb, 0, 1, ENC_BIG_ENDIAN);
1787 proto_item_append_text(item, "%s (%u)", val_to_str_ext_const(rat_type, &gtpv2_rat_type_vals_ext, "Unknown"), rat_type);
1792 * 8.18 Serving Network
1794 static void
1795 dissect_gtpv2_serv_net(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
1797 gchar *mcc_mnc_str;
1799 mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, TRUE);
1800 proto_item_append_text(item, "%s", mcc_mnc_str);
1804 * 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT)
1807 static void
1808 dissect_gtpv2_bearer_tft(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1810 /* The detailed coding of Traffic Aggregate
1811 * Description is specified in 3GPP TS 24.008 [5] ,
1812 * clause 10.5.6.12, beginning with octet 3..
1813 * Use the decoding in packet-gsm_a_gm.c
1815 de_sm_tflow_temp(tvb, tree, pinfo, 0, length, NULL, 0);
1818 /* 8.20 Traffic Aggregate Description (TAD)
1820 static void
1821 dissect_gtpv2_tad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1823 /* The detailed coding of Traffic Aggregate
1824 * Description is specified in 3GPP TS 24.008 [5] ,
1825 * clause 10.5.6.12, beginning with octet 3..
1826 * Use the decoding in packet-gsm_a_gm.c
1828 de_sm_tflow_temp(tvb, tree, pinfo, 0, length, NULL, 0);
1832 * 8.21 User Location Info (ULI)
1834 * The flags ECGI, TAI, RAI, SAI and CGI in octed 5 indicate if the corresponding
1835 * fields are present in the IE or not. If one of these flags is set to "0",
1836 * the corresponding field is not present at all. The respective identities are defined in 3GPP
1837 * TS 23.003 [2].
1838 * Editor's Note: The definition of ECGI is missing in 3GPP TS 23.003 v8.1.0.
1839 * It can be found in 3GPP TS 36.413 v8.3.0, but it is expected that it will be moved
1840 * to 23.003 in a future version.
1843 static void
1844 decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 instance _U_, guint flags)
1846 int offset = 1; /* flags are already dissected */
1847 proto_item *fi;
1848 proto_tree *part_tree;
1850 /* 8.21.1 CGI field */
1851 if (flags & GTPv2_ULI_CGI_MASK)
1853 proto_item_append_text(item, "CGI ");
1854 fi = proto_tree_add_text(tree, tvb, offset, 7, "Cell Global Identity (CGI)");
1855 part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
1856 dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
1857 offset += 3;
1858 proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
1859 offset += 2;
1860 proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
1861 offset += 2;
1862 if (offset == length)
1863 return;
1866 /* 8.21.2 SAI field */
1867 if (flags & GTPv2_ULI_SAI_MASK)
1869 proto_item_append_text(item, "SAI ");
1870 fi = proto_tree_add_text(tree, tvb, offset, 7, "Service Area Identity (SAI)");
1871 part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
1872 dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
1873 offset += 3;
1874 proto_tree_add_item(part_tree, hf_gtpv2_uli_sai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
1875 offset += 2;
1876 proto_tree_add_item(part_tree, hf_gtpv2_uli_sai_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
1877 offset += 2;
1878 if (offset == length)
1879 return;
1881 /* 8.21.3 RAI field */
1882 if (flags & GTPv2_ULI_RAI_MASK)
1884 proto_item_append_text(item, "RAI ");
1885 fi = proto_tree_add_text(tree, tvb, offset, 7, "Routeing Area Identity (RAI)");
1886 part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
1887 dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
1888 offset += 3;
1889 proto_tree_add_item(part_tree, hf_gtpv2_uli_rai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
1890 offset += 2;
1891 proto_tree_add_item(part_tree, hf_gtpv2_uli_rai_rac, tvb, offset, 2, ENC_BIG_ENDIAN);
1892 offset += 2;
1893 if (offset == length)
1894 return;
1896 /* 8.21.4 TAI field */
1897 if (flags & GTPv2_ULI_TAI_MASK)
1899 proto_item_append_text(item, "TAI ");
1900 fi = proto_tree_add_text(tree, tvb, offset, 5, "Tracking Area Identity (TAI)");
1901 part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
1902 dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
1903 offset += 3;
1904 proto_tree_add_item(part_tree, hf_gtpv2_uli_tai_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
1905 offset += 2;
1906 if (offset == length)
1907 return;
1909 /* 8.21.5 ECGI field */
1910 if (flags & GTPv2_ULI_ECGI_MASK)
1912 guint8 octet;
1913 guint32 octet4;
1914 guint8 spare;
1915 guint32 ECGI;
1917 proto_item_append_text(item, "ECGI ");
1918 fi = proto_tree_add_text(tree, tvb, offset, 7, "E-UTRAN Cell Global Identifier (ECGI)");
1919 part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
1920 dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
1921 offset += 3;
1922 /* The bits 8 through 5, of octet e+3 (Fig 8.21.5-1 in TS 29.274 V8.2.0) are spare
1923 * and hence they would not make any difference to the hex string following it,
1924 * thus we directly read 4 bytes from the tvb
1927 octet = tvb_get_guint8(tvb, offset);
1928 spare = octet & 0xF0;
1929 octet4 = tvb_get_ntohl(tvb, offset);
1930 ECGI = octet4 & 0x0FFFFFFF;
1931 proto_tree_add_uint(part_tree, hf_gtpv2_uli_ecgi_eci_spare, tvb, offset, 1, spare);
1932 /* The coding of the E-UTRAN cell identifier is the responsibility of each administration.
1933 * Coding using full hexadecimal representation shall be used.
1935 proto_tree_add_uint(part_tree, hf_gtpv2_uli_ecgi_eci, tvb, offset, 4, ECGI);
1936 /*proto_tree_add_item(tree, hf_gtpv2_uli_ecgi_eci, tvb, offset, 4, ENC_BIG_ENDIAN);*/
1937 offset += 4;
1938 if (offset == length)
1939 return;
1942 /* 8.21.6 LAI field */
1943 if (flags & GTPv2_ULI_LAI_MASK)
1945 proto_item_append_text(item, "LAI ");
1946 fi = proto_tree_add_text(tree, tvb, offset, 5, "LAI (Location Area Identifier)");
1947 part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
1948 dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
1949 offset += 3;
1951 /* The Location Area Code (LAC) consists of 2 octets. Bit 8 of Octet f+3 is the most significant bit
1952 * and bit 1 of Octet f+4 the least significant bit. The coding of the location area code is the
1953 * responsibility of each administration. Coding using full hexadecimal representation shall be used.
1955 proto_tree_add_item(part_tree, hf_gtpv2_uli_lai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
1961 static void
1962 dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
1964 proto_item *flags_item;
1965 proto_tree *flag_tree;
1966 int offset = 0;
1967 guint flags;
1969 flags_item = proto_tree_add_text(tree, tvb, offset, 1, "Flags");
1970 flag_tree = proto_item_add_subtree(flags_item, ett_gtpv2_uli_flags);
1971 flags = tvb_get_guint8(tvb, offset) & 0x3f;
1972 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset >> 3, 2, ENC_BIG_ENDIAN);
1974 /* LAI B6 */
1975 proto_tree_add_item(flag_tree, hf_gtpv2_uli_lai_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
1976 /* ECGI B5 */
1977 proto_tree_add_item(flag_tree, hf_gtpv2_uli_ecgi_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
1978 /* TAI B4 */
1979 proto_tree_add_item(flag_tree, hf_gtpv2_uli_tai_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
1980 /* RAI B3 */
1981 proto_tree_add_item(flag_tree, hf_gtpv2_uli_rai_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
1982 /* SAI B2 */
1983 proto_tree_add_item(flag_tree, hf_gtpv2_uli_sai_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
1984 /* CGI B1 */
1985 proto_tree_add_item(flag_tree, hf_gtpv2_uli_cgi_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
1987 decode_gtpv2_uli(tvb, pinfo, tree, item, length, instance, flags);
1989 return;
1992 /* Diameter 3GPP AVP Code: 22 3GPP-User-Location-Info */
1994 * TS 29.061 v9.2.0
1995 * 16.4.7.2 Coding 3GPP Vendor-Specific RADIUS attributes
1997 * For P-GW, the Geographic Location Type values and coding are defined as follows:
1999 * 0 CGI
2000 * 1 SAI
2001 * 2 RAI
2002 * 3-127 Spare for future use
2003 * 128 TAI
2004 * 129 ECGI
2005 * 130 TAI and ECGI
2006 * 131-255 Spare for future use
2010 static const value_string geographic_location_type_vals[] = {
2011 {0, "CGI"},
2012 {1, "SAI"},
2013 {2, "RAI"},
2014 {128, "TAI"},
2015 {129, "ECGI"},
2016 {130, "TAI and ECGI"},
2017 {0, NULL}
2020 static int
2021 dissect_diameter_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2023 int offset = 0;
2024 guint length;
2025 guint flags;
2026 guint flags_3gpp;
2027 length = tvb_length(tvb);
2028 flags_3gpp = tvb_get_guint8(tvb, offset);
2030 proto_tree_add_item(tree, hf_gtpv2_glt, tvb, offset, 1, ENC_BIG_ENDIAN);
2032 switch (flags_3gpp)
2034 case 0:
2035 /* CGI */
2036 flags = GTPv2_ULI_CGI_MASK;
2037 break;
2038 case 1:
2039 /* SAI */
2040 flags = GTPv2_ULI_SAI_MASK;
2041 break;
2042 case 2:
2043 /* RAI */
2044 flags = GTPv2_ULI_RAI_MASK;
2045 break;
2046 case 128:
2047 /* TAI */
2048 flags = GTPv2_ULI_TAI_MASK;
2049 break;
2050 case 129:
2051 /* ECGI */
2052 flags = GTPv2_ULI_ECGI_MASK;
2053 break;
2054 case 130:
2055 /* TAI and ECGI */
2056 flags = GTPv2_ULI_TAI_MASK + GTPv2_ULI_ECGI_MASK;
2057 break;
2058 default:
2059 proto_tree_add_text(tree, tvb, 1, -1, "Geographic Location");
2060 return length;
2063 decode_gtpv2_uli(tvb, pinfo, tree, NULL, length, 0, flags);
2064 return length;
2068 * 8.22 Fully Qualified TEID (F-TEID)
2070 static const value_string gtpv2_f_teid_interface_type_vals[] = {
2071 { 0, "S1-U eNodeB GTP-U interface"},
2072 { 1, "S1-U SGW GTP-U interface"},
2073 { 2, "S12 RNC GTP-U interface"},
2074 { 3, "S12 SGW GTP-U interface"},
2075 { 4, "S5/S8 SGW GTP-U interface"},
2076 { 5, "S5/S8 PGW GTP-U interface"},
2077 { 6, "S5/S8 SGW GTP-C interface"},
2078 { 7, "S5/S8 PGW GTP-C interface"},
2079 { 8, "S5/S8 SGW PMIPv6 interface"}, /* (the 32 bit GRE key is encoded in 32 bit TEID field "
2080 "and since alternate CoA is not used the control plane and user plane addresses are the same for PMIPv6)"}, */
2081 { 9, "S5/S8 PGW PMIPv6 interface"}, /* (the 32 bit GRE key is encoded in 32 bit TEID field "
2082 "and the control plane and user plane addresses are the same for PMIPv6)"}, */
2083 {10, "S11 MME GTP-C interface"},
2084 {11, "S11/S4 SGW GTP-C interface"},
2085 {12, "S10 MME GTP-C interface"},
2086 {13, "S3 MME GTP-C interface"},
2087 {14, "S3 SGSN GTP-C interface"},
2088 {15, "S4 SGSN GTP-U interface"},
2089 {16, "S4 SGW GTP-U interface"},
2090 {17, "S4 SGSN GTP-C interface"},
2091 {18, "S16 SGSN GTP-C interface"},
2092 {19, "eNodeB GTP-U interface for DL data forwarding"},
2093 {20, "eNodeB GTP-U interface for UL data forwarding"},
2094 {21, "RNC GTP-U interface for data forwarding"},
2095 {22, "SGSN GTP-U interface for data forwarding"},
2096 {23, "SGW GTP-U interface for data forwarding"},
2097 {24, "Sm MBMS GW GTP-C interface"},
2098 {25, "Sn MBMS GW GTP-C interface"},
2099 {26, "Sm MME GTP-C interface"},
2100 {27, "Sn SGSN GTP-C interface"},
2101 {28, "SGW GTP-U interface for UL data forwarding"},
2102 {29, "Sn SGSN GTP-U interface"},
2103 {30, "S2b ePDG GTP-C interface"},
2104 {31, "S2b-U ePDG GTP-U interface"},
2105 {32, "S2b PGW GTP-C interface"},
2106 {33, "S2b-U PGW GTP-U interface"},
2107 {34, "S2a TWAN GTP-U interface"},
2108 {35, "S2a TWAN GTP-C interface"},
2109 {36, "S2a PGW GTP-C interface"},
2110 {37, "S2a PGW GTP-U interface"},
2111 {0, NULL}
2113 static value_string_ext gtpv2_f_teid_interface_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_f_teid_interface_type_vals);
2115 static const true_false_string gtpv2_f_teid_v4_vals = {
2116 "IPv4 address present",
2117 "IPv4 address not present",
2120 static const true_false_string gtpv2_f_teid_v6_vals = {
2121 "IPv6 address present",
2122 "IPv6 address not present",
2125 static void
2126 dissect_gtpv2_f_teid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
2128 int offset = 0;
2129 guint8 flags;
2131 flags = tvb_get_guint8(tvb, offset);
2132 proto_tree_add_item(tree, hf_gtpv2_f_teid_v4, tvb, offset, 1, ENC_BIG_ENDIAN);
2133 proto_tree_add_item(tree, hf_gtpv2_f_teid_v6, tvb, offset, 1, ENC_BIG_ENDIAN);
2134 /* NOTE: "Interface type" IE is defined with 5 bits only in the earlier releases of this specification,
2135 * thus pre-Rel-10 GTPv2-C nodes can ignore bit "6" which is marked as "Spare" in earlier releases,
2136 * allowing backward compatibility.
2138 proto_tree_add_item(tree, hf_gtpv2_f_teid_interface_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2140 offset += 1;
2141 proto_tree_add_item(tree, hf_gtpv2_f_teid_gre_key, tvb, offset, 4, ENC_BIG_ENDIAN);
2142 proto_item_append_text(item, "%s, TEID/GRE Key: 0x%s",
2143 val_to_str_ext_const((flags & 0x3f), &gtpv2_f_teid_interface_type_vals_ext, "Unknown"),
2144 tvb_bytes_to_str(tvb, offset, 4));
2146 offset += 4;
2147 if (flags & 0x80)
2149 proto_tree_add_item(tree, hf_gtpv2_f_teid_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
2150 proto_item_append_text(item, ", IPv4 %s", tvb_ip_to_str(tvb, offset));
2151 offset += 4;
2153 if (flags & 0x40)
2155 proto_tree_add_item(tree, hf_gtpv2_f_teid_ipv6, tvb, offset, 16, ENC_NA);
2156 proto_item_append_text(item, ", IPv6 %s", tvb_ip6_to_str(tvb, offset));
2160 * 8.23 TMSI
2162 static void
2163 dissect_gtpv2_tmsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2165 proto_tree_add_item(tree, hf_gtpv2_tmsi, tvb, 0, 4, ENC_BIG_ENDIAN);
2166 proto_tree_add_text(item, tvb, 0, length, "TMSI: %s", tvb_bytes_to_str(tvb, 0, 4));
2169 * 8.24 Global CN-Id
2170 * (TS 23.003)
2171 * 12.3 CN Identifier
2173 * A CN node is uniquely identified within a PLMN by its CN Identifier (CN-Id). The CN-Id together with the PLMN
2174 * identifier globally identifies the CN node. The CN-Id together with the PLMN-Id is used as the CN node identifier in
2175 * RANAP signalling over the Iu interface.
2176 * Global CN-Id = PLMN-Id || CN-Id
2177 * The CN-Id is defined by the operator, and set in the nodes via O&M.
2178 * For the syntax description and the use of this identifier in RANAP signalling, see 3GPP TS 25.413 [17].
2181 static void
2182 dissect_gtpv2_g_cn_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
2184 int offset = 0;
2186 dissect_e212_mcc_mnc(tvb, pinfo, tree, 0, TRUE);
2187 offset += 3;
2189 /* >CN-ID M INTEGER (0..4095) */
2190 proto_tree_add_text(tree, tvb, offset, 2, "CN-Id: %s",
2191 tvb_bytes_to_str(tvb, offset, 2));
2194 * 8.25 S103 PDN Data Forwarding Info (S103PDF)
2196 static void
2197 dissect_gtpv2_s103pdf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2199 int offset = 0;
2200 guint8 m, k, i;
2202 /* The HSGW Address and GRE Key identify a GRE Tunnel towards a HSGW over S103 interface for a specific PDN
2203 * connection of the UE. The EPS Bearer IDs specify the EPS Bearers which require data forwarding that belonging to this
2204 * PDN connection. The number of EPS bearer Ids included is specified by the value of EPS Bearer ID Number.
2206 /* Octet 5 HSGW Address for forwarding Length = m */
2207 m = tvb_get_guint8(tvb, offset);
2208 proto_tree_add_item(tree, hf_gtpv2_hsgw_addr_f_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2209 offset += 1;
2211 /* 6 to (m+5) HSGW Address for forwarding [4..16] */
2212 switch (m) {
2213 case 4:
2214 /* IPv4 */
2215 proto_tree_add_item(tree, hf_gtpv2_hsgw_addr_ipv4, tvb, offset, 1, ENC_BIG_ENDIAN);
2216 offset += 4;
2217 break;
2218 case 16:
2219 /* IPv6 */
2220 proto_tree_add_item(tree, hf_gtpv2_hsgw_addr_ipv6, tvb, offset, 1, ENC_NA);
2221 offset += 16;
2222 break;
2223 default:
2224 /* Error */
2225 proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_ie_len_invalid, tvb, 0, length,
2226 "Wrong length %u, should be 4 or 16", m);
2227 return;
2230 /* (m+6)- to (m+9) GRE Key */
2231 proto_tree_add_item(tree, hf_gtpv2_gre_key, tvb, offset, 4, ENC_BIG_ENDIAN);
2232 offset += 4;
2234 /* (m+10) EPS Bearer ID Number = k */
2235 k = tvb_get_guint8(tvb, offset);
2236 proto_tree_add_text(tree, tvb, offset, 1, "EPS Bearer ID Number = %d", k);
2237 offset += 1;
2239 /* (m+11) to (m+10+k)
2240 * Spare EPS Bearer ID
2242 for ( i = 0; i < k; i++ ) {
2243 proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
2244 proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 1, ENC_BIG_ENDIAN);
2245 offset += 1;
2250 * 8.26 S1-U Data Forwarding (S1UDF)
2252 static void
2253 dissect_gtpv2_s1udf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2255 int offset = 0;
2256 guint8 m;
2258 /* 5 Spare EPS Bearer ID */
2259 proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
2260 proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 1, ENC_BIG_ENDIAN);
2261 offset += 1;
2262 /* 6 Serving GW Address Length = m */
2263 m = tvb_get_guint8(tvb, offset);
2264 proto_tree_add_text(tree, tvb, offset, 1, "Serving GW Address Length = %u", m);
2265 offset += 1;
2266 /* 7 to (m+6) Serving GW Address [4..16] */
2267 switch (m) {
2268 case 4:
2269 /* IPv4 */
2270 proto_tree_add_item(tree, hf_gtpv2_sgw_addr_ipv4, tvb, offset, 1, ENC_BIG_ENDIAN);
2271 offset += 4;
2272 break;
2273 case 16:
2274 /* IPv6 */
2275 proto_tree_add_item(tree, hf_gtpv2_sgw_addr_ipv6, tvb, offset, 1, ENC_NA);
2276 offset += 16;
2277 break;
2278 default:
2279 /* Error */
2280 proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_ie_len_invalid, tvb, 0, length,
2281 "Wrong length %u, should be 4 or 16", m);
2282 return;
2285 /* (m+7) to (m+10)
2286 * Serving GW S1-U TEID
2288 proto_tree_add_item(tree, hf_gtpv2_sgw_s1u_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
2292 * 8.27 Delay Value
2295 static void
2296 dissect_gtpv2_delay_value(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
2298 int offset = 0;
2300 proto_tree_add_item(tree, hf_gtpv2_delay_value, tvb, offset, 1, ENC_BIG_ENDIAN);
2304 * 8.28 Bearer Context (grouped IE)
2307 static void
2308 dissect_gtpv2_bearer_ctx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
2310 int offset = 0;
2311 tvbuff_t *new_tvb;
2312 proto_tree *grouped_tree;
2314 proto_item_append_text(item, "[Grouped IE]");
2315 grouped_tree = proto_item_add_subtree(item, ett_gtpv2_bearer_ctx);
2317 new_tvb = tvb_new_subset(tvb, offset, length, length );
2318 dissect_gtpv2_ie_common(new_tvb, pinfo, grouped_tree, 0, message_type);
2321 /* 8.29 Charging ID */
2322 static void
2323 dissect_gtpv2_charging_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2325 int offset = 0;
2327 proto_tree_add_item(tree, hf_gtpv2_charging_id, tvb, offset, length, ENC_BIG_ENDIAN);
2331 /* 8.30 Charging Characteristics
2332 * The charging characteristics information element is defined in 3GPP TS 32.251 [8]
2333 * and is a way of informing both the SGW and PGW of the rules for producing charging
2334 * information based on operator configured triggers. For the encoding of this
2335 * information element see 3GPP TS 32.298 [9].
2337 static void
2338 dissect_gtpv2_char_char(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2340 int offset = 0;
2342 proto_tree_add_item(tree, hf_gtpv2_charging_characteristic, tvb, offset, 2, ENC_BIG_ENDIAN);
2343 if (length > 2) {
2344 offset += 2;
2345 /* These octet(s) is/are present only if explicitly specified */
2346 proto_tree_add_text(tree, tvb, offset, length-2, "Remaining octets");
2352 * 8.30 Bearer Flag
2354 static void
2355 dissect_gtpv2_bearer_flag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2358 int offset = 0;
2360 /* Octet 5 Spare VB PPC */
2361 proto_tree_add_item(tree, hf_gtpv2_bearer_flag_ppc, tvb, offset, length, ENC_BIG_ENDIAN);
2362 proto_tree_add_item(tree, hf_gtpv2_bearer_flag_vb, tvb, offset, length, ENC_BIG_ENDIAN);
2366 * 8.34 PDN Type
2368 static void
2369 dissect_gtpv2_pdn_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2372 int offset = 0;
2373 guint8 pdn;
2375 if (length != 1) {
2376 proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_ie_len_invalid, tvb, 0, length,
2377 "Wrong length indicated. Expected 1, got %u", length);
2378 return;
2381 proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset << 3, 5, ENC_BIG_ENDIAN);
2382 pdn = tvb_get_guint8(tvb, offset)& 0x7;
2383 proto_tree_add_item(tree, hf_gtpv2_pdn_type, tvb, offset, length, ENC_BIG_ENDIAN);
2384 proto_item_append_text(item, "%s", val_to_str_const(pdn, gtpv2_pdn_type_vals, "Unknown"));
2389 * 8.31 Trace Information
2391 static void
2392 dissect_gtpv2_tra_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2394 proto_item *trigg, *msc_server, *mgw, *sgsn, *ggsn, *bm_sc, *sgw_mme, *ne_types;
2395 proto_tree *trigg_tree, *msc_server_tree, *mgw_tree, *sgsn_tree, *ggsn_tree;
2396 proto_tree *bm_sc_tree, *sgw_mme_tree, *ne_types_tree;
2397 proto_item *interfaces, *imsc_server, *lmgw, *lsgsn, *lggsn, *lrnc, *lbm_sc, *lmme, *lsgw, *lpdn_gw, *lenb;
2398 proto_tree *interfaces_tree, *imsc_server_tree, *lmgw_tree, *lsgsn_tree, *lggsn_tree, *lrnc_tree;
2399 proto_tree *lbm_sc_tree, *lmme_tree, *lsgw_tree, *lpdn_gw_tree, *lenb_tree;
2401 int offset = 0;
2402 #if 0
2403 guint8 *trace_id = NULL;
2404 #endif
2405 guint8 tdl;
2406 guint16 tid;
2407 guint32 bit_offset;
2409 dissect_e212_mcc_mnc(tvb, pinfo, tree, 0, TRUE);
2410 offset += 3;
2412 /* Append Trace ID to main tree */
2413 tid = tvb_get_ntohs(tvb, offset);
2414 proto_item_append_text(item, "Trace ID: %d ", tid);
2416 /* Trace ID */
2417 /*--------------------------------------------------
2418 * trace_id = tvb_format_text(tvb, offset, 2);
2419 * proto_tree_add_string(tree, hf_gtpv2_tra_info, tvb, offset, length, trace_id);
2420 *--------------------------------------------------*/
2421 proto_tree_add_text(tree, tvb, offset, 3, "Trace ID: %d", tid);
2422 offset += 3;
2424 /* Triggering Events, put all into a new tree called trigging_tree */
2425 trigg = proto_tree_add_text(tree, tvb, offset, 8, "Trigging Events");
2426 trigg_tree = proto_item_add_subtree(trigg, ett_gtpv2_tra_info_trigg);
2428 /* Create all subtrees */
2429 msc_server = proto_tree_add_text(trigg_tree, tvb, offset, 2, "MSC Server");
2430 msc_server_tree = proto_item_add_subtree(msc_server, ett_gtpv2_tra_info_trigg_msc_server);
2432 mgw = proto_tree_add_text(trigg_tree, tvb, offset + 2, 1, "MGW");
2433 mgw_tree = proto_item_add_subtree(mgw, ett_gtpv2_tra_info_trigg_mgw);
2435 sgsn = proto_tree_add_text(trigg_tree, tvb, offset + 3, 2, "SGSN");
2436 sgsn_tree = proto_item_add_subtree(sgsn, ett_gtpv2_tra_info_trigg_sgsn);
2438 ggsn = proto_tree_add_text(trigg_tree, tvb, offset + 5, 1, "GGSN");
2439 ggsn_tree = proto_item_add_subtree(ggsn, ett_gtpv2_tra_info_trigg_ggsn);
2441 bm_sc = proto_tree_add_text(trigg_tree, tvb, offset + 6, 1, "BM-SC");
2442 bm_sc_tree = proto_item_add_subtree(bm_sc, ett_gtpv2_tra_info_trigg_bm_sc);
2444 sgw_mme = proto_tree_add_text(trigg_tree, tvb, offset + 7, 1, "SGW MME");
2445 sgw_mme_tree = proto_item_add_subtree(sgw_mme, ett_gtpv2_tra_info_trigg_sgw_mme);
2447 /* MSC Server - 2 octets */
2448 proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_momt_calls, tvb, offset, 1, ENC_BIG_ENDIAN);
2449 proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_momt_sms, tvb, offset, 1, ENC_BIG_ENDIAN);
2450 proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_lu_imsi_ad, tvb, offset, 1, ENC_BIG_ENDIAN);
2451 proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_handovers, tvb, offset, 1, ENC_BIG_ENDIAN);
2452 proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_ss, tvb, offset, 1, ENC_BIG_ENDIAN);
2453 bit_offset = offset << 3;
2454 proto_tree_add_bits_item(msc_server_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2455 offset += 1;
2456 bit_offset = offset << 3;
2457 proto_tree_add_bits_item(msc_server_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2458 offset += 1;
2460 /* MGW - 1 octet */
2461 proto_tree_add_item(mgw_tree, hf_gtpv2_tra_info_mgw_context, tvb, offset, 1, ENC_BIG_ENDIAN);
2462 bit_offset = offset << 3;
2463 proto_tree_add_bits_item(mgw_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
2464 offset += 1;
2465 /* SGSN - 2 octets */
2466 proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_pdp_context, tvb, offset, 1, ENC_BIG_ENDIAN);
2467 proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_momt_sms, tvb, offset, 1, ENC_BIG_ENDIAN);
2468 proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_rau_gprs_ad, tvb, offset, 1, ENC_BIG_ENDIAN);
2469 proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_mbms, tvb, offset, 1, ENC_BIG_ENDIAN);
2470 bit_offset = offset << 3;
2471 proto_tree_add_bits_item(sgsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2472 offset += 1;
2473 proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2474 bit_offset = offset << 3;
2475 proto_tree_add_bits_item(sgsn_tree, hf_gtpv2_reserved, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2476 offset += 1;
2477 /* GGSN - 1 octet */
2478 proto_tree_add_item(ggsn_tree, hf_gtpv2_tra_info_ggsn_pdp, tvb, offset, 1, ENC_BIG_ENDIAN);
2479 proto_tree_add_item(ggsn_tree, hf_gtpv2_tra_info_ggsn_mbms, tvb, offset, 1, ENC_BIG_ENDIAN);
2480 bit_offset = offset << 3;
2481 proto_tree_add_bits_item(ggsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
2482 offset += 1;
2483 /* BM-SC - 1 octet */
2484 proto_tree_add_item(bm_sc_tree, hf_gtpv2_tra_info_bm_sc, tvb, offset, 1, ENC_BIG_ENDIAN);
2485 bit_offset = offset << 3;
2486 proto_tree_add_bits_item(bm_sc_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
2487 offset += 1;
2488 /* MME/SGW - 1 octet */
2489 proto_tree_add_item(sgw_mme_tree, hf_gtpv2_tra_info_mme_sgw_ss, tvb, offset, 1, ENC_BIG_ENDIAN);
2490 proto_tree_add_item(sgw_mme_tree, hf_gtpv2_tra_info_mme_sgw_sr, tvb, offset, 1, ENC_BIG_ENDIAN);
2491 proto_tree_add_item(sgw_mme_tree, hf_gtpv2_tra_info_mme_sgw_iataud, tvb, offset, 1, ENC_BIG_ENDIAN);
2492 bit_offset = offset << 3;
2493 proto_tree_add_bits_item(sgw_mme_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2494 offset += 1;
2496 /* Create NE Types subtree */
2497 ne_types = proto_tree_add_text(tree, tvb, offset, 2, "List of NE Types");
2498 ne_types_tree = proto_item_add_subtree(ne_types, ett_gtpv2_tra_info_ne_types);
2501 /* List of NE Types */
2502 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_msc_s, tvb, offset, 1, ENC_BIG_ENDIAN);
2503 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_mgw, tvb, offset, 1, ENC_BIG_ENDIAN);
2504 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_sgsn, tvb, offset, 1, ENC_BIG_ENDIAN);
2505 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_ggsn, tvb, offset, 1, ENC_BIG_ENDIAN);
2506 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_rnc, tvb, offset, 1, ENC_BIG_ENDIAN);
2507 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_bm_sc, tvb, offset, 1, ENC_BIG_ENDIAN);
2508 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_mme, tvb, offset, 1, ENC_BIG_ENDIAN);
2509 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_sgw, tvb, offset, 1, ENC_BIG_ENDIAN);
2510 offset += 1;
2511 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_pdn_gw, tvb, offset, 1, ENC_BIG_ENDIAN);
2512 proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_enb, tvb, offset, 1, ENC_BIG_ENDIAN);
2513 bit_offset = offset << 3;
2514 proto_tree_add_bits_item(ne_types_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
2515 offset += 1;
2517 /* Trace Depth Length */
2518 tdl = tvb_get_guint8(tvb, offset);
2519 proto_tree_add_item(tree, hf_gtpv2_tra_info_tdl, tvb, offset, 1, ENC_BIG_ENDIAN);
2520 offset += 1;
2522 /* Trace Depth List
2523 * Will be displayed if length of Trace Depth Length is > 0
2524 * The list will only contains UTF8String, RAW DATA
2526 proto_tree_add_text(tree, tvb, offset, tdl, "Trace Depth List: %s", tvb_bytes_to_str(tvb, offset, tdl));
2527 offset += tdl;
2529 /* Set up subtree interfaces and put all interfaces under it */
2530 interfaces = proto_tree_add_text(tree, tvb, offset, 12, "List of Interfaces");
2531 interfaces_tree = proto_item_add_subtree(interfaces, ett_gtpv2_tra_info_interfaces);
2533 /* Create all subtrees */
2534 imsc_server = proto_tree_add_text(interfaces_tree, tvb, offset, 2, "MSC Server");
2535 imsc_server_tree = proto_item_add_subtree(imsc_server, ett_gtpv2_tra_info_interfaces_imsc_server);
2537 lmgw = proto_tree_add_text(interfaces_tree, tvb, offset + 2, 1, "MGW");
2538 lmgw_tree = proto_item_add_subtree(lmgw, ett_gtpv2_tra_info_interfaces_lmgw);
2540 lsgsn = proto_tree_add_text(interfaces_tree, tvb, offset + 3, 2, "SGSN");
2541 lsgsn_tree = proto_item_add_subtree(lsgsn, ett_gtpv2_tra_info_interfaces_lsgsn);
2543 lggsn = proto_tree_add_text(interfaces_tree, tvb, offset + 5, 1, "GGSN");
2544 lggsn_tree = proto_item_add_subtree(lggsn, ett_gtpv2_tra_info_interfaces_lggsn);
2546 lrnc = proto_tree_add_text(interfaces_tree, tvb, offset + 6, 1, "RNC");
2547 lrnc_tree = proto_item_add_subtree(lrnc, ett_gtpv2_tra_info_interfaces_lrnc);
2549 lbm_sc = proto_tree_add_text(interfaces_tree, tvb, offset + 7, 1, "BM-SC");
2550 lbm_sc_tree = proto_item_add_subtree(lbm_sc, ett_gtpv2_tra_info_interfaces_lbm_sc);
2552 lmme = proto_tree_add_text(interfaces_tree, tvb, offset + 8, 1, "MME");
2553 lmme_tree = proto_item_add_subtree(lmme, ett_gtpv2_tra_info_interfaces_lmme);
2555 lsgw = proto_tree_add_text(interfaces_tree, tvb, offset + 9, 1, "SGW");
2556 lsgw_tree = proto_item_add_subtree(lsgw, ett_gtpv2_tra_info_interfaces_lsgw);
2558 lpdn_gw = proto_tree_add_text(interfaces_tree, tvb, offset + 10, 1, "PDN GW");
2559 lpdn_gw_tree = proto_item_add_subtree(lpdn_gw, ett_gtpv2_tra_info_interfaces_lpdn_gw);
2561 lenb = proto_tree_add_text(interfaces_tree, tvb, offset + 11, 1, "eNB");
2562 lenb_tree = proto_item_add_subtree(lenb, ett_gtpv2_tra_info_interfaces_lpdn_lenb);
2564 /* MSC Server - 2 octests */
2565 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_a, tvb, offset, 1, ENC_BIG_ENDIAN);
2566 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_lu, tvb, offset, 1, ENC_BIG_ENDIAN);
2567 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_mc, tvb, offset, 1, ENC_BIG_ENDIAN);
2568 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_g, tvb, offset, 1, ENC_BIG_ENDIAN);
2569 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_b, tvb, offset, 1, ENC_BIG_ENDIAN);
2570 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_e, tvb, offset, 1, ENC_BIG_ENDIAN);
2571 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_f, tvb, offset, 1, ENC_BIG_ENDIAN);
2572 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_cap, tvb, offset, 1, ENC_BIG_ENDIAN);
2573 offset += 1;
2574 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_d, tvb, offset, 1, ENC_BIG_ENDIAN);
2575 proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_c, tvb, offset, 1, ENC_BIG_ENDIAN);
2576 bit_offset = offset << 3;
2577 proto_tree_add_bits_item(imsc_server_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
2578 offset += 1;
2579 /* MGW - 1 octet */
2580 proto_tree_add_item(lmgw_tree, hf_gtpv2_tra_info_lmgw_mc, tvb, offset, 1, ENC_BIG_ENDIAN);
2581 proto_tree_add_item(lmgw_tree, hf_gtpv2_tra_info_lmgw_nb_up, tvb, offset, 1, ENC_BIG_ENDIAN);
2582 proto_tree_add_item(lmgw_tree, hf_gtpv2_tra_info_lmgw_lu_up, tvb, offset, 1, ENC_BIG_ENDIAN);
2583 bit_offset = offset << 3;
2584 proto_tree_add_bits_item(lmgw_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2585 offset += 1;
2586 /* SGSN - 2 octets */
2587 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_gb, tvb, offset, 1, ENC_BIG_ENDIAN);
2588 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_lu, tvb, offset, 1, ENC_BIG_ENDIAN);
2589 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_gn, tvb, offset, 1, ENC_BIG_ENDIAN);
2590 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_map_gr, tvb, offset, 1, ENC_BIG_ENDIAN);
2591 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_map_gd, tvb, offset, 1, ENC_BIG_ENDIAN);
2592 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_map_gf, tvb, offset, 1, ENC_BIG_ENDIAN);
2593 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_gs, tvb, offset, 1, ENC_BIG_ENDIAN);
2594 proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_ge, tvb, offset, 1, ENC_BIG_ENDIAN);
2595 offset += 1;
2596 bit_offset = offset << 3;
2597 proto_tree_add_bits_item(lsgsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2598 offset += 1;
2600 /* GGSN - 1 octet */
2601 proto_tree_add_item(lggsn_tree, hf_gtpv2_tra_info_lggsn_gn, tvb, offset, 1, ENC_BIG_ENDIAN);
2602 proto_tree_add_item(lggsn_tree, hf_gtpv2_tra_info_lggsn_gi, tvb, offset, 1, ENC_BIG_ENDIAN);
2603 proto_tree_add_item(lggsn_tree, hf_gtpv2_tra_info_lggsn_gmb, tvb, offset, 1, ENC_BIG_ENDIAN);
2604 bit_offset = offset << 3;
2605 proto_tree_add_bits_item(lggsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2606 offset += 1;
2607 /* RNC - 1 octet */
2608 proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_lu, tvb, offset, 1, ENC_BIG_ENDIAN);
2609 proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_lur, tvb, offset, 1, ENC_BIG_ENDIAN);
2610 proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_lub, tvb, offset, 1, ENC_BIG_ENDIAN);
2611 proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_uu, tvb, offset, 1, ENC_BIG_ENDIAN);
2612 bit_offset = offset << 3;
2613 proto_tree_add_bits_item(lrnc_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2614 offset += 1;
2615 /* BM_SC - 1 octet */
2616 proto_tree_add_item(lbm_sc_tree, hf_gtpv2_tra_info_lbm_sc_gmb, tvb, offset, 1, ENC_BIG_ENDIAN);
2617 bit_offset = offset << 3;
2618 proto_tree_add_bits_item(lbm_sc_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
2619 offset += 1;
2620 /* MME - 1 octet */
2621 proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s1_mme, tvb, offset, 1, ENC_BIG_ENDIAN);
2622 proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s3, tvb, offset, 1, ENC_BIG_ENDIAN);
2623 proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s6a, tvb, offset, 1, ENC_BIG_ENDIAN);
2624 proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s10, tvb, offset, 1, ENC_BIG_ENDIAN);
2625 proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s11, tvb, offset, 1, ENC_BIG_ENDIAN);
2626 bit_offset = offset << 3;
2627 proto_tree_add_bits_item(lmme_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2628 offset += 1;
2629 /* SGW - 1 octet */
2630 proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s4, tvb, offset, 1, ENC_BIG_ENDIAN);
2631 proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s5, tvb, offset, 1, ENC_BIG_ENDIAN);
2632 proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s8b, tvb, offset, 1, ENC_BIG_ENDIAN);
2633 proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s11, tvb, offset, 1, ENC_BIG_ENDIAN);
2634 bit_offset = offset << 3;
2635 proto_tree_add_bits_item(lsgw_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2636 offset += 1;
2637 /* PDN GW - 1 octet */
2638 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s2a, tvb, offset, 1, ENC_BIG_ENDIAN);
2639 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s2b, tvb, offset, 1, ENC_BIG_ENDIAN);
2640 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s2c, tvb, offset, 1, ENC_BIG_ENDIAN);
2641 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s5, tvb, offset, 1, ENC_BIG_ENDIAN);
2642 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s6c, tvb, offset, 1, ENC_BIG_ENDIAN);
2643 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_gx, tvb, offset, 1, ENC_BIG_ENDIAN);
2644 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s8b, tvb, offset, 1, ENC_BIG_ENDIAN);
2645 proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_sgi, tvb, offset, 1, ENC_BIG_ENDIAN);
2646 offset += 1;
2647 /* eNB - 1 octet */
2648 proto_tree_add_item(lenb_tree, hf_gtpv2_tra_info_lenb_s1_mme, tvb, offset, 1, ENC_BIG_ENDIAN);
2649 proto_tree_add_item(lenb_tree, hf_gtpv2_tra_info_lenb_x2, tvb, offset, 1, ENC_BIG_ENDIAN);
2650 proto_tree_add_item(lenb_tree, hf_gtpv2_tra_info_lenb_uu, tvb, offset, 1, ENC_BIG_ENDIAN);
2651 bit_offset = offset << 3;
2652 proto_tree_add_bits_item(lenb_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2654 /*--------------------------------------------------
2655 * offset += 1;
2656 *--------------------------------------------------*/
2658 /* IP Address of Trace Collection Entity */
2659 while ( (offset + 4) <= length ) {
2660 offset += 1;
2661 proto_tree_add_item(tree, hf_gtpv2_ipv4_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
2662 offset += 3;
2667 * 8.33 Paging Cause
2668 * 8.33 Void (TS 129 274 V9.4.0 (2010-10))
2671 /* 8.35 Procedure Transaction ID (PTI) */
2672 static void
2673 dissect_gtpv2_pti(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
2675 proto_tree_add_item(tree, hf_gtpv2_pti, tvb, 0, 1, ENC_BIG_ENDIAN);
2678 * 8.36 DRX Parameter
2680 static void
2681 dissect_gtpv2_drx_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2683 int offset = 0;
2685 /* 36.413 : 9.2.1.17 Paging Cause, void */
2686 proto_tree_add_text(tree, tvb, offset, length, "DRX parameter: %s", tvb_bytes_to_str(tvb, offset, (length )));
2690 * 8.37 UE Network Capability
2691 * UE Network Capability is coded as depicted in Figure 8.37-1. Actual coding of the UE Network Capability field is
2692 * defined in 3GPP TS 24.301
2694 static void
2695 dissect_gtpv2_ue_net_capability(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
2697 de_emm_ue_net_cap(tvb, tree, pinfo, 0, length, NULL, 0);
2701 * 8.38 MM Context
2703 static const value_string gtpv2_mm_context_security_mode[] = {
2704 {0, "GSM Key and Triplets"},
2705 {1, "UMTS Key, Used Cipher and Quintuplets"},
2706 {2, "GSM Key, Used Cipher and Quintuplets"},
2707 {3, "UMTS Key and Quintuplets"},
2708 {4, "EPS Security Context, Quadruplets and Quintuplets" },
2709 {5, "UMTS Key, Quadruplets and Quintuplets"},
2710 {0, NULL }
2713 static const true_false_string gtpv2_nhi_vals = {
2714 "NH (Next Hop) and NCC (Next Hop Chaining Count) are both present",
2715 "NH (Next Hop) and NCC (Next Hop Chaining Count) not present",
2718 /* Table 8.38-2: Used NAS Cipher Values */
2720 static const value_string gtpv2_mm_context_unc_vals[] = {
2721 {0, "No ciphering"},
2722 {1, "128-EEA1"},
2723 {2, "128-EEA2"},
2724 {3, "EEA3"},
2725 {4, "EEA4" },
2726 {5, "EEA5"},
2727 {6, "EEA6"},
2728 {7, "EEA7"},
2729 {0, NULL}
2732 /* Table 8.38-3: Used Cipher Values */
2733 static const value_string gtpv2_mm_context_used_cipher_vals[] = {
2734 {0, "No ciphering"},
2735 {1, "GEA/1"},
2736 {2, "GEA/2"},
2737 {3, "GEA/3"},
2738 {4, "GEA/4" },
2739 {5, "GEA/5"},
2740 {6, "GEA/6"},
2741 {7, "GEA/7"},
2742 {0, NULL}
2745 /* Table 8.38-4: Used NAS integrity protection algorithm Values */
2746 static const value_string gtpv2_mm_context_unipa_vals[] = {
2747 {0, "No ciphering"},
2748 {1, "128-EEA1"},
2749 {2, "128-EEA2"},
2750 {3, "EEA3"},
2751 {4, "EEA4" },
2752 {5, "EEA5"},
2753 {6, "EEA6"},
2754 {7, "EEA7"},
2755 {0, NULL}
2758 /* Helper functions */
2760 /* Figure 8.38-7: Authentication Triplet */
2761 static int
2762 dissect_gtpv2_authentication_triplets(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 num_triplet)
2764 proto_item *auth_tri_item;
2765 proto_tree *auth_tri_tree;
2766 int i;
2768 for (i = 0; i < num_triplet; i++) {
2769 auth_tri_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Triplet %u", i);
2770 auth_tri_tree = proto_item_add_subtree(auth_tri_item, ett_gtpv2_mm_context_auth_tri);
2772 * Figure 8.38-8: Authentication Quintuplet
2773 * 1 to 16 RAND
2774 * 17 to 20 SRES
2775 * 21 to 28 Kc
2777 proto_tree_add_item(auth_tri_tree, hf_gtpv2_mm_context_rand, tvb, offset, 16, ENC_NA);
2778 offset += 16;
2779 proto_tree_add_text(auth_tri_tree, tvb, offset, 4, "SRES': %s", tvb_bytes_to_str(tvb, offset, 4));
2780 offset += 4;
2781 proto_tree_add_text(auth_tri_tree, tvb, offset, 8, "Kc': %s", tvb_bytes_to_str(tvb, offset, 8));
2782 offset += 8;
2786 return offset;
2789 static int
2790 dissect_gtpv2_authentication_quintuplets(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 nr_qui)
2792 proto_item *auth_qui_item;
2793 proto_tree *auth_qui_tree;
2794 int i;
2795 guint8 xres_len, autn_len;
2797 for (i = 0; i < nr_qui; i++) {
2798 auth_qui_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Quintuplet %u", i);
2799 auth_qui_tree = proto_item_add_subtree(auth_qui_item, ett_gtpv2_mm_context_auth_qui);
2801 * Figure 8.38-8: Authentication Quintuplet
2802 * 1 to 16 RAND
2803 * 17 XRES Length
2804 * 18 to m XRES
2805 * (m+1) to (m+16) CK
2806 * (m+17) to (m+32) IK
2807 * m+33 AUTN Length
2808 * (m+34) to n AUTN
2810 proto_tree_add_item(auth_qui_tree, hf_gtpv2_mm_context_rand, tvb, offset, 16, ENC_NA);
2811 offset += 16;
2812 xres_len = tvb_get_guint8(tvb, offset);
2813 proto_tree_add_item(auth_qui_tree, hf_gtpv2_mm_context_xres_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2814 offset += 1;
2815 proto_tree_add_item(auth_qui_tree, hf_gtpv2_mm_context_xres, tvb, offset, xres_len, ENC_BIG_ENDIAN);
2816 offset += xres_len;
2817 proto_tree_add_item(auth_qui_tree, hf_gtpv2_ck, tvb, offset, 16, ENC_BIG_ENDIAN);
2818 offset += 16;
2819 proto_tree_add_item(auth_qui_tree, hf_gtpv2_ik, tvb, offset, 16, ENC_BIG_ENDIAN);
2820 offset += 16;
2821 autn_len = tvb_get_guint8(tvb, offset);
2822 proto_tree_add_item(auth_qui_tree, hf_gtpv2_mm_context_autn_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2823 offset += 1;
2824 proto_tree_add_item(auth_qui_tree, hf_gtpv2_mm_context_autn, tvb, offset, autn_len, ENC_BIG_ENDIAN);
2825 offset += autn_len;
2828 return offset;
2832 static int
2833 dissect_gtpv2_authentication_quadruplets(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 nr_qui)
2835 proto_item *auth_qua_item;
2836 proto_tree *auth_qua_tree;
2837 guint8 tmp;
2838 int i;
2840 for (i = 0; i < nr_qui; i++) {
2841 auth_qua_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Quadruplet");
2842 auth_qua_tree = proto_item_add_subtree(auth_qua_item, ett_gtpv2_mm_context_auth_qua);
2844 proto_tree_add_text(auth_qua_tree, tvb, offset, 16, "RAND: %s",
2845 tvb_bytes_to_str(tvb, offset, 16));
2846 offset += 16;
2848 tmp = tvb_get_guint8(tvb, offset++);
2850 proto_tree_add_text(auth_qua_tree, tvb, offset, tmp, "XRES: %s",
2851 tvb_bytes_to_str(tvb, offset, tmp));
2852 offset += tmp;
2854 tmp = tvb_get_guint8(tvb, offset++);
2856 proto_tree_add_text(auth_qua_tree, tvb, offset, tmp, "AUTN: %s",
2857 tvb_bytes_to_str(tvb, offset, tmp));
2858 offset += tmp;
2860 proto_tree_add_item(tree, hf_gtpv2_mm_context_kasme, tvb, offset, 32, ENC_BIG_ENDIAN);
2862 offset += 32;
2864 return offset;
2867 static const value_string gtpv2_mm_context_higher_br_16mb_flg_vals[] = {
2868 {0, "Not allowed"},
2869 {1, "Allowed"},
2870 {0, NULL}
2873 static int
2874 dissect_gtpv2_mm_context_common_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint8 samb_ri, guint8 uamb_ri)
2876 proto_item *net_cap_item, *msnt_cap_item;
2877 proto_tree *net_cap_tree, *msnt_cap_tree;
2878 guint8 ue_net_cap_len, ms_net_cap_len, mei_len;
2881 * If SAMBRI (Subscribed UE AMBR Indicator), bit 1 of octet 6, is set to "1",
2882 * then the Uplink/downlink Subscribed UE AMBR parameter field is present,
2884 if (samb_ri) {
2885 /* j to (j+3) Uplink Subscribed UE AMBR */
2886 proto_tree_add_text(tree, tvb, offset, 4, "Uplink Subscribed UE AMBR: %d Kbps",
2887 tvb_get_ntohl(tvb, offset));
2889 offset += 4;
2890 /* (j+4) to (j+7) Downlink Subscribed UE AMBR */
2891 proto_tree_add_text(tree, tvb, offset, 4, "Downlink Subscribed UE AMBR: %d Kbps",
2892 tvb_get_ntohl(tvb, offset));
2894 offset += 4;
2897 * If UAMBRI (Used UE AMBR Indicator), bit 2 of octet 6, is set to "1",
2898 * then the Uplink/downlink Used UE AMBR parameter field is present
2900 if (uamb_ri) {
2901 /* i to (i+3) Uplink Used UE AMBR */
2902 proto_tree_add_text(tree, tvb, offset, 4, "Uplink Used UE AMBR: %d Kbps",
2903 tvb_get_ntohl(tvb, offset));
2905 offset += 4;
2906 /* (i+4) to (i+7) Downlink Used UE AMBR */
2907 proto_tree_add_text(tree, tvb, offset, 4, "Downlink Used UE AMBR: %d Kbps",
2908 tvb_get_ntohl(tvb, offset));
2910 offset += 4;
2912 /* q Length of UE Network Capability */
2913 ue_net_cap_len = tvb_get_guint8(tvb, offset);
2914 proto_tree_add_item(tree, hf_gtpv2_mm_context_ue_net_cap_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2915 offset += 1;
2916 /* (q+1) to k UE Network Capability */
2917 if (ue_net_cap_len) {
2918 /* The UE Network Capability coding is specified in clause 9.9.3.34 of 3GPP TS 24.301 [23].
2919 * If Length of UE Network Capability is zero, then the UE Network Capability parameter
2920 * shall not be present.
2922 net_cap_item = proto_tree_add_text(tree, tvb, offset, ue_net_cap_len, "UE Network Capability");
2923 net_cap_tree = proto_item_add_subtree(net_cap_item, ett_gtpv2_mm_context_net_cap);
2924 offset += de_emm_ue_net_cap(tvb, net_cap_tree, pinfo, offset, ue_net_cap_len, NULL, 0);
2926 /* k+1 Length of MS Network Capability */
2927 ms_net_cap_len = tvb_get_guint8(tvb, offset);
2928 proto_tree_add_item(tree, hf_gtpv2_mm_context_ms_net_cap_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2929 offset += 1;
2930 /* (k+2) to m MS Network Capability
2931 * The MS Network Capability coding is specified in clause 10.5.5.12 of 3GPP TS 24.008 [5].
2932 * If Length of MS Network Capability is zero, then the MS Network Capability parameter shall not be present.
2934 if (ms_net_cap_len) {
2935 msnt_cap_item = proto_tree_add_text(tree, tvb, offset, ms_net_cap_len, "MS network capability");
2936 msnt_cap_tree = proto_item_add_subtree(msnt_cap_item, ett_gtpv2_ms_network_capability);
2937 offset += de_gmm_ms_net_cap(tvb, msnt_cap_tree, pinfo, offset, ms_net_cap_len, NULL, 0);
2939 /* m+1 Length of Mobile Equipment Identity (MEI) */
2940 mei_len = tvb_get_guint8(tvb, offset);
2941 proto_tree_add_item(tree, hf_gtpv2_mm_context_mei_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2942 offset += 1;
2943 /* (m+2) to r Mobile Equipment Identity (MEI) */
2944 if (mei_len) {
2945 const gchar *mei_str;
2947 mei_str = tvb_bcd_dig_to_wmem_packet_str( tvb, offset, mei_len, NULL, FALSE);
2948 proto_tree_add_string(tree, hf_gtpv2_mei, tvb, offset, mei_len, mei_str);
2949 offset += mei_len;
2951 return offset;
2954 static int
2955 dissect_gtpv2_access_restriction_data(tvbuff_t *tvb, proto_tree *tree, int offset)
2957 proto_item *accrstdata_item;
2958 proto_tree *accrstdata_tree;
2960 accrstdata_item = proto_tree_add_text(tree, tvb, offset, 1, "Access restriction data");
2961 accrstdata_tree = proto_item_add_subtree(accrstdata_item, ett_gtpv2_access_rest_data);
2962 /* Spare HNNA ENA INA GANA GENA UNA */
2963 proto_tree_add_bits_item(accrstdata_tree, hf_gtpv2_spare_bits, tvb, (offset << 3), 2, ENC_BIG_ENDIAN);
2964 proto_tree_add_item(accrstdata_tree, hf_gtpv2_hnna, tvb, offset, 1, ENC_BIG_ENDIAN);
2965 proto_tree_add_item(accrstdata_tree, hf_gtpv2_ena, tvb, offset, 1, ENC_BIG_ENDIAN);
2966 proto_tree_add_item(accrstdata_tree, hf_gtpv2_ina, tvb, offset, 1, ENC_BIG_ENDIAN);
2967 proto_tree_add_item(accrstdata_tree, hf_gtpv2_gana, tvb, offset, 1, ENC_BIG_ENDIAN);
2968 proto_tree_add_item(accrstdata_tree, hf_gtpv2_gena, tvb, offset, 1, ENC_BIG_ENDIAN);
2969 proto_tree_add_item(accrstdata_tree, hf_gtpv2_una, tvb, offset, 1, ENC_BIG_ENDIAN);
2970 offset += 1;
2972 return offset;
2975 /* Type = 103 (decimal)
2976 * Figure 8.38-1: GSM Key and Triplets
2978 static void
2979 dissect_gtpv2_mm_context_gsm_t(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
2981 proto_item *flag;
2982 proto_tree *flag_tree;
2983 int offset;
2984 guint8 oct, drxi, num_triplet, uamb_ri, samb_ri;
2986 offset = 0;
2987 flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
2988 flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
2990 /* Octet 5 */
2991 /* Security Mode | Spare | DRXI | CKSN */
2992 drxi = (tvb_get_guint8(tvb, offset) & 0x08) >> 3;
2993 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, ENC_BIG_ENDIAN);
2994 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset << 3, 1, ENC_BIG_ENDIAN);
2995 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN);
2996 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_cksn, tvb, offset, 1, ENC_BIG_ENDIAN);
2997 offset += 1;
2998 /* Octet 6 */
2999 /* Number of Triplet | Spare | UAMB RI | SAMB RI */
3000 oct = tvb_get_guint8(tvb, offset);
3001 num_triplet = oct >> 5;
3002 uamb_ri = (oct & 0x02) >> 1;
3003 samb_ri = oct & 0x01;
3005 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_tri, tvb, offset, 1, ENC_BIG_ENDIAN);
3006 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, (offset << 3) + 3, 3, ENC_BIG_ENDIAN);
3007 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN);
3008 proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset << 3) + 7, 1, ENC_BIG_ENDIAN);
3009 offset += 1;
3011 /* Octet 7 Spare Used Cipher */
3012 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset << 3)), 5, ENC_BIG_ENDIAN);
3013 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_used_cipher, tvb, offset, 1, ENC_BIG_ENDIAN);
3014 offset += 1;
3016 /* 8 to 15 Kc */
3017 proto_tree_add_text(tree, tvb, offset, 8, "Kc': %s", tvb_bytes_to_str(tvb, offset, 8));
3018 offset += 8;
3020 /* 16 to h Authentication Triplet [0..4] */
3021 if (num_triplet) {
3022 dissect_gtpv2_authentication_triplets(tvb, tree, offset, num_triplet);
3026 * (h+1) to (h+2) DRX parameter
3028 if (drxi) {
3029 proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN);
3030 offset += 2;
3033 /* Dissect octet j to r */
3034 offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri);
3036 proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
3039 /* Type = 104 (decimal)
3040 * Figure 8.38-2: UMTS Key, Used Cipher and Quintuplets
3042 static void
3043 dissect_gtpv2_mm_context_utms_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3045 proto_item *flag;
3046 proto_tree *flag_tree;
3047 int offset;
3048 guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len, hbr_len;
3050 offset = 0;
3051 flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
3052 flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
3054 /* Octet 5 */
3055 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, ENC_BIG_ENDIAN);
3056 drxi = (tvb_get_guint8(tvb, offset) & 0x08) >> 3;
3057 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset << 3) + 3), 1, ENC_BIG_ENDIAN);
3058 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN);
3059 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_cksn_ksi, tvb, offset, 1, ENC_BIG_ENDIAN);
3060 offset += 1;
3061 /* Octet 6 */
3062 oct = tvb_get_guint8(tvb, offset);
3063 nr_qui = oct >> 5;
3064 uamb_ri = (oct & 0x02) >> 1;
3065 samb_ri = oct & 0x01;
3066 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN);
3067 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, (offset << 3) + 3, 3, ENC_BIG_ENDIAN);
3068 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN);
3069 proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset << 3) + 7, 1, ENC_BIG_ENDIAN);
3070 offset += 1;
3071 /* Octet 7 Spare Used Cipher */
3072 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset << 3)), 5, ENC_BIG_ENDIAN);
3073 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_used_cipher, tvb, offset, 1, ENC_BIG_ENDIAN);
3074 offset += 1;
3076 /* Octet 8 to 23 CK */
3077 proto_tree_add_item(tree, hf_gtpv2_ck, tvb, offset, 16, ENC_BIG_ENDIAN);
3078 offset += 16;
3079 /* Octet 24 to 39 IK */
3080 proto_tree_add_item(tree, hf_gtpv2_ik, tvb, offset, 16, ENC_BIG_ENDIAN);
3081 offset += 16;
3084 * 40 to h Authentication Quintuplet [0..4]
3086 if (nr_qui) {
3087 offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui);
3091 * (h+1) to (h+2) DRX parameter
3093 if (drxi) {
3094 proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN);
3095 offset += 2;
3099 /* Dissect octet j to r */
3100 offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri);
3102 /* r+1 Spare HNNA ENA INA GANA GENA UNA
3103 * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed),
3104 * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and
3105 * HNNA(HO-To-Non-3GPPAccess Not Allowed).
3107 if (offset < (gint)length) {
3108 offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset);
3109 } else {
3110 return;
3112 if (offset == (gint)length) {
3113 return;
3116 /* r+2 Length of Voice Domain Preference and UE's Usage Setting */
3117 vdp_len = tvb_get_guint8(tvb, offset);
3118 proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3119 offset += 1;
3120 /* (r+3) to s Voice Domain Preference and UE's Usage Setting */
3121 if (vdp_len) {
3122 proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting");
3123 offset += vdp_len;
3126 /* s+1 Length of Higher bitrates than 16 Mbps flag */
3127 if (offset == (gint)length) {
3128 hbr_len = tvb_get_guint8(tvb, offset);
3129 proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3130 offset += 1;
3131 /* s+2 Higher bitrates than 16 Mbps flag */
3132 if (hbr_len) {
3133 proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
3134 offset += hbr_len;
3136 } else {
3137 return;
3140 proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
3144 /* Type = 105 (decimal)
3145 * Figure 8.38-3: GSM Key, Used Cipher and Quintuplets
3147 static void
3148 dissect_gtpv2_mm_context_gsm_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3150 proto_item *flag;
3151 proto_tree *flag_tree;
3152 int offset;
3153 guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len, hbr_len;
3155 offset = 0;
3156 flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
3157 flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
3159 /* Octet 5 */
3160 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, ENC_BIG_ENDIAN);
3161 drxi = (tvb_get_guint8(tvb, offset) & 0x08) >> 3;
3162 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset << 3) + 3), 1, ENC_BIG_ENDIAN);
3163 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN);
3164 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_cksn_ksi, tvb, offset, 1, ENC_BIG_ENDIAN);
3165 offset += 1;
3166 /* Octet 6 */
3167 oct = tvb_get_guint8(tvb, offset);
3168 nr_qui = oct >> 5;
3169 uamb_ri = (oct & 0x02) >> 1;
3170 samb_ri = oct & 0x01;
3171 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN);
3172 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, (offset << 3) + 3, 3, ENC_BIG_ENDIAN);
3173 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN);
3174 proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset << 3) + 7, 1, ENC_BIG_ENDIAN);
3175 offset += 1;
3176 /* Octet 7 Spare Used Cipher */
3177 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset << 3)), 5, ENC_BIG_ENDIAN);
3178 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_used_cipher, tvb, offset, 1, ENC_BIG_ENDIAN);
3179 offset += 1;
3180 /* 8 to 15 Kc */
3181 proto_tree_add_text(tree, tvb, offset, 8, "Kc': %s", tvb_bytes_to_str(tvb, offset, 8));
3182 offset += 8;
3185 * 40 to h Authentication Quintuplet [0..4]
3187 if (nr_qui) {
3188 offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui);
3192 * (h+1) to (h+2) DRX parameter
3194 if (drxi) {
3195 proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN);
3196 offset += 2;
3200 /* Dissect octet j to r */
3201 offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri);
3203 /* r+1 Spare HNNA ENA INA GANA GENA UNA
3204 * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed),
3205 * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and
3206 * HNNA(HO-To-Non-3GPPAccess Not Allowed).
3208 if (offset < (gint)length) {
3209 offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset);
3210 } else {
3211 return;
3213 if (offset == (gint)length) {
3214 return;
3217 /* r+2 Length of Voice Domain Preference and UE's Usage Setting */
3218 vdp_len = tvb_get_guint8(tvb, offset);
3219 proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3220 offset += 1;
3221 /* (r+3) to s Voice Domain Preference and UE's Usage Setting */
3222 if (vdp_len) {
3223 proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting");
3224 offset += vdp_len;
3227 /* s+1 Length of Higher bitrates than 16 Mbps flag */
3228 if (offset < (gint)length) {
3229 hbr_len = tvb_get_guint8(tvb, offset);
3230 proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3231 offset += 1;
3232 /* s+2 Higher bitrates than 16 Mbps flag */
3233 if (hbr_len) {
3234 proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
3235 offset += hbr_len;
3237 } else {
3238 return;
3241 proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
3245 /* Type = 106 (decimal)
3246 * Figure 8.38-4: UMTS Key and Quintuplets
3248 static void
3249 dissect_gtpv2_mm_context_utms_q(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
3251 proto_item *flag;
3252 proto_tree *flag_tree;
3253 int offset;
3254 guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len, hbr_len;
3256 offset = 0;
3257 flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
3258 flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
3260 /* Octet 5 */
3261 /* Security Mode Spare DRXI KSI */
3262 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, ENC_BIG_ENDIAN);
3263 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset << 3) + 3), 1, ENC_BIG_ENDIAN);
3264 drxi = (tvb_get_guint8(tvb, offset) & 0x08) >> 3;
3265 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN);
3266 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_ksi, tvb, offset, 1, ENC_BIG_ENDIAN);
3267 offset += 1;
3268 /* Octet 6 */
3269 /* Number of Quintuplets Spare UAMB RI SAMB RI */
3270 oct = tvb_get_guint8(tvb, offset);
3271 nr_qui = oct >> 5;
3272 uamb_ri = (oct & 0x02) >> 1;
3273 samb_ri = oct & 0x01;
3275 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN);
3276 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, (offset << 3) + 3, 3, ENC_BIG_ENDIAN);
3277 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN);
3278 proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset << 3) + 7, 1, ENC_BIG_ENDIAN);
3279 offset += 1;
3280 /* Octet 7 Spare */
3281 proto_tree_add_item(flag_tree, hf_gtpv2_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
3282 offset += 1;
3283 /* Octet 8 to 23 CK */
3284 proto_tree_add_item(tree, hf_gtpv2_ck, tvb, offset, 16, ENC_BIG_ENDIAN);
3285 offset += 16;
3286 /* Octet 24 to 39 IK */
3287 proto_tree_add_item(tree, hf_gtpv2_ik, tvb, offset, 16, ENC_BIG_ENDIAN);
3288 offset += 16;
3291 * 40 to h Authentication Quintuplet [0..4]
3293 if (nr_qui) {
3294 offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui);
3298 * (h+1) to (h+2) DRX parameter
3300 if (drxi) {
3301 proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN);
3302 offset += 2;
3306 /* Dissect octet j to r */
3307 offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri);
3309 /* r+1 Spare HNNA ENA INA GANA GENA UNA
3310 * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed),
3311 * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and
3312 * HNNA(HO-To-Non-3GPPAccess Not Allowed).
3314 if (offset < (gint)length) {
3315 offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset);
3316 } else {
3317 return;
3319 if (offset == (gint)length) {
3320 return;
3323 /* r+2 Length of Voice Domain Preference and UE's Usage Setting */
3324 vdp_len = tvb_get_guint8(tvb, offset);
3325 proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3326 offset += 1;
3327 /* (r+3) to s Voice Domain Preference and UE's Usage Setting */
3328 if (vdp_len) {
3329 proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting");
3330 offset += vdp_len;
3333 /* s+1 Length of Higher bitrates than 16 Mbps flag */
3334 if (offset < (gint)length) {
3335 hbr_len = tvb_get_guint8(tvb, offset);
3336 proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3337 offset += 1;
3338 /* s+2 Higher bitrates than 16 Mbps flag */
3339 if (hbr_len) {
3340 proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
3341 offset += hbr_len;
3343 } else {
3344 return;
3347 /* (s+3) to (n+4) These octet(s) is/are present only if explicitly specified */
3348 proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
3352 /* 8.38 MM Context
3353 * Type = 107 (decimal)
3354 * Figure 8.38-5: EPS Security Context and Quadruplets
3356 static void
3357 dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
3359 proto_item *flag_item, *qua_item, *qui_item;
3360 proto_tree *flag_tree, *qua_tree, *qui_tree;
3361 gint offset;
3362 guint8 tmp, nhi, drxi, nr_qua, nr_qui, uamb_ri, samb_ri, vdp_len;
3364 offset = 0;
3366 flag_item = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
3367 flag_tree = proto_item_add_subtree(flag_item, ett_gtpv2_mm_context_flag);
3369 /* Octet 5
3370 * Bits
3371 * 8 7 6 5 4 3 2 1
3372 * Security Mode | NHI | DRXI | KSIASME
3374 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, ENC_BIG_ENDIAN);
3375 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nhi, tvb, offset, 1, ENC_BIG_ENDIAN);
3376 /* If NHI (Next Hop Indicator), bit 5 of octet 5, is set to "1",
3377 * then the optional parameters NH (Next Hop) and NCC (Next
3378 * Hop Chaining Count) are both present, otherwise their octets are not present.
3380 tmp = tvb_get_guint8(tvb, offset);
3381 nhi = (tmp & 0x10) >> 4;
3382 drxi = (tmp & 0x08) >> 3;
3383 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN);
3384 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_ksi_a, tvb, offset, 1, ENC_BIG_ENDIAN);
3385 offset += 1;
3387 /* Octet 6
3388 * Bits
3389 * 8 7 6 5 4 3 2 1
3390 * Number of | Number of | UAMB | OSCI
3391 * Quintuplets | Quadruplet | RI |
3393 tmp = tvb_get_guint8(tvb, offset);
3394 nr_qui = (tmp & 0xe0) >> 5;
3395 nr_qua = tmp & 0x1c;
3396 nr_qua >>= 2;
3397 uamb_ri = (tmp & 0x2) >> 1;
3399 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN);
3400 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qua, tvb, offset, 1, ENC_BIG_ENDIAN);
3401 /* UAMB RI */
3402 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN);
3403 /* OSCI */
3404 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_osci, tvb, offset, 1, ENC_BIG_ENDIAN);
3405 offset += 1;
3407 /* Octet 7 SAMB RI Used NAS integrity protection algorithm Used NAS Cipher*/
3408 /* SAMB RI */
3409 samb_ri = tvb_get_guint8(tvb, offset) >> 7;
3410 proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, offset << 3, 1, ENC_BIG_ENDIAN);
3411 /* Used NAS integrity protection algorithm */
3412 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_unipa, tvb, offset, 1, ENC_BIG_ENDIAN);
3413 /* Used NAS Cipher */
3414 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_unc, tvb, offset, 1, ENC_BIG_ENDIAN);
3415 offset += 1;
3417 /* Octet 8-10 NAS Downlink Count*/
3418 proto_tree_add_item(tree, hf_gtpv2_mm_context_nas_dl_cnt, tvb, offset, 3, ENC_BIG_ENDIAN);
3419 offset += 3;
3421 /* Octet 11-13 NAS Uplink Count */
3422 proto_tree_add_item(tree, hf_gtpv2_mm_context_nas_ul_cnt, tvb, offset, 3, ENC_BIG_ENDIAN);
3423 offset += 3;
3425 /* Octet 14-45 */
3426 proto_tree_add_item(tree, hf_gtpv2_mm_context_kasme, tvb, offset, 32, ENC_BIG_ENDIAN);
3427 offset += 32;
3429 qua_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Quadruplets %u", nr_qua);
3430 if ( nr_qua ){
3431 qua_tree = proto_item_add_subtree(qua_item, ett_gtpv2_qua);
3432 offset = dissect_gtpv2_authentication_quadruplets(tvb, qua_tree, offset, nr_qua);
3433 }else {
3434 PROTO_ITEM_SET_GENERATED(qua_item);
3437 qui_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Quintuplets %u", nr_qui);
3438 if (nr_qui) {
3439 qui_tree = proto_item_add_subtree(qui_item, ett_gtpv2_qui);
3440 offset = dissect_gtpv2_authentication_quintuplets(tvb, qui_tree, offset, nr_qui);
3441 }else{
3442 PROTO_ITEM_SET_GENERATED(qui_item);
3445 /* (h+1) to (h+2) DRX parameter */
3446 if (drxi) {
3447 proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN);
3448 offset += 2;
3451 /* Octet p to p+31 & Octet p+32 */
3452 if ( nhi )
3454 proto_tree_add_text(tree, tvb, offset, 32, "NH (Next Hop): %s",
3455 tvb_bytes_to_str(tvb, offset, 32));
3456 offset += 32;
3458 proto_tree_add_text(tree, tvb, offset, 1, "NCC (Next Hop Chaining Count): %d",
3459 (tvb_get_guint8(tvb, offset) & 0x0f));
3460 offset += 1;
3464 /* Dissect octet j to r */
3465 offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri);
3467 /* r+1 Spare HNNA ENA INA GANA GENA UNA */
3468 if (offset < (gint)length) {
3469 offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset);
3470 } else {
3471 return;
3474 if (offset == (gint)length) {
3475 return;
3478 /* r+2 Length of Voice Domain Preference and UE's Usage Setting */
3479 vdp_len = tvb_get_guint8(tvb, offset);
3480 proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3481 offset += 1;
3482 /* (r+3) to s Voice Domain Preference and UE's Usage Setting */
3483 if (vdp_len) {
3484 proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting");
3485 /*offset += vdp_len;*/
3491 * Type = 108 (decimal)
3492 * Figure 8.38-6: UMTS Key, Quadruplets and Quintuplets
3494 static void
3495 dissect_gtpv2_mm_context_utms_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3497 proto_item *flag;
3498 proto_tree *flag_tree;
3499 guint32 offset;
3500 guint8 tmp, drxi, nr_qua, nr_qui, uamb_ri, samb_ri, vdp_length;
3502 offset = 0;
3503 flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
3504 flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
3506 /* Octet 5
3507 * Security Mode Spare DRXI KSIASME
3509 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, ENC_BIG_ENDIAN);
3510 proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset << 3) + 3), 1, ENC_BIG_ENDIAN);
3511 drxi = (tvb_get_guint8(tvb, offset) & 0x08) >> 3;
3512 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN);
3513 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_ksi_a, tvb, offset, 1, ENC_BIG_ENDIAN);
3514 offset += 1;
3516 /* Octet 6
3517 * Bits
3518 * 8 7 6 5 4 3 2 1
3519 * Number of | Number of | UAMB | SAMB
3520 * Quintuplets | Quadruplet | RI | RI
3522 tmp = tvb_get_guint8(tvb, offset);
3523 nr_qui = (tmp & 0xe0) >> 5;
3524 nr_qua = tmp & 0x1c;
3525 nr_qua >>= 2;
3526 uamb_ri = (tmp & 0x2) >> 1;
3527 samb_ri = tmp & 0x01;
3529 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN);
3530 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qua, tvb, offset, 1, ENC_BIG_ENDIAN);
3531 proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN);
3532 proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset << 3) + 7, 1, ENC_BIG_ENDIAN);
3533 offset += 1;
3534 /* Octet 7 Spare */
3535 proto_tree_add_item(flag_tree, hf_gtpv2_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
3536 offset += 1;
3537 /* Octet 8 to 23 CK */
3538 proto_tree_add_item(tree, hf_gtpv2_ck, tvb, offset, 16, ENC_BIG_ENDIAN);
3539 offset += 16;
3540 /* Octet 24 to 39 IK */
3541 proto_tree_add_item(tree, hf_gtpv2_ik, tvb, offset, 16, ENC_BIG_ENDIAN);
3542 offset += 16;
3544 if ( nr_qua )
3546 offset = dissect_gtpv2_authentication_quadruplets(tvb, tree, offset, nr_qui);
3549 if (nr_qui) {
3550 offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui);
3553 /* (h+1) to (h+2) DRX parameter */
3554 if (drxi) {
3555 proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN);
3556 offset += 2;
3559 /* Dissect octet j to r */
3560 offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri);
3562 if (offset >= (guint32)length) {
3563 return;
3565 /* r+1 Spare HNNA ENA INA GANA GENA UNA */
3566 offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset);
3568 if (offset >= (guint32)length) {
3569 return;
3572 /* The Voice Domain Preference and UE's Usage Setting coding is specified in clause 10.5.5.28 of 3GPP TS 24.008 [5]. If
3573 * Length of Voice Domain Preference and UE's Usage Setting is zero, then the Voice Domain Preference and UE's Usage
3574 * Setting parameter shall not be present.
3576 vdp_length = tvb_get_guint8(tvb, offset);
3577 proto_tree_add_item(tree, hf_gtpv2_vdp_length, tvb, offset, 1, ENC_BIG_ENDIAN);
3578 offset++;
3580 if(vdp_length !=0){
3581 offset += de_gmm_voice_domain_pref(tvb, tree, pinfo, offset, vdp_length, NULL, 0);
3584 if (offset < (guint32)length) {
3585 proto_tree_add_text(tree, tvb, offset, -1, "The rest of the IE not dissected yet");
3591 * 8.39 PDN Connection (grouped IE)
3593 static void
3594 dissect_gtpv2_PDN_conn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
3596 int offset = 0;
3597 proto_tree *grouped_tree;
3598 tvbuff_t *new_tvb;
3600 proto_item_append_text(item, "[Grouped IE]");
3601 grouped_tree = proto_item_add_subtree(item, ett_gtpv2_PDN_conn);
3602 new_tvb = tvb_new_subset(tvb, offset, length, length );
3604 dissect_gtpv2_ie_common(new_tvb, pinfo, grouped_tree, offset, message_type);
3607 * 8.40 PDU Numbers
3609 static void
3610 dissect_gtpv2_pdn_numbers(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3612 proto_item *nsapi_ti;
3613 proto_tree *nsapi_tree;
3614 guint8 nsapi;
3615 guint16 dlgtpu_seq, ulgtpu_seq, send_npdu_nr, rec_npdu_nr;
3616 int offset = 0;
3618 nsapi = (tvb_get_guint8(tvb, offset) & 0x08);
3619 nsapi_ti = proto_tree_add_text(tree, tvb, offset, 1, "NSAPI: %d", nsapi);
3620 nsapi_tree = proto_item_add_subtree(nsapi_ti, ett_gtpv2_pdn_numbers_nsapi);
3621 proto_tree_add_bits_item(nsapi_tree, hf_gtpv2_spare_bits, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
3622 proto_tree_add_item(nsapi_tree, hf_gtpv2_pdn_numbers_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
3623 proto_item_append_text(item, "NSAPI: %u", nsapi);
3624 offset += 1;
3626 dlgtpu_seq = tvb_get_ntohs(tvb, offset);
3627 proto_tree_add_text(tree, tvb, offset, 2, "DL GTP-U Sequence Number: %d", dlgtpu_seq);
3628 offset += 2;
3630 ulgtpu_seq = tvb_get_ntohs(tvb, offset);
3631 proto_tree_add_text(tree, tvb, offset, 2, "UL GTP-U Sequence Number: %d", ulgtpu_seq);
3632 offset += 2;
3634 send_npdu_nr = tvb_get_ntohs(tvb, offset);
3635 proto_tree_add_text(tree, tvb, offset, 2, "Send N-PDU Number: %d", send_npdu_nr);
3636 offset += 2;
3638 rec_npdu_nr = tvb_get_ntohs(tvb, offset);
3639 proto_tree_add_text(tree, tvb, offset, 2, "Receive N-PDU Number: %d", rec_npdu_nr);
3643 * 8.41 Packet TMSI (P-TMSI)
3645 static void
3646 dissect_gtpv2_p_tmsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3648 int offset = 0;
3650 /* The TMSI consists of 4 octets. It can be coded using a full hexadecimal representation. */
3651 proto_tree_add_item(tree, hf_gtpv2_p_tmsi, tvb, offset, 4, ENC_BIG_ENDIAN);
3652 proto_item_append_text(item, "%s", tvb_bytes_to_str(tvb, offset, 4));
3656 * 8.42 P-TMSI Signature
3658 static void
3659 dissect_gtpv2_p_tmsi_sig(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3661 int offset = 0;
3663 /* The P-TMSI Signature consists of 3 octets and may be allocated by the SGSN. */
3664 proto_tree_add_item(tree, hf_gtpv2_p_tmsi_sig, tvb, offset, 3, ENC_BIG_ENDIAN);
3665 proto_item_append_text(item, "%s", tvb_bytes_to_str(tvb, offset, 3));
3670 * 8.43 Hop Counter
3672 static void
3673 dissect_gtpv2_hop_counter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3675 int offset = 0;
3676 guint8 hop_counter;
3678 hop_counter = tvb_get_guint8(tvb, offset);
3680 proto_tree_add_text(tree, tvb, offset, 1, "Hop Counter: %d", hop_counter);
3681 proto_item_append_text(item, "%d", hop_counter);
3685 * 8.44 UE Time Zone
3688 static const value_string gtpv2_ue_time_zone_dst_vals[] = {
3689 {0, "No Adjustments for Daylight Saving Time"},
3690 {1, "+1 Hour Adjustments for Daylight Saving Time"},
3691 {2, "+2 Hour Adjustments for Daylight Saving Time"},
3692 {3, "Spare"},
3693 {0, NULL}
3695 static void
3696 dissect_gtpv2_ue_time_zone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3698 int offset = 0;
3701 * UE Time Zone is used to indicate the offset between universal time and local time in steps of 15 minutes of where the
3702 * UE currently resides. The "Time Zone" field uses the same format as the "Time Zone" IE in 3GPP TS 24.008 [5].
3703 * (packet-gsm_a_dtap.c)
3705 de_time_zone(tvb, tree, pinfo, offset, 1, NULL, 0);
3706 offset += 1;
3707 proto_tree_add_item(item, hf_gtpv2_ue_time_zone_dst, tvb, offset, 1, ENC_BIG_ENDIAN);
3711 * 8.45 Trace Reference
3713 static void
3714 dissect_gtpv2_trace_reference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3716 int offset = 0;
3717 guint32 trace_id;
3718 gchar *mcc_mnc_str;
3720 mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, TRUE);
3721 offset += 3;
3723 trace_id = tvb_get_ntohs(tvb, offset);
3724 proto_tree_add_text(tree, tvb, offset, 3, "Trace ID: %d", trace_id);
3726 proto_item_append_text(item, "%s,Trace ID %u", mcc_mnc_str, trace_id);
3729 * 8.46 Complete Request Message
3731 static const value_string gtpv2_complete_req_msg_type_vals[] = {
3732 {0, "Complete Attach Request Message" },
3733 {1, "Complete TAU Request Message" },
3734 {0, NULL }
3736 static void
3737 dissect_complete_request_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3739 tvbuff_t *new_tvb;
3740 int offset;
3742 offset = 0;
3744 proto_tree_add_item(tree, hf_gtpv2_complete_req_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3746 offset += 1;
3748 /* Add the Complete Request Message */
3749 new_tvb = tvb_new_subset_remaining(tvb, offset);
3750 call_dissector(nas_eps_handle, new_tvb, pinfo, tree);
3755 * 8.47 GUTI
3757 static void
3758 dissect_gtpv2_guti(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3760 int offset = 0;
3762 offset = 0;
3764 dissect_e212_mcc_mnc(tvb, pinfo, tree, 0, TRUE);
3765 offset += 3;
3767 proto_tree_add_item(tree, hf_gtpv2_mme_grp_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3768 offset += 2;
3770 proto_tree_add_item(tree, hf_gtpv2_mme_code, tvb, offset, 1, ENC_BIG_ENDIAN);
3771 offset += 1;
3773 proto_tree_add_item(tree, hf_gtpv2_m_tmsi, tvb, offset, 4, ENC_NA);
3777 * 8.48 Fully Qualified Container (F-Container)
3780 static const value_string gtpv2_container_type_vals[] = {
3781 {1, "UTRAN transparent container"},
3782 {2, "BSS container"},
3783 {3, "E-UTRAN transparent container"},
3784 {0, NULL}
3788 static void
3789 dissect_gtpv2_F_container(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type, guint8 instance _U_)
3791 tvbuff_t *new_tvb;
3792 proto_item *bss_item;
3793 proto_tree *sub_tree;
3794 int offset = 0;
3795 guint8 container_type;
3796 guint8 container_flags, xid_len;
3798 /* Octets 8 7 6 5 4 3 2 1
3799 * 5 Spare | Container Type
3801 proto_tree_add_item(tree, hf_gtpv2_container_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3802 container_type = tvb_get_guint8(tvb, offset);
3803 offset += 1;
3804 if ( (message_type == GTPV2_FORWARD_RELOCATION_REQ)
3805 || (message_type == GTPV2_CONTEXT_RESPONSE)
3806 || (message_type == GTPV2_RAN_INFORMATION_RELAY)) {
3807 switch (container_type) {
3808 case 2:
3809 /* BSS container */
3810 bss_item = proto_tree_add_text(tree, tvb, offset, length, "BSS container");
3811 sub_tree = proto_item_add_subtree(bss_item, ett_gtpv2_bss_con);
3812 /* The flags PFI, RP, SAPI and PHX in octet 6 indicate the corresponding type of paratemer */
3813 proto_tree_add_item(sub_tree, hf_gtpv2_bss_container_phx, tvb, offset, 1, ENC_BIG_ENDIAN);
3814 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_sapi_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
3815 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_rp_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
3816 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_pfi_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
3817 container_flags = tvb_get_guint8(tvb, offset);
3818 offset += 1;
3819 if ((container_flags & 0x01) == 1) {
3820 /* Packet Flow ID present */
3821 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_pfi, tvb, offset, 1, ENC_BIG_ENDIAN);
3822 offset += 1;
3824 if (((container_flags & 0x04) == 4) || ((container_flags & 0x02) == 2)) {
3825 if ((container_flags & 0x04) == 4) {
3826 /* SAPI present */
3827 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_sapi, tvb, offset, 1, ENC_BIG_ENDIAN);
3829 if ((container_flags & 0x02) == 2) {
3830 /* Radio Priority present */
3831 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_rp, tvb, offset, 1, ENC_BIG_ENDIAN);
3833 offset += 1;
3835 if ((container_flags & 0x08) == 8) {
3836 /* XiD parameters length is present in Octet c.
3837 * XiD parameters are present in Octet d to n.
3839 xid_len = tvb_get_guint8(tvb, offset);
3840 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_xid_len, tvb, offset, 1, ENC_BIG_ENDIAN);
3841 offset += 1;
3842 proto_tree_add_item(sub_tree, hf_gtpv2_bss_con_xid, tvb, offset, xid_len, ENC_BIG_ENDIAN);
3844 return;
3845 default:
3846 break;
3849 if (message_type == GTPV2_FORWARD_CTX_NOTIFICATION) {
3850 switch (container_type) {
3851 case 3:
3852 /* E-UTRAN transparent container */
3853 new_tvb = tvb_new_subset_remaining(tvb, offset);
3854 dissect_s1ap_ENB_StatusTransfer_TransparentContainer_PDU(new_tvb, pinfo, tree, NULL);
3855 return;
3856 default:
3857 break;
3861 /* 7.3.2 Forward Relocation Response
3862 * E-UTRAN Transparent Container
3863 * This IE is conditionally included only during a handover to
3864 * E-UTRAN and contains the radio-related and core network
3865 * information. If the Cause IE contains the value "Request
3866 * accepted", this IE shall be included.
3868 proto_tree_add_text(tree, tvb, offset, length-offset, "Not dissected yet");
3873 * 8.49 Fully Qualified Cause (F-Cause)
3876 static const value_string gtpv2_cause_type_vals[] = {
3877 {0, "Radio Network Layer"},
3878 {1, "Transport Layer"},
3879 {2, "NAS"},
3880 {3, "Protocol"},
3881 {4, "Miscellaneous"},
3882 {5, "<spare>"},
3883 {6, "<spare>"},
3884 {7, "<spare>"},
3885 {8, "<spare>"},
3886 {9, "<spare>"},
3887 {10, "<spare>"},
3888 {11, "<spare>"},
3889 {12, "<spare>"},
3890 {13, "<spare>"},
3891 {14, "<spare>"},
3892 {15, "<spare>"},
3893 {0, NULL}
3895 static value_string_ext gtpv2_cause_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_cause_type_vals);
3897 static void
3898 dissect_gtpv2_F_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
3900 int offset = 0;
3901 guint8 cause_type;
3903 /* The value of Instance field of the F-Cause IE in a GTPv2 message shall indicate
3904 * whether the F-Cause field contains RANAP Cause, BSSGP Cause or RAN Cause.
3905 * If the F-Cause field contains RAN Cause, the Cause Type field shall contain
3906 * the RAN cause subcategory as specified in 3GPP TS 36.413 [10] and it shall be
3907 * encoded as in Table 8.49-1.
3908 * If the F-Cause field contains BSSGP Cause or RANAP Cause,
3909 * the Cause Type field shall be ignored by the receiver.
3911 if (message_type == GTPV2_FORWARD_RELOCATION_REQ) {
3912 switch (instance) {
3913 case 0:
3914 proto_item_append_text(item, "[RAN Cause]");
3915 proto_tree_add_item(tree, hf_gtpv2_cause_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3916 cause_type = tvb_get_guint8(tvb, offset);
3917 offset += 1;
3918 switch (cause_type) {
3919 case 0:
3920 /* CauseRadioNetwork */
3921 proto_tree_add_item(tree, hf_gtpv2_CauseRadioNetwork, tvb, offset, 1, ENC_BIG_ENDIAN);
3922 break;
3923 case 1:
3924 /* CauseTransport */
3925 proto_tree_add_item(tree, hf_gtpv2_CauseTransport, tvb, offset, 1, ENC_BIG_ENDIAN);
3926 break;
3927 case 2:
3928 /* CauseNas */
3929 proto_tree_add_item(tree, hf_gtpv2_CauseNas, tvb, offset, 1, ENC_BIG_ENDIAN);
3930 break;
3931 case 3:
3932 /* CauseProtocol */
3933 proto_tree_add_item(tree, hf_gtpv2_CauseProtocol, tvb, offset, 1, ENC_BIG_ENDIAN);
3934 break;
3935 case 4:
3936 /* CauseMisc */
3937 proto_tree_add_item(tree, hf_gtpv2_CauseMisc, tvb, offset, 1, ENC_BIG_ENDIAN);
3938 break;
3939 default:
3940 break;
3942 return;
3943 break;
3944 case 1:
3945 proto_item_append_text(item, "[RANAP Cause]");
3946 break;
3947 case 2:
3948 proto_item_append_text(item, "[BSSGP Cause]");
3949 break;
3950 default:
3951 break;
3954 proto_tree_add_text(tree, tvb, offset, length-offset, "Not dissected yet");
3959 * 8.50 Selected PLMN ID
3962 * The Selected PLMN ID IE contains the core network operator selected for tne UE
3963 * in a shared network. Octets 5-7 shall be encoded as the content part of the
3964 * "Selected PLMN Identity" parameter in 3GPP TS 36.413 [10].
3965 * -The Selected PLMN identity consists of 3 digits from MCC followed by
3966 * either -a filler digit plus 2 digits from MNC (in case of 2 digit MNC) or
3967 * -3 digits from MNC (in case of a 3 digit MNC).
3969 * 8 7 6 5 4 3 2 1
3970 * +--+--+--+--+--+--+--+--+
3971 * Octet 5 |MCC digit 2|MCC digit 1|
3972 * +--+--+--+--+--+--+--+--+
3973 * Octet 6 |MNC digit 1|MCC digit 3|
3974 * +--+--+--+--+--+--+--+--+
3975 * Octet 7 |MNC digit 3|MNC digit 2|
3976 * +--+--+--+--+--+--+--+--+
3978 static void
3979 dissect_gtpv2_sel_plmn_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
3981 gchar *mcc_mnc_str;
3983 mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, FALSE);
3984 proto_item_append_text(item, "%s", mcc_mnc_str);
3988 * 8.51 Target Identification
3991 static const value_string gtpv2_target_type_vals[] = {
3992 {0, "RNC ID"},
3993 {1, "Macro eNodeB ID"},
3994 {2, "Cell Identifier"},
3995 {3, "Home eNodeB ID"},
3996 {0, NULL}
3998 static value_string_ext gtpv2_target_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_target_type_vals);
4000 static void
4001 dissect_gtpv2_target_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4003 tvbuff_t *new_tvb;
4004 int offset = 0;
4005 guint8 target_type;
4007 proto_tree_add_item(tree, hf_gtpv2_target_type, tvb, 0, 1, ENC_BIG_ENDIAN);
4008 target_type = tvb_get_guint8(tvb, offset);
4009 offset += 1;
4010 switch (target_type) {
4011 case 0:
4012 new_tvb = tvb_new_subset_remaining(tvb, offset);
4013 dissect_e212_mcc_mnc(new_tvb, pinfo, tree, 0, TRUE);
4014 offset += 3;
4015 /* LAC */
4016 proto_tree_add_item(tree, hf_gtpv2_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
4017 offset+=2;
4019 /* RAC (see NOTE 3) */
4020 proto_tree_add_item(tree, hf_gtpv2_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
4021 offset++;
4022 /* RNC ID
4023 * In this case the Target ID field shall be encoded as the Target
4024 * RNC-ID part of the "Target ID" parameter in 3GPP TS 25.413 [33]. Therefore, the "Choice Target ID" that indicates
4025 * "Target RNC-ID" (numerical value of 0x20) shall not be included (value in octet 5 specifies the target type).
4027 proto_tree_add_item(tree, hf_gtpv2_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
4028 /* If the optional Extended RNC-ID is not included, then the length variable 'n' = 8 and the overall length of the IE is 11
4029 * octets. Otherwise, 'n' = 10 and the overall length of the IE is 13 octets
4031 if(length == 11){
4032 proto_tree_add_item(tree, hf_gtpv2_ext_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
4034 return;
4035 case 1:
4036 /* Macro eNodeB ID*/
4037 new_tvb = tvb_new_subset_remaining(tvb, offset);
4038 dissect_e212_mcc_mnc(new_tvb, pinfo, tree, 0, TRUE);
4039 offset += 3;
4040 /* The Macro eNodeB ID consists of 20 bits.
4041 * Bit 4 of Octet 4 is the most significant bit and bit 1 of Octet 6 is the least significant bit.
4043 proto_tree_add_item(tree, hf_gtpv2_macro_enodeb_id, tvb, offset, 3, ENC_BIG_ENDIAN);
4044 offset += 3;
4045 /* Tracking Area Code (TAC) */
4046 proto_tree_add_item(tree, hf_gtpv2_uli_tai_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
4047 return;
4049 case 2:
4050 /* Cell Identifier */
4051 /* Target ID field shall be same as the Octets 3 to 10 of the Cell Identifier IEI
4052 * in 3GPP TS 48.018 [34].
4054 new_tvb = tvb_new_subset_remaining(tvb, offset);
4055 de_bssgp_cell_id(new_tvb, tree, pinfo, 0, 0/* not used */, NULL, 0);
4056 return;
4057 case 3:
4058 /* Home eNodeB ID */
4059 new_tvb = tvb_new_subset_remaining(tvb, offset);
4060 dissect_e212_mcc_mnc(new_tvb, pinfo, tree, 0, TRUE);
4061 offset += 3;
4062 /* Octet 10 to 12 Home eNodeB ID
4063 * The Home eNodeB ID consists of 28 bits. See 3GPP TS 36.413 [10].
4064 * Bit 4 of Octet 9 is the most significant bit and bit 1 of Octet 12 is the least significant bit.
4065 * The coding of the Home eNodeB ID is the responsibility of each administration.
4066 * Coding using full hexadecimal representation shall be used.
4068 proto_tree_add_item(tree, hf_gtpv2_home_enodeb_id, tvb, offset, 4 , ENC_BIG_ENDIAN);
4069 offset += 4;
4070 /* Octet 13 to 14 Tracking Area Code (TAC) */
4071 proto_tree_add_item(tree, hf_gtpv2_tac, tvb, offset, 2 , ENC_BIG_ENDIAN);
4072 return;
4074 default:
4075 break;
4077 proto_tree_add_text(tree, tvb, offset, length-offset, "Not dissected yet");
4082 * 8.52 Void
4085 * 8.53 Packet Flow ID
4087 static void
4088 dissect_gtpv2_pkt_flow_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4090 int offset = 0;
4092 /* Octet 5 Spare EBI */
4093 proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
4094 proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 2, ENC_BIG_ENDIAN);
4095 offset += 1;
4097 /* Packet Flow ID */
4098 proto_tree_add_text(tree, tvb, offset, length, "Packet Flow ID: %s", tvb_bytes_to_str(tvb, offset, length-1));
4102 * 8.54 RAB Context
4104 static void
4105 dissect_gtpv2_rab_context(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4107 int offset = 0;
4108 guint16 dlgtpu_seq, ulgtpu_seq, dl_pdcp_seq, ul_pdcp_seq;
4110 /* 5 Spare NSAPI */
4111 proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
4112 proto_tree_add_item(tree, hf_gtpv2_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
4113 offset++;
4115 /* 6 to 7 DL GTP-U Sequence Number */
4116 dlgtpu_seq = tvb_get_ntohs(tvb, offset);
4117 proto_tree_add_text(tree, tvb, offset, 2, "DL GTP-U Sequence Number: %d", dlgtpu_seq);
4118 offset += 2;
4120 /* 8 to 9 UL GTP-U Sequence Number */
4121 ulgtpu_seq = tvb_get_ntohs(tvb, offset);
4122 proto_tree_add_text(tree, tvb, offset, 2, "UL GTP-U Sequence Number: %d", ulgtpu_seq);
4123 offset += 2;
4125 /* 10 to 11 DL PDCP Sequence Number */
4126 dl_pdcp_seq = tvb_get_ntohs(tvb, offset);
4127 proto_tree_add_text(tree, tvb, offset, 2, "DL PDCP Sequence Number: %d", dl_pdcp_seq);
4128 offset += 2;
4130 /* 12 to 13 UL PDCP Sequence Number */
4131 ul_pdcp_seq = tvb_get_ntohs(tvb, offset);
4132 proto_tree_add_text(tree, tvb, offset, 2, "UL PDCP Sequence Number: %d", ul_pdcp_seq);
4137 * 8.55 Source RNC PDCP context info
4139 static void
4140 dissect_gtpv2_s_rnc_pdcp_ctx_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4142 proto_tree_add_text(tree, tvb, 0, length, "RRC Container");
4146 * 8.56 UDP Source Port Number
4148 static void
4149 dissect_udp_s_port_nr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4151 proto_tree_add_text(tree, tvb, 0, 2, "UPD Source Port Number: %u", tvb_get_ntohs(tvb, 0));
4152 proto_item_append_text(item, "%u", tvb_get_ntohs(tvb, 0));
4155 * 8.57 APN Restriction
4157 static void
4158 dissect_gtpv2_apn_rest(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4160 guint8 type_value;
4162 type_value = tvb_get_guint8(tvb, 0);
4163 proto_tree_add_item(tree, hf_gtpv2_apn_rest, tvb, 0, 1, ENC_BIG_ENDIAN);
4164 proto_item_append_text(item, "value %u", type_value);
4168 * 8.58 Selection Mode
4170 static const value_string gtpv2_selec_mode_vals[] = {
4171 {0, "MS or network provided APN, subscribed verified"},
4172 {1, "MS provided APN, subscription not verified"},
4173 {2, "Network provided APN, subscription not verified"},
4174 {3, "Network provided APN, subscription not verified (Basically for Future use"},
4175 {0, NULL}
4178 void
4179 dissect_gtpv2_selec_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4181 int offset = 0;
4182 guint8 ss_mode;
4184 ss_mode = tvb_get_guint8(tvb, offset) & 0x03;
4185 proto_tree_add_item(tree, hf_gtpv2_selec_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
4186 proto_item_append_text(item, "%s", val_to_str_const(ss_mode, gtpv2_selec_mode_vals, "Unknown"));
4191 * 8.59 Source Identification
4193 #if 0
4194 static const value_string gtpv2_source_ident_types[] = {
4195 {0, "Cell ID"},
4196 {1, "RNC ID"},
4197 {2, "eNodeB ID(Reserved, used in erlier v of proto.)"},
4198 {0, NULL}
4200 #endif
4201 static void
4202 dissect_gtpv2_source_ident(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4204 int offset = 0;
4205 guint8 source_type;
4207 /* Octet 5 to 12 Target Cell ID */
4208 de_cell_id(tvb, tree, pinfo, offset, 8, NULL, 0);
4209 offset += 8;
4210 /* Octet 13 Source Type */
4211 source_type = tvb_get_guint8(tvb, offset);
4212 proto_tree_add_item(tree, hf_gtpv2_source_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4213 offset += 1;
4214 /* Octet 14 to (n+4) Source ID */
4215 switch (source_type) {
4216 case 0:
4217 /* The Source Type is Cell ID for PS handover from GERAN A/Gb mode. In this case the coding of the Source ID field
4218 * shall be same as the Octets 3 to 10 of the Cell Identifier IEI in 3GPP TS 48.018 [34].
4220 de_cell_id(tvb, tree, pinfo, offset, 8, NULL, 0);
4221 break;
4222 case 1:
4223 /* The Source Type is RNC ID for PS handover from GERAN Iu mode or for inter-RAT handover from UTRAN. In this
4224 * case the Source ID field shall be encoded as as the Source RNC-ID part of the "Source ID" parameter in 3GPP TS
4225 * 25.413 [33].
4227 /* RNC-ID M INTEGER (0..4095) */
4228 break;
4229 case 2:
4230 break;
4231 default:
4232 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_source_type_unknown, tvb, offset-1, 1);
4233 break;
4239 * 8.60 Bearer Control Mode
4241 static const value_string gtpv2_bearer_control_mode_vals[] = {
4242 {0, "Selected Bearer Control Mode-'MS_only'"},
4243 {1, "Selected Bearer Control Mode-'Network_only'"},
4244 {2, "Selected Bearer Control Mode-'MS/NW'"},
4245 {0, NULL}
4248 static const value_string gtpv2_bearer_control_mode_short_vals[] = {
4249 {0, "MS_only"},
4250 {1, "Network_only"},
4251 {2, "MS/NW"},
4252 {0, NULL}
4255 static void
4256 dissect_gtpv2_bearer_control_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4258 guint8 bcm;
4260 proto_tree_add_item(tree, hf_gtpv2_bearer_control_mode, tvb, 0, 1, ENC_BIG_ENDIAN);
4261 /* Add Bearer Control Mode to tree */
4262 bcm = tvb_get_guint8(tvb, 0);
4263 proto_item_append_text(item, "%s", val_to_str_const(bcm, gtpv2_bearer_control_mode_short_vals, "Unknown"));
4267 * 8.61 Change Reporting Action
4269 static const value_string gtpv2_cng_rep_act_vals[] = {
4270 {0, "Stop Reporting"},
4271 {1, "Start Reporting CGI/SAI"},
4272 {2, "Start Reporting RAI"},
4273 {3, "Start Reporting TAI"},
4274 {4, "Start Reporting ECGI"},
4275 {5, "Start Reporting CGI/SAI and RAI"},
4276 {6, "Start Reporting TAI and ECGI"},
4277 {0, NULL}
4280 static void
4281 dissect_gtpv2_cng_rep_act(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4283 guint8 action;
4285 /* Add Action to tree */
4286 action = tvb_get_guint8(tvb, 0);
4287 proto_tree_add_item(tree, hf_gtpv2_cng_rep_act, tvb, 0, 1, ENC_BIG_ENDIAN);
4289 proto_item_append_text(item, "%s", val_to_str_const(action, gtpv2_cng_rep_act_vals, "Unknown"));
4292 * 8.62 Fully qualified PDN Connection Set Identifier (FQ-CSID)
4294 #if 0
4295 static const value_string gtpv2_fq_csid_type_vals[] = {
4296 {0, "Global unicast IPv4 address"},
4297 {1, "Global unicast IPv6 address"},
4298 {2, "4 octets long field"},
4299 {0, NULL}
4301 #endif
4303 void
4304 dissect_gtpv2_fq_csid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4306 int offset = 0;
4307 guint8 octet, node_id_type, csids;
4308 guint32 node_id, node_id_mcc_mnc;
4310 /* Octet 5 Node-ID Type Number of CSIDs= m */
4312 octet = tvb_get_guint8(tvb, offset);
4313 node_id_type = octet >> 4;
4314 csids = octet & 0x0f;
4315 proto_tree_add_item(tree, hf_gtpv2_fq_csid_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4316 proto_tree_add_item(tree, hf_gtpv2_fq_csid_nr, tvb, offset, 1, ENC_BIG_ENDIAN);
4317 offset += 1;
4319 switch (node_id_type) {
4320 case 0:
4321 /* Indicates that Node-ID is a global unicast IPv4 address and p = 9 */
4322 proto_tree_add_item(tree, hf_gtpv2_fq_csid_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
4323 offset += 4;
4324 break;
4325 case 1:
4326 /* Indicates that Node-ID is a global unicast IPv6 address and p = 21 */
4327 proto_tree_add_item(tree, hf_gtpv2_fq_csid_ipv6, tvb, offset, 16, ENC_NA);
4328 offset += 16;
4329 break;
4330 case 2:
4331 /* Node-ID is a 4 octets long field with a 32 bit value stored in network order, and p= 9. The coding
4332 * of the field is specified below:
4333 * - Most significant 20 bits are the binary encoded value of (MCC * 1000 + MNC).
4334 * - Least significant 12 bits is a 12 bit integer assigned by an operator to an MME, SGW or PGW. Other values of
4335 * Node-ID Type are reserved.
4337 node_id = tvb_get_ntohl(tvb, offset);
4338 node_id_mcc_mnc = node_id >> 12;
4339 node_id = node_id & 0xfff;
4340 proto_tree_add_text(tree, tvb, offset, 4, "Node-ID: MCC+MNC %u, Id: %u", node_id_mcc_mnc, node_id);
4341 offset += 4;
4342 break;
4343 default:
4344 proto_tree_add_expert_format(tree, pinfo, &ei_gtpv2_fq_csid_type_bad, tvb, offset-1, 1,
4345 "Wrong Node-ID Type %u, should be 0-2(Or tis is a newer spec)", node_id_type);
4346 return;
4349 /* First PDN Connection Set Identifier (CSID)
4350 * Second PDN Connection Set Identifier (CSID)
4352 * m-th PDN Connection Set Identifier (CSID)
4354 while ( csids-- ) {
4355 proto_tree_add_item(tree, hf_gtpv2_fq_csid_id, tvb, offset, 2, ENC_BIG_ENDIAN);
4356 offset += 2;
4362 * 8.63 Channel needed
4364 static void
4365 dissect_gtpv2_channel_needed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4367 /* The Channel needed shall be coded as depicted in Figure 8.63-1. Channel needed is coded as the IEI part and the value
4368 * part of the Channel Needed IE defined in 3GPP TS 44.018[28]
4370 de_rr_chnl_needed(tvb, tree, pinfo, 0, length, NULL, 0);
4374 * 8.64 eMLPP Priority
4375 * The eMLPP-Priority shall be coded as depicted in Figure 8.64-1. The eMLPP Priority is coded as the value part of the
4376 * eMLPP-Priority IE defined in 3GPP TS 48.008 [29] (not including 3GPP TS 48.008 IEI and 3GPP TS 48.008 [29]
4377 * length indicator).
4379 static void
4380 dissect_gtpv2_emlpp_pri(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4382 be_emlpp_prio(tvb, tree, pinfo, 0, length, NULL, 0);
4387 * 8.65 Node Type
4389 static const value_string gtpv2_node_type_vals[] = {
4390 {0, "MME"},
4391 {1, "SGSN"},
4392 {0, NULL}
4395 static void
4396 dissect_gtpv2_node_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4398 guint8 node_type;
4400 proto_tree_add_item(tree, hf_gtpv2_node_type, tvb, 0, 1, ENC_BIG_ENDIAN);
4401 /* Append Node Type to tree */
4402 node_type = tvb_get_guint8(tvb, 0);
4403 proto_item_append_text(item, "%s", val_to_str_const(node_type, gtpv2_node_type_vals, "Unknown"));
4408 * 8.66 Fully Qualified Domain Name (FQDN)
4410 static void
4411 dissect_gtpv2_fqdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4413 int offset = 0, name_len, tmp;
4414 guint8 *fqdn = NULL;
4416 /* The FQDN field encoding shall be identical to the encoding of
4417 * a FQDN within a DNS message of section 3.1 of IETF
4418 * RFC 1035 [31] but excluding the trailing zero byte.
4420 if (length > 0) {
4421 name_len = tvb_get_guint8(tvb, offset);
4423 if (name_len < 0x20) {
4424 fqdn = tvb_get_string(wmem_packet_scope(), tvb, offset + 1, length - 1);
4425 for (;;) {
4426 if (name_len >= length - 1)
4427 break;
4428 tmp = name_len;
4429 name_len = name_len + fqdn[tmp] + 1;
4430 fqdn[tmp] = '.';
4432 } else {
4433 fqdn = tvb_get_string(wmem_packet_scope(), tvb, offset, length);
4435 proto_tree_add_string(tree, hf_gtpv2_fqdn, tvb, offset, length, fqdn);
4436 proto_item_append_text(item, "%s", fqdn);
4441 * 8.67 Private Extension
4443 static void
4444 dissect_gtpv2_private_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance)
4446 int offset = 0;
4447 tvbuff_t *next_tvb;
4448 guint16 ext_id;
4450 /* oct 5 -7 Enterprise ID */
4451 ext_id = tvb_get_ntohs(tvb, offset);
4452 proto_tree_add_item(tree, hf_gtpv2_enterprise_id, tvb, offset, 2, ENC_BIG_ENDIAN);
4453 offset += 2;
4455 proto_item_append_text(item, "%s (%u)", val_to_str_ext_const(ext_id, &sminmpec_values_ext, "Unknown"), ext_id);
4457 next_tvb = tvb_new_subset(tvb, offset, length-2, length-2);
4458 if (dissector_try_uint_new(gtpv2_priv_ext_dissector_table, ext_id, next_tvb, pinfo, tree, FALSE, GUINT_TO_POINTER((guint32)instance))){
4459 return;
4462 proto_tree_add_text(tree, tvb, offset, length-2, "Proprietary value");
4466 * 8.68 Transaction Identifier (TI)
4468 static void
4469 dissect_gtpv2_ti(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4471 /* 5 to (n+4) Transaction Identifier */
4472 proto_tree_add_item(tree, hf_gtpv2_ti, tvb, 0, length, ENC_NA);
4477 * 8.69 MBMS Session Duration
4479 void
4480 dissect_gtpv2_mbms_session_duration(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4482 int offset = 0;
4483 int bit_offset = 0;
4484 guint32 days;
4485 guint32 hours;
4486 guint32 minutes;
4487 guint32 seconds;
4489 /* From 3GPP TS 29.061 17.7.7 MBMS-Session-Duration AVP */
4490 /* Bits: ssss ssss ssss ssss sddd dddd where s bits = seconds, d bits = days */
4491 seconds = tvb_get_bits32(tvb, bit_offset, 17, ENC_BIG_ENDIAN);
4492 bit_offset += 17;
4494 days = tvb_get_bits32(tvb, bit_offset, 7, ENC_BIG_ENDIAN);
4496 /* Maximum allowed value for days: 18.
4497 * Maximum allowed value for seconds: 86,400 */
4498 if ((days > 18) || (seconds > 86400)) {
4499 proto_tree_add_text(tree, tvb, offset, offset + 3, "Days or Seconds out or allowed range");
4502 /* The lowest value of this AVP (i.e. all 0:s) is reserved to indicate an indefinite value to denote sessions that are expected to be always-on. */
4503 if ((seconds == 0) && (days == 0)) {
4504 proto_tree_add_item(tree, hf_gtpv2_mbms_session_duration_days, tvb, offset, 3, ENC_BIG_ENDIAN);
4505 proto_tree_add_item(tree, hf_gtpv2_mbms_session_duration_secs, tvb, offset, 3, ENC_BIG_ENDIAN);
4506 proto_item_append_text(item, "Indefinite (always-on)");
4507 } else {
4508 hours = seconds / 3600;
4509 minutes = (seconds % 3600) / 60;
4510 seconds = (seconds % 3600) % 60;
4512 proto_tree_add_item(tree, hf_gtpv2_mbms_session_duration_days, tvb, offset, 3, ENC_BIG_ENDIAN);
4513 proto_tree_add_item(tree, hf_gtpv2_mbms_session_duration_secs, tvb, offset, 3, ENC_BIG_ENDIAN);
4514 proto_item_append_text(item, "%d days %02d:%02d:%02d (DD days HH:MM:SS)", days, hours, minutes, seconds);
4517 offset += 3;
4518 if (length > 3)
4519 proto_tree_add_text(tree, tvb, offset, length-3, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-3));
4523 * 8.70 MBMS Service Area
4525 void
4526 dissect_gtpv2_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4528 int offset = 0;
4529 proto_item *sai_item;
4530 guint8 binary_nr;
4531 guint16 real_nr;
4532 guint16 sai;
4534 binary_nr = tvb_get_guint8(tvb, offset);
4535 real_nr = (guint16)binary_nr + 1;
4537 /* 3GPP TS 29.061 17.7.6 MBMS-Service-Area AVP */
4538 proto_tree_add_uint(tree, hf_gtpv2_mbms_service_area_nr, tvb, offset, 1, real_nr);
4539 offset += 1;
4541 /* A consecutive list of MBMS Service Area Identities follow, each with a length of two octets. */
4542 while (offset < length) {
4543 /* 3GPP TS 23.003 15.3 Structure of MBMS SAI */
4544 sai = tvb_get_ntohs(tvb, offset);
4545 sai_item = proto_tree_add_item(tree, hf_gtpv2_mbms_service_area_id, tvb, offset, 2, ENC_BIG_ENDIAN);
4546 /* The value 0 denotes the whole of PLMN as the MBMS Service Area */
4547 if (sai == 0) {
4548 proto_item_append_text(sai_item, " Entire PLMN");
4550 proto_item_append_text(item, " %u", sai);
4551 offset += 2;
4556 * 8.71 MBMS Session Identifier
4558 static void
4559 dissect_gtpv2_mbms_session_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, _U_ guint8 message_type _U_, guint8 instance _U_)
4561 int offset = 0;
4562 /* One octet OctetString. */
4563 proto_tree_add_item(tree, hf_gtpv2_mbms_session_id, tvb, offset, 1, ENC_NA);
4565 offset += 1;
4566 if (length > 1)
4567 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
4571 * 8.72 MBMS Flow Identifier
4573 static void
4574 dissect_gtpv2_mbms_flow_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4576 int offset = 0;
4577 /* Two octets OctetString. */
4578 proto_tree_add_item(tree, hf_gtpv2_mbms_flow_id, tvb, offset, 2, ENC_NA);
4579 proto_item_append_text(item, " %s", tvb_bytes_to_str(tvb, offset, 2));
4581 offset += 2;
4582 if (length > 2)
4583 proto_tree_add_text(tree, tvb, offset, length-2, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-2));
4587 * 8.73 MBMS IP Multicast Distribution
4589 static const value_string gtpv2_mbms_hc_indicator_vals[] = {
4590 {0, "Uncompressed header"},
4591 {1, "Compressed header"},
4592 {0, NULL}
4595 static void
4596 dissect_gtpv2_mbms_ip_mc_dist(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4598 int offset = 0;
4600 proto_tree_add_item(tree, hf_gtpv2_cteid, tvb, offset, 4, ENC_BIG_ENDIAN);
4601 offset += 4;
4603 proto_tree_add_item(tree, hf_gtpv2_ip_addr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4604 proto_tree_add_item(tree, hf_gtpv2_ip_addr_len, tvb, offset, 1, ENC_BIG_ENDIAN);
4605 /* IP Multicast Distribution Address */
4606 if ((tvb_get_guint8(tvb, offset) & 0x3f) == 4) {
4607 offset += 1;
4608 proto_tree_add_item(tree, hf_gtpv2_mbms_ip_mc_dist_addrv4, tvb, offset, 4, ENC_BIG_ENDIAN);
4609 proto_item_append_text(item, " IPv4 Dist %s", tvb_ip_to_str(tvb, offset));
4610 offset += 4;
4611 } else if ((tvb_get_guint8(tvb, offset) & 0x3f) == 16) {
4612 offset += 1;
4613 proto_tree_add_item(tree, hf_gtpv2_mbms_ip_mc_dist_addrv6, tvb, offset, 16, ENC_NA);
4614 proto_item_append_text(item, " IPv6 Dist %s", tvb_ip6_to_str(tvb, offset));
4615 offset += 16;
4618 proto_tree_add_item(tree, hf_gtpv2_ip_addr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4619 proto_tree_add_item(tree, hf_gtpv2_ip_addr_len, tvb, offset, 1, ENC_BIG_ENDIAN);
4620 /* IP Multicast Source Address */
4621 if ((tvb_get_guint8(tvb, offset) & 0x3f) == 4) {
4622 offset += 1;
4623 proto_tree_add_item(tree, hf_gtpv2_mbms_ip_mc_src_addrv4, tvb, offset, 4, ENC_BIG_ENDIAN);
4624 proto_item_append_text(item, " IPv4 Src %s", tvb_ip_to_str(tvb, offset));
4625 offset += 4;
4626 } else if ((tvb_get_guint8(tvb, offset) & 0x3f) == 16) {
4627 offset += 1;
4628 proto_tree_add_item(tree, hf_gtpv2_mbms_ip_mc_src_addrv6, tvb, offset, 16, ENC_NA);
4629 proto_item_append_text(item, " IPv6 Src %s", tvb_ip6_to_str(tvb, offset));
4630 offset += 16;
4633 proto_tree_add_item(tree, hf_gtpv2_mbms_hc_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
4635 offset += 1;
4636 if (length > offset)
4637 proto_tree_add_text(tree, tvb, offset, length-offset, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-offset));
4642 * 8.74 MBMS Distribution Acknowledge
4644 static const value_string gtpv2_mbms_dist_indication_vals[] = {
4645 {0, "No RNCs have accepted IP multicast distribution"},
4646 {1, "All RNCs have accepted IP multicast distribution"},
4647 {2, "Some RNCs have accepted IP multicast distribution"},
4648 {3, "Spare. For future use."},
4649 {0, NULL}
4652 static void
4653 dissect_gtpv2_mbms_dist_ack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4655 int offset = 0;
4657 proto_tree_add_item(tree, hf_gtpv2_mbms_dist_indication, tvb, offset, 1, ENC_BIG_ENDIAN);
4659 offset += 1;
4660 if (length > 1)
4661 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
4665 * 8.75 User CSG Information (UCI)
4667 static void
4668 dissect_gtpv2_uci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4670 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4673 /* 8.76 CSG Information Reporting Action */
4674 static void
4675 dissect_gtpv2_csg_info_rep_action(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4677 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4680 /* 8.77 RFSP Index */
4681 static void
4682 dissect_gtpv2_rfsp_index(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4684 int offset = 0;
4686 if(instance == 0){
4687 proto_tree_add_item(tree, hf_gtpv2_subscriber_rfsp, tvb, offset, 2, ENC_BIG_ENDIAN);
4688 }else if(instance == 1){
4689 proto_tree_add_item(tree, hf_gtpv2_rfsp_inuse, tvb, offset, 2, ENC_BIG_ENDIAN);
4693 /* 8.78 CSG ID */
4694 static void
4695 dissect_gtpv2_csg_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4697 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4700 /* 8.79 CSG Membership Indication (CMI) */
4701 static void
4702 dissect_gtpv2_cmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4704 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4707 /* 8.80 Service indicator */
4708 static void
4709 dissect_gtpv2_service_indicator(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4711 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4714 /* 8.81 Detach Type */
4715 static void
4716 dissect_gtpv2_detach_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4718 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4721 /* 8.82 Local Distinguished Name (LDN) */
4722 static void
4723 dissect_gtpv2_ldn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4725 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4728 /* 8.83 Node Features */
4729 static void
4730 dissect_gtpv2_node_features(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4732 int offset = 0;
4733 proto_tree_add_item(tree, hf_gtpv2_node_features_prn, tvb, offset, 1, ENC_BIG_ENDIAN);
4734 proto_tree_add_item(tree, hf_gtpv2_node_features_mabr, tvb, offset, 1, ENC_BIG_ENDIAN);
4735 proto_tree_add_item(tree, hf_gtpv2_node_features_ntsr, tvb, offset, 1, ENC_BIG_ENDIAN);
4736 offset+=1;
4737 if (length > 1)
4738 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
4741 /* 8.84
4742 * MBMS Time to Data Transfer
4744 void
4745 dissect_gtpv2_mbms_time_to_data_xfer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4747 int offset = 0;
4748 guint8 binary_secs;
4749 guint16 real_secs;
4751 binary_secs = tvb_get_guint8(tvb, offset);
4752 real_secs = (guint16)binary_secs + 1;
4754 proto_tree_add_string_format_value(tree, hf_gtpv2_time_to_data_xfer, tvb, offset, 1, "", "%d second(s)", real_secs);
4755 proto_item_append_text(item, " %u second(s)", real_secs);
4756 offset += 1;
4757 if (length > 1)
4758 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
4761 /* 8.85 Throttling */
4762 static void
4763 dissect_gtpv2_throttling(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4765 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4768 /* 8.86 Allocation/Retention Priority (ARP) */
4769 void
4770 dissect_gtpv2_arp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4772 int offset = 0;
4774 proto_tree_add_item(tree, hf_gtpv2_arp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
4775 proto_tree_add_item(tree, hf_gtpv2_arp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
4776 proto_tree_add_item(tree, hf_gtpv2_arp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
4778 offset += 1;
4779 if (length > 1)
4780 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
4783 /* 8.87 EPC Timer */
4784 static const value_string gtpv2_timer_unit_vals[] = {
4785 {0, "value is incremented in multiples of 2 seconds"},
4786 {1, "value is incremented in multiples of 1 minute"},
4787 {2, "value is incremented in multiples of 10 minutes"},
4788 {3, "value is incremented in multiples of 1 hour"},
4789 {4, "value is incremented in multiples of 1 hour"},
4790 {5, "Other values shall be interpreted as multiples of 1 minute(version 10.7.0)"},
4791 {6, "Other values shall be interpreted as multiples of 1 minute(version 10.7.0)"},
4792 {7, "value indicates that the timer is infinite"},
4793 {0, NULL}
4796 void
4797 dissect_gtpv2_epc_timer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4799 proto_tree_add_item(tree, hf_gtpv2_timer_unit, tvb, 0, 1, ENC_BIG_ENDIAN);
4800 proto_tree_add_item(tree, hf_gtpv2_timer_value, tvb, 0, 1, ENC_BIG_ENDIAN);
4804 /* 8.88 Signalling Priority Indication */
4805 static void
4806 dissect_gtpv2_sig_prio_ind(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4808 proto_tree_add_item(tree, hf_gtpv2_lapi, tvb, 0, 1, ENC_BIG_ENDIAN);
4811 /* 8.89 Temporary Mobile Group Identity (TMGI) */
4812 static void
4813 dissect_gtpv2_tmgi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4815 int offset = 0;
4816 guint64 tmgi;
4818 tmgi = tvb_get_ntoh48(tvb, offset);
4820 proto_item_append_text(item, "%012" G_GINT64_MODIFIER "x", tmgi);
4822 proto_tree_add_item(tree, hf_gtpv2_mbms_service_id, tvb, offset, 3, ENC_BIG_ENDIAN);
4823 offset += 3;
4825 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
4826 offset += 3;
4828 if (length > offset)
4829 proto_tree_add_text(tree, tvb, offset, length-offset, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-offset));
4833 * 8.90 Additional MM context for SRVCC
4834 * 3GPP TS 29.274 Figure 8.90-1
4836 static void
4837 dissect_gtpv2_add_mm_cont_for_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4839 int offset = 0;
4840 proto_item *ms_cm_item;
4841 proto_tree *ms_cm_tree;
4842 guint8 elm_len;
4844 /* Length of Mobile Station Classmark 2 */
4845 elm_len = tvb_get_guint8(tvb, offset);
4846 proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark2, tvb, offset, 1, ENC_BIG_ENDIAN);
4847 offset += 1;
4848 ms_cm_item = proto_tree_add_text(tree, tvb, offset, elm_len, "Mobile Station Classmark 2 %s", tvb_bytes_to_str(tvb, offset, elm_len));
4849 ms_cm_tree = proto_item_add_subtree(ms_cm_item, ett_gtpv2_ms_mark);
4850 /* Mobile Station Classmark 2 */
4851 de_ms_cm_2(tvb, ms_cm_tree, pinfo, offset, elm_len, NULL, 0);
4852 offset += elm_len;
4854 /* Length of Mobile Station Classmark 3 */
4855 elm_len = tvb_get_guint8(tvb, offset);
4856 proto_tree_add_item(tree, hf_gtpv2_len_ms_classmark3, tvb, offset, 1, ENC_BIG_ENDIAN);
4857 offset += 1;
4858 ms_cm_item = proto_tree_add_text(tree, tvb, offset, elm_len, "Mobile Station Classmark3 %s", tvb_bytes_to_str(tvb, offset, elm_len));
4859 ms_cm_tree = proto_item_add_subtree(ms_cm_item, ett_gtpv2_ms_mark);
4860 /* Mobile Station Classmark 3 */
4861 de_ms_cm_3(tvb, ms_cm_tree, pinfo, offset, elm_len, NULL, 0);
4862 offset += elm_len;
4864 /* Length of Supported Codec List */
4865 elm_len = tvb_get_guint8(tvb, offset);
4866 proto_tree_add_item(tree, hf_gtpv2_len_supp_codec_list, tvb, offset, 1, ENC_BIG_ENDIAN);
4867 offset += 1;
4868 ms_cm_item = proto_tree_add_text(tree, tvb, offset, elm_len, "Supported Codec List %s", tvb_bytes_to_str(tvb, offset, elm_len));
4869 ms_cm_tree = proto_item_add_subtree(ms_cm_item, ett_gtpv2_supp_codec_list);
4870 /* Supported Codec List */
4871 de_sup_codec_list(tvb, ms_cm_tree, pinfo, offset, elm_len, NULL, 0);
4872 offset += elm_len;
4874 if (length > offset)
4875 proto_tree_add_text(tree, tvb, offset, length-offset, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-offset));
4878 /* 8.91 Additional flags for SRVCC */
4879 static void
4880 dissect_gtpv2_add_flags_for_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4882 int offset = 0;
4884 proto_tree_add_item(tree, hf_gtpv2_add_flags_for_srvcc_ics, tvb, offset, 1, ENC_BIG_ENDIAN);
4885 proto_tree_add_item(tree, hf_gtpv2_vsrvcc_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
4886 offset += 1;
4888 if (length > 1)
4889 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
4892 /* 8.92 Max MBR/APN-AMBR (MMBR) */
4893 static void
4894 dissect_gtpv2_mmbr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4896 int offset = 0;
4897 guint32 max_ul;
4898 guint32 max_dl;
4900 max_ul = tvb_get_ntohl(tvb, offset);
4901 proto_tree_add_uint_format_value(tree, hf_gtpv2_mmbr_ul, tvb, offset, 4, max_ul, "%u %s",
4902 (max_ul) > 1000 ? max_ul/1000 : max_ul,
4903 (max_ul) > 1000 ? "Mbps" : "kbps");
4905 offset += 4;
4907 max_dl = tvb_get_ntohl(tvb, offset);
4908 proto_tree_add_uint_format_value(tree, hf_gtpv2_mmbr_dl, tvb, offset, 4, max_dl, "%u %s",
4909 (max_dl) > 1000 ? max_dl/1000 : max_dl,
4910 (max_dl) > 1000 ? "Mbps" : "kbps");
4913 /* 8.93 MDT Configuration */
4914 static void
4915 dissect_gtpv2_mdt_config(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
4917 proto_tree_add_expert(tree, pinfo, &ei_gtpv2_ie_data_not_dissected, tvb, 0, length);
4920 /* 8.94 Additional Protocol Configuration Options (APCO) */
4921 static void
4922 dissect_gtpv2_apco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4924 switch (message_type) {
4925 case GTPV2_CREATE_SESSION_REQUEST:
4926 /* PCO options as MS to network direction */
4927 pinfo->link_dir = P2P_DIR_UL;
4928 break;
4929 case GTPV2_CREATE_SESSION_RESPONSE:
4930 /* PCO options as Network to MS direction: */
4931 pinfo->link_dir = P2P_DIR_DL;
4932 break;
4933 default:
4934 break;
4936 de_sm_pco(tvb, tree, pinfo, 0, length, NULL, 0);
4939 /* 8.95 Absolute Time of MBMS Data Transfer */
4940 static void
4941 dissect_gtpv2_abs_mbms_data_tf_time(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4943 int offset = 0;
4944 const gchar *time_str;
4946 time_str = tvb_ntp_fmt_ts(tvb, offset);
4947 proto_tree_add_string(tree, hf_gtpv2_abs_time_mbms_data, tvb, offset, 8, time_str);
4948 proto_item_append_text(item, "%s", time_str);
4950 offset += 8;
4951 if (length > offset)
4952 proto_tree_add_text(tree, tvb, offset, length-offset, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-offset));
4955 /* 8.96 H(e)NB Information Reporting */
4956 static const true_false_string gtpv2_henb_info_report_fti_vals = {
4957 "Start reporting H(e)NB local IP address and UDP port number information change",
4958 "Stop reporting H(e)NB local IP address and UDP port number information change",
4961 static void
4962 dissect_gtpv2_henb_info_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4964 int offset = 0;
4966 proto_tree_add_item(tree, hf_gtpv2_henb_info_report_fti, tvb, offset, 1, ENC_BIG_ENDIAN);
4967 offset += 1;
4969 if (length > 1)
4970 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
4973 /* 8.97 IPv4 Configuration Parameters (IP4CP) */
4974 static void
4975 dissect_gtpv2_ip4cp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4977 int offset = 0;
4979 proto_tree_add_item(tree, hf_gtpv2_ip4cp_subnet_prefix_len, tvb, offset, 1, ENC_BIG_ENDIAN);
4980 offset += 1;
4981 proto_tree_add_item(tree, hf_gtpv2_ip4cp_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
4982 offset += 4;
4984 if (length > offset)
4985 proto_tree_add_text(tree, tvb, offset, length-offset, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-offset));
4988 /* 8.98 Change to Report Flags */
4989 static void
4990 dissect_gtpv2_change_report_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
4992 int offset = 0;
4994 proto_tree_add_item(tree, hf_gtpv2_change_report_flags_sncr, tvb, offset, 1, ENC_BIG_ENDIAN);
4995 proto_tree_add_item(tree, hf_gtpv2_change_report_flags_tzcr, tvb, offset, 1, ENC_BIG_ENDIAN);
4996 offset += 1;
4998 if (length > 1)
4999 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
5002 /* 8.99 Action Indication */
5003 static const value_string gtpv2_action_indication_vals[] = {
5004 { 0, "No Action"},
5005 { 1, "Deactivation Indication"},
5006 { 2, "Paging Indication"},
5007 { 3, "Spare"},
5008 { 4, "Spare"},
5009 { 5, "Spare"},
5010 { 6, "Spare"},
5011 { 7, "Spare"},
5012 { 0, NULL}
5014 static value_string_ext gtpv2_action_indication_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_action_indication_vals);
5016 static void
5017 dissect_gtpv2_action_indication(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
5019 int offset = 0;
5021 proto_tree_add_item(tree, hf_gtpv2_action_indication_val, tvb, offset, 1, ENC_BIG_ENDIAN);
5022 offset += 1;
5024 if (length > 1)
5025 proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1));
5028 typedef struct _gtpv2_ie {
5029 int ie_type;
5030 void (*decode) (tvbuff_t *, packet_info *, proto_tree *, proto_item *, guint16, guint8, guint8);
5031 } gtpv2_ie_t;
5033 static const gtpv2_ie_t gtpv2_ies[] = {
5034 {GTPV2_IE_IMSI, dissect_gtpv2_imsi}, /* 1, Internal Mobile Subscriber Identity (IMSI) */
5035 {GTPV2_IE_CAUSE, dissect_gtpv2_cause}, /* 2, Cause (without embedded offending IE) 8.4 */
5036 {GTPV2_REC_REST_CNT, dissect_gtpv2_recovery}, /* 3, Recovery (Restart Counter) 8.5 */
5037 /* 4-50 Reserved for S101 interface Extendable / See 3GPP TS 29.276 [14] */
5038 /*Start SRVCC Messages 3GPP TS 29.280 */
5039 {GTPV2_IE_STN_SR, dissect_gtpv2_stn_sr}, /* 51 STN-SR */
5040 {GTPV2_IE_SRC_TGT_TRANS_CON, dissect_gtpv2_src_tgt_trans_con}, /* 52 Source to Target Transparent Container */
5041 {GTPV2_IE_TGT_SRC_TRANS_CON , dissect_gtpv2_tgt_src_trans_con}, /* 53 Target to Source Transparent Container */
5042 {GTPV2_IE_MM_CON_EUTRAN_SRVCC, dissect_gtpv2_mm_con_eutran_srvcc}, /* 54 MM Context for E-UTRAN SRVCC */
5043 {GTPV2_IE_MM_CON_UTRAN_SRVCC, dissect_gtpv2_mm_con_utran_srvcc}, /* 55 MM Context for UTRAN SRVCC */
5044 {GTPV2_IE_SRVCC_CAUSE, dissect_gtpv2_srvcc_cause}, /* 56 SRVCC Cause */
5045 {GTPV2_IE_TGT_RNC_ID, dissect_gtpv2_tgt_rnc_id}, /* 57 Target RNC ID */
5046 {GTPV2_IE_TGT_GLOGAL_CELL_ID, dissect_gtpv2_tgt_global_cell_id}, /* 58 Target Global Cell ID */
5047 {GTPV2_IE_TEID_C, dissect_gtpv2_teid_c}, /* 59 TEID-C */
5048 {GTPV2_IE_SV_FLAGS, dissect_gtpv2_sv_flags}, /* 60 Sv Flags */
5049 {GTPV2_IE_SAI, dissect_gtpv2_sai}, /* 61 Service Area Identifie */
5050 /* 61-70 Reserved for Sv interface Extendable / See 3GPP TS 29.280 [15] */
5052 {GTPV2_APN, dissect_gtpv2_apn}, /* 71, Access Point Name (APN) 8.6 */
5053 {GTPV2_AMBR, dissect_gtpv2_ambr}, /* 72, Aggregate Maximum Bit Rate (AMBR) */
5054 {GTPV2_EBI, dissect_gtpv2_ebi}, /* 73, EPS Bearer ID (EBI) 8.8 */
5055 {GTPV2_IP_ADDRESS, dissect_gtpv2_ip_address}, /* 74, IP Address */
5056 {GTPV2_MEI, dissect_gtpv2_mei}, /* 74, Mobile Equipment Identity */
5057 {GTPV2_IE_MSISDN, dissect_gtpv2_msisdn}, /* 76, MSISDN 8.11 */
5058 {GTPV2_INDICATION, dissect_gtpv2_ind}, /* 77 Indication 8.12 */
5059 {GTPV2_PCO, dissect_gtpv2_pco}, /* 78 Protocol Configuration Options (PCO) 8.13 */
5060 {GTPV2_PAA, dissect_gtpv2_paa}, /* 79 PDN Address Allocation (PAA) 8.14 */
5061 {GTPV2_BEARER_QOS, dissect_gtpv2_bearer_qos}, /* 80 Bearer Level Quality of Service (Bearer QoS) 8.15 */
5062 {GTPV2_IE_FLOW_QOS, dissect_gtpv2_flow_qos}, /* 81 Flow Quality of Service (Flow QoS) 8.16 */
5063 {GTPV2_IE_RAT_TYPE, dissect_gtpv2_rat_type}, /* 82, RAT Type 8.17 */
5064 {GTPV2_IE_SERV_NET, dissect_gtpv2_serv_net}, /* 83, Serving Network 8.18 */
5065 {GTPV2_IE_BEARER_TFT, dissect_gtpv2_bearer_tft}, /* 84, Bearer TFT 8.19 */
5066 {GTPV2_IE_TAD, dissect_gtpv2_tad}, /* 85, Traffic Aggregate Description 8.20 */
5067 {GTPV2_IE_ULI, dissect_gtpv2_uli}, /* 86, User Location Info (ULI) 8.22 */
5068 {GTPV2_IE_F_TEID, dissect_gtpv2_f_teid}, /* 87, Fully Qualified Tunnel Endpoint Identifier (F-TEID) 8.23 */
5069 {GTPV2_IE_TMSI, dissect_gtpv2_tmsi}, /* 88, TMSI 8.23 */
5070 {GTPV2_IE_GLOBAL_CNID, dissect_gtpv2_g_cn_id}, /* 89, Global CN-Id 8.25 */
5071 {GTPV2_IE_S103PDF, dissect_gtpv2_s103pdf}, /* 90, S103 PDN Data Forwarding Info (S103PDF) 8.25 */
5072 {GTPV2_IE_S1UDF, dissect_gtpv2_s1udf}, /* 91, S1-U Data Forwarding (S1UDF) 8.26 */
5073 {GTPV2_IE_DEL_VAL, dissect_gtpv2_delay_value}, /* 92, Delay Value 8.29 */
5074 {GTPV2_IE_BEARER_CTX, dissect_gtpv2_bearer_ctx}, /* 93, Bearer Context 8.31 */
5075 {GTPV2_IE_CHAR_ID, dissect_gtpv2_charging_id}, /* 94, Charging Id */
5076 {GTPV2_IE_CHAR_CHAR, dissect_gtpv2_char_char}, /* 95 Charging Characteristic */
5077 {GTPV2_IE_TRA_INFO, dissect_gtpv2_tra_info}, /* 96, Trace Information 8.31 */
5078 {GTPV2_BEARER_FLAG, dissect_gtpv2_bearer_flag}, /* 97, Bearer Flag */
5079 /* 98, Void 8.33 */
5080 {GTPV2_IE_PDN_TYPE, dissect_gtpv2_pdn_type}, /* 99, PDN Type */
5081 {GTPV2_IE_PTI, dissect_gtpv2_pti}, /* 100, Procedure Transaction Id */
5082 {GTPV2_IE_DRX_PARAM, dissect_gtpv2_drx_param}, /* 101, DRX Parameter 8.36 */
5083 {GTPV2_IE_UE_NET_CAPABILITY, dissect_gtpv2_ue_net_capability}, /* 102, UE network capability 8.37 */
5084 {GTPV2_IE_MM_CONTEXT_GSM_T, dissect_gtpv2_mm_context_gsm_t}, /* 103, MM Context 8.38 GSM Key and Triplets */
5085 {GTPV2_IE_MM_CONTEXT_UTMS_CQ, dissect_gtpv2_mm_context_utms_cq}, /* 104, MM Context 8.38 */
5086 {GTPV2_IE_MM_CONTEXT_GSM_CQ, dissect_gtpv2_mm_context_gsm_cq}, /* 105, MM Context 8.38 */
5087 {GTPV2_IE_MM_CONTEXT_UTMS_Q, dissect_gtpv2_mm_context_utms_q}, /* 106, MM Context 8.38 */
5088 {GTPV2_IE_MM_CONTEXT_EPS_QQ, dissect_gtpv2_mm_context_eps_qq}, /* 107, MM Context 8.38 */
5089 {GTPV2_IE_MM_CONTEXT_UTMS_QQ, dissect_gtpv2_mm_context_utms_qq}, /* 108, MM Context 8.38 */
5090 {GTPV2_IE_PDN_CONNECTION, dissect_gtpv2_PDN_conn}, /* 109, PDN Connection */
5091 {GTPV2_IE_PDN_NUMBERS, dissect_gtpv2_pdn_numbers}, /* 110, PDN Numbers 8.40 */
5092 {GTPV2_IE_P_TMSI, dissect_gtpv2_p_tmsi}, /* 111, P-TMSI 8.41 */
5093 {GTPV2_IE_P_TMSI_SIG, dissect_gtpv2_p_tmsi_sig}, /* 112, P-TMSI Signature 8.42 */
5094 {GTPV2_IE_HOP_COUNTER, dissect_gtpv2_hop_counter}, /* 113, Hop Counter 8.43 */
5095 {GTPV2_IE_UE_TIME_ZONE, dissect_gtpv2_ue_time_zone}, /* 114, UE Time Zone */
5096 {GTPV2_IE_TRACE_REFERENCE, dissect_gtpv2_trace_reference}, /* 115, Trace Reference 8.45 */
5097 {GTPV2_IE_COMPLETE_REQUEST_MSG, dissect_complete_request_msg}, /* 116, Complete Request message 8.46 */
5098 {GTPV2_IE_GUTI, dissect_gtpv2_guti}, /* 117, GUTI 8.47 */
5099 {GTPV2_IE_F_CONTAINER, dissect_gtpv2_F_container}, /* 118, Fully Qualified Container (F-Container) */
5100 {GTPV2_IE_F_CAUSE, dissect_gtpv2_F_cause}, /* 119, Fully Qualified Cause (F-Cause) */
5101 {GTPV2_IE_SEL_PLMN_ID, dissect_gtpv2_sel_plmn_id}, /* 120, Selected PLMN ID 8.50 */
5102 {GTPV2_IE_TARGET_ID, dissect_gtpv2_target_id}, /* 121, Target Identification */
5103 /* 122, Void 8.52 */
5104 {GTPV2_IE_PKT_FLOW_ID, dissect_gtpv2_pkt_flow_id}, /* 123, Packet Flow ID 8.53 */
5105 {GTPV2_IE_RAB_CONTEXT, dissect_gtpv2_rab_context}, /* 124, RAB Context 8.54 */
5106 {GTPV2_IE_S_RNC_PDCP_CTX_INFO, dissect_gtpv2_s_rnc_pdcp_ctx_info}, /* 125, Source RNC PDCP context info 8.55 */
5107 {GTPV2_IE_UDP_S_PORT_NR, dissect_udp_s_port_nr}, /* 126, UDP Source Port Number 8.56 */
5108 {GTPV2_IE_APN_RESTRICTION, dissect_gtpv2_apn_rest}, /* 127, APN Restriction */
5109 {GTPV2_IE_SEL_MODE, dissect_gtpv2_selec_mode}, /* 128, Selection Mode */
5110 {GTPV2_IE_SOURCE_IDENT, dissect_gtpv2_source_ident}, /* 129, Source Identification 8.59 */
5111 {GTPV2_IE_BEARER_CONTROL_MODE, dissect_gtpv2_bearer_control_mode}, /* 130, Bearer Control Mode */
5112 {GTPV2_IE_CNG_REP_ACT , dissect_gtpv2_cng_rep_act}, /* 131, Change Reporting Action 8.61 */
5113 {GTPV2_IE_FQ_CSID, dissect_gtpv2_fq_csid}, /* 132, Fully Qualified PDN Connection Set Identifier (FQ-CSID) 8.62 */
5114 {GTPV2_IE_CHANNEL_NEEDED, dissect_gtpv2_channel_needed}, /* 133, Channel Needed 8.63 */
5115 {GTPV2_IE_EMLPP_PRI, dissect_gtpv2_emlpp_pri}, /* 134, eMLPP Priority 8.64 */
5116 {GTPV2_IE_NODE_TYPE , dissect_gtpv2_node_type}, /* 135, Node Type 8.65 */
5117 {GTPV2_IE_FQDN, dissect_gtpv2_fqdn}, /* 136, 8.66 Fully Qualified Domain Name (FQDN) */
5118 {GTPV2_IE_TI, dissect_gtpv2_ti}, /* 137, 8.68 Transaction Identifier (TI) */
5119 {GTPV2_IE_MBMS_SESSION_DURATION, dissect_gtpv2_mbms_session_duration}, /* 138, 8.69 MBMS Session Duration */
5120 {GTPV2_IE_MBMS_SERVICE_AREA, dissect_gtpv2_mbms_service_area}, /* 139, 8.70 MBMS Service Area */
5121 {GTPV2_IE_MBMS_SESSION_ID, dissect_gtpv2_mbms_session_id}, /* 140, 8.71 MBMS Session Identifier */
5122 {GTPV2_IE_MBMS_FLOW_ID, dissect_gtpv2_mbms_flow_id}, /* 141, 8.72 MBMS Flow Identifier */
5123 {GTPV2_IE_MBMS_IP_MC_DIST, dissect_gtpv2_mbms_ip_mc_dist}, /* 142, 8.73 MBMS IP Multicast Distribution */
5124 {GTPV2_IE_MBMS_DIST_ACK, dissect_gtpv2_mbms_dist_ack}, /* 143, 8.74 MBMS Distribution Acknowledge */
5125 {GTPV2_IE_RFSP_INDEX, dissect_gtpv2_rfsp_index}, /* 144, 8.77 RFSP Index */
5126 {GTPV2_IE_UCI, dissect_gtpv2_uci}, /* 145, 8.75 User CSG Information (UCI) */
5127 {GTPV2_IE_CSG_INFO_REP_ACTION, dissect_gtpv2_csg_info_rep_action}, /* 146, 8.76 CSG Information Reporting Action */
5128 {GTPV2_IE_CSG_ID, dissect_gtpv2_csg_id}, /* 147, 8.78 CSG ID */
5129 {GTPV2_IE_CMI, dissect_gtpv2_cmi}, /* 148, 8.79 CSG Membership Indication (CMI) */
5130 {GTPV2_IE_SERVICE_INDICATOR, dissect_gtpv2_service_indicator}, /* 149, 8.80 Service indicator */
5131 {GTPV2_IE_DETACH_TYPE, dissect_gtpv2_detach_type}, /* 150, 8.81 Detach Type */
5132 {GTPV2_IE_LDN, dissect_gtpv2_ldn}, /* 151, 8.82 Local Distinguished Name (LDN) */
5133 {GTPV2_IE_NODE_FEATURES, dissect_gtpv2_node_features}, /* 152, 8.83 Node Features */
5134 {GTPV2_IE_MBMS_TIME_TO_DATA_XFER, dissect_gtpv2_mbms_time_to_data_xfer}, /* 153, 8.84 MBMS Time to Data Transfer */
5135 {GTPV2_IE_THROTTLING, dissect_gtpv2_throttling}, /* 154, 8.85 Throttling */
5136 {GTPV2_IE_ARP, dissect_gtpv2_arp}, /* 155, 8.86 Allocation/Retention Priority (ARP) */
5137 {GTPV2_IE_EPC_TIMER, dissect_gtpv2_epc_timer}, /* 156, 8.87 EPC Timer */
5138 {GTPV2_IE_SIG_PRIO_IND, dissect_gtpv2_sig_prio_ind}, /* 157, 8.88 Signalling Priority Indication */
5139 {GTPV2_IE_TMGI, dissect_gtpv2_tmgi}, /* 158, 8.89 Temporary Mobile Group Identity (TMGI) */
5140 {GTPV2_IE_ADD_MM_CONT_FOR_SRVCC, dissect_gtpv2_add_mm_cont_for_srvcc}, /* 159, 8.90 Additional MM context for SRVCC */
5141 {GTPV2_IE_ADD_FLAGS_FOR_SRVCC, dissect_gtpv2_add_flags_for_srvcc}, /* 160, 8.91 Additional flags for SRVCC */
5142 {GTPV2_IE_MMBR, dissect_gtpv2_mmbr}, /* 161, 8.92 Max MBR/APN-AMBR (MMBR) */
5143 {GTPV2_IE_MDT_CONFIG, dissect_gtpv2_mdt_config}, /* 162, 8.93 MDT Configuration */
5144 {GTPV2_IE_APCO, dissect_gtpv2_apco}, /* 163, 8.94 Additional Protocol Configuration Options (APCO) */
5145 {GTPV2_IE_ABS_MBMS_DATA_TF_TIME, dissect_gtpv2_abs_mbms_data_tf_time}, /* 164, 8.95 Absolute Time of MBMS Data Transfer */
5146 {GTPV2_IE_HENB_INFO_REPORT, dissect_gtpv2_henb_info_report}, /* 165, 8.96 H(e)NB Information Reporting */
5147 {GTPV2_IE_IP4CP, dissect_gtpv2_ip4cp}, /* 166, 8.97 IPv4 Configuration Parameters (IPv4CP) */
5148 {GTPV2_IE_CHANGE_TO_REPORT_FLAGS, dissect_gtpv2_change_report_flags}, /* 167, 8.98 Change to Report Flags */
5149 {GTPV2_IE_ACTION_INDICATION, dissect_gtpv2_action_indication}, /* 168, 8.99 Action Indication */
5150 /* 169-254 Spare. For future use. FFS */
5151 {GTPV2_IE_PRIVATE_EXT, dissect_gtpv2_private_ext},
5153 {0, dissect_gtpv2_unknown}
5156 static void
5157 dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint offset, guint8 message_type)
5159 proto_tree *ie_tree;
5160 proto_item *ti;
5161 tvbuff_t *ie_tvb;
5162 guint8 type, instance;
5163 guint16 length;
5164 int i;
5166 * Octets 8 7 6 5 4 3 2 1
5167 * 1 Type
5168 * 2-3 Length = n
5169 * 4 CR Spare Instance
5170 * 5-(n+4) IE specific data
5172 while (offset < (gint)tvb_reported_length(tvb)) {
5173 /* Get the type and length */
5175 type = tvb_get_guint8(tvb, offset);
5176 length = tvb_get_ntohs(tvb, offset + 1);
5177 ti = proto_tree_add_text(tree, tvb, offset, 4 + length, "%s : ",
5178 val_to_str_ext_const(type, &gtpv2_element_type_vals_ext, "Unknown"));
5179 ie_tree = proto_item_add_subtree(ti, ett_gtpv2_ie);
5181 /* Octet 1 */
5182 proto_tree_add_item(ie_tree, hf_gtpv2_ie, tvb, offset, 1, ENC_BIG_ENDIAN);
5183 offset += 1;
5185 /*Octet 2 - 3 */
5186 proto_tree_add_item(ie_tree, hf_gtpv2_ie_len, tvb, offset, 2, ENC_BIG_ENDIAN);
5187 offset += 2;
5188 /* CR Spare Instance Octet 4*/
5189 proto_tree_add_item(ie_tree, hf_gtpv2_cr, tvb, offset, 1, ENC_BIG_ENDIAN);
5191 instance = tvb_get_guint8(tvb, offset) & 0x0f;
5192 proto_tree_add_item(ie_tree, hf_gtpv2_instance, tvb, offset, 1, ENC_BIG_ENDIAN);
5193 offset += 1;
5195 /* TODO: call IE dissector here */
5196 if (type == GTPV2_IE_RESERVED) {
5197 /* Treat IE type zero specal as type zero is used to end the loop in the else branch */
5198 proto_tree_add_text(ie_tree, tvb, offset, length, "IE type Zero is Reserved and should not be used");
5199 } else {
5200 i = -1;
5201 /* Loop over the IE dissector list to se if we find an entry;
5202 the last entry will have ie_type=0 breaking the loop */
5203 while (gtpv2_ies[++i].ie_type) {
5204 if (gtpv2_ies[i].ie_type == type)
5205 break;
5207 /* Just give the IE dissector the IE */
5208 ie_tvb = tvb_new_subset_remaining(tvb, offset);
5209 (*gtpv2_ies[i].decode) (ie_tvb, pinfo , ie_tree, ti, length, message_type, instance);
5212 offset += length;
5216 static void
5217 dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
5219 proto_tree *gtpv2_tree, *flags_tree;
5220 proto_item *ti, *tf;
5221 guint8 message_type, t_flag, p_flag;
5222 int offset = 0;
5223 guint16 msg_length;
5224 tvbuff_t *msg_tvb;
5227 /* Currently we get called from the GTP dissector no need to check the version */
5228 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv2");
5229 col_clear(pinfo->cinfo, COL_INFO);
5231 /* message type is in octet 2 */
5232 message_type = tvb_get_guint8(tvb, 1);
5233 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(message_type, &gtpv2_message_type_vals_ext, "Unknown"));
5236 p_flag = (tvb_get_guint8(tvb, offset) & 0x10) >> 4;
5237 msg_length = tvb_get_ntohs(tvb, offset + 2);
5238 proto_tree_add_item(tree, proto_gtpv2, tvb, offset, msg_length + 4, ENC_NA);
5240 if (tree) {
5241 ti = proto_tree_add_text(tree, tvb, offset, msg_length + 4, "%s",
5242 val_to_str_ext_const(message_type, &gtpv2_message_type_vals_ext, "Unknown"));
5243 gtpv2_tree = proto_item_add_subtree(ti, ett_gtpv2);
5245 /* Control Plane GTP uses a variable length header. Control Plane GTP header
5246 * length shall be a multiple of 4 octets.
5247 * Figure 5.1-1 illustrates the format of the GTPv2-C Header.
5248 * Bits 8 7 6 5 4 3 2 1
5249 * Octets 1 Version P T Spare Spare Spare
5250 * 2 Message Type
5251 * 3 Message Length (1st Octet)
5252 * 4 Message Length (2nd Octet)
5253 * m-k(m+3) If T flag is set to 1, then TEID shall be placed into octets 5-8.
5254 * Otherwise, TEID field is not present at all.
5255 * n-(n+2) Sequence Number
5256 * (n+3) Spare
5257 * Figure 5.1-1: General format of GTPv2 Header for Control Plane
5259 tf = proto_tree_add_item(gtpv2_tree, hf_gtpv2_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
5260 flags_tree = proto_item_add_subtree(tf, ett_gtpv2_flags);
5262 /* Octet 1 */
5263 t_flag = (tvb_get_guint8(tvb, offset) & 0x08) >> 3;
5264 proto_tree_add_item(flags_tree, hf_gtpv2_version, tvb, offset, 1, ENC_BIG_ENDIAN);
5265 proto_tree_add_item(flags_tree, hf_gtpv2_p, tvb, offset, 1, ENC_BIG_ENDIAN);
5266 proto_tree_add_item(flags_tree, hf_gtpv2_t, tvb, offset, 1, ENC_BIG_ENDIAN);
5267 offset += 1;
5269 /* Octet 2 */
5270 proto_tree_add_item(gtpv2_tree, hf_gtpv2_message_type, tvb, offset, 1, ENC_BIG_ENDIAN);
5271 offset += 1;
5272 /* Octet 3 - 4 */
5273 proto_tree_add_item(gtpv2_tree, hf_gtpv2_msg_length, tvb, offset, 2, ENC_BIG_ENDIAN);
5274 offset += 2;
5276 if (t_flag) {
5277 /* Tunnel Endpoint Identifier 4 octets */
5278 proto_tree_add_item(gtpv2_tree, hf_gtpv2_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
5279 offset += 4;
5281 /* Sequence Number 3 octets */
5282 proto_tree_add_item(gtpv2_tree, hf_gtpv2_seq, tvb, offset, 3, ENC_BIG_ENDIAN);
5283 offset += 3;
5285 /* Spare 1 octet */
5286 proto_tree_add_item(gtpv2_tree, hf_gtpv2_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
5287 offset += 1;
5289 if (p_flag) {
5290 msg_tvb = tvb_new_subset(tvb, 0, msg_length + 4, msg_length + 4);
5291 dissect_gtpv2_ie_common(msg_tvb, pinfo, gtpv2_tree, offset, message_type);
5292 } else {
5293 dissect_gtpv2_ie_common(tvb, pinfo, gtpv2_tree, offset, message_type);
5296 /* Bit 5 represents a "P" flag. If the "P" flag is set to "0",
5297 * no piggybacked message shall be present. If the "P" flag is set to "1",
5298 * then another GTPv2-C message with its own header and body shall be present
5299 * at the end of the current message.
5301 if (p_flag) {
5302 tvbuff_t *new_p_tvb;
5303 /* Octets 3 to 4 represent the Length field. This field shall indicate the
5304 * length of the message in octets excluding the
5305 * mandatory part of the GTP-C header (the first 4 octets).
5307 new_p_tvb = tvb_new_subset_remaining(tvb, msg_length + 4);
5308 col_append_str(pinfo->cinfo, COL_INFO, " / ");
5309 col_set_fence(pinfo->cinfo, COL_INFO);
5310 dissect_gtpv2(new_p_tvb, pinfo, tree);
5316 void proto_register_gtpv2(void)
5318 static hf_register_info hf_gtpv2[] = {
5319 { &hf_gtpv2_reserved,
5320 {"Reserved bit(s)", "gtpv2.reserved",
5321 FT_UINT8, BASE_DEC, NULL, 0x0,
5322 "Reserved", HFILL }
5324 { &hf_gtpv2_spare_half_octet,
5325 {"Spare half octet", "gtpv2.spare_half_octet",
5326 FT_UINT8, BASE_DEC, NULL, 0x0,
5327 NULL, HFILL }
5329 { &hf_gtpv2_spare_bits,
5330 {"Spare bit(s)", "gtpv2.spare_bits",
5331 FT_UINT8, BASE_DEC, NULL, 0x0,
5332 NULL, HFILL }
5334 {&hf_gtpv2_flags,
5335 {"Flags", "gtpv2.flags",
5336 FT_UINT8, BASE_HEX, NULL, 0x0,
5337 NULL, HFILL}
5339 {&hf_gtpv2_version,
5340 {"Version", "gtpv2.version",
5341 FT_UINT8, BASE_DEC, NULL, 0xe0,
5342 NULL, HFILL}
5344 {&hf_gtpv2_p,
5345 {"Piggybacking flag (P)", "gtpv2.p",
5346 FT_UINT8, BASE_DEC, NULL, 0x10,
5347 "If Piggybacked message is present or not", HFILL}
5349 { &hf_gtpv2_t,
5350 {"TEID flag (T)", "gtpv2.t",
5351 FT_UINT8, BASE_DEC, NULL, 0x08,
5352 "If TEID field is present or not", HFILL}
5354 { &hf_gtpv2_message_type,
5355 {"Message Type", "gtpv2.message_type",
5356 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_message_type_vals_ext, 0x0,
5357 NULL, HFILL}
5359 { &hf_gtpv2_msg_length,
5360 {"Message Length", "gtpv2.msg_lengt",
5361 FT_UINT16, BASE_DEC, NULL, 0x0,
5362 NULL, HFILL}
5364 { &hf_gtpv2_teid,
5365 {"Tunnel Endpoint Identifier", "gtpv2.teid",
5366 FT_UINT32, BASE_DEC, NULL, 0x0,
5367 "TEID", HFILL}
5369 { &hf_gtpv2_seq,
5370 {"Sequence Number", "gtpv2.seq",
5371 FT_UINT32, BASE_DEC, NULL, 0x0,
5372 "SEQ", HFILL}
5374 { &hf_gtpv2_spare,
5375 {"Spare", "gtpv2.spare",
5376 FT_UINT16, BASE_DEC, NULL, 0x0,
5377 NULL, HFILL}
5379 { &hf_gtpv2_ie,
5380 {"IE Type", "gtpv2.ie_type",
5381 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_element_type_vals_ext, 0x0,
5382 NULL, HFILL}
5384 { &hf_gtpv2_ie_len,
5385 {"IE Length", "gtpv2.ie_len",
5386 FT_UINT16, BASE_DEC, NULL, 0x0,
5387 "length of the information element excluding the first four octets", HFILL}
5389 { &hf_gtpv2_cr,
5390 {"CR flag", "gtpv2.cr",
5391 FT_UINT8, BASE_DEC, NULL, 0xf0, /* SRVCC */
5392 NULL, HFILL}
5394 { &hf_gtpv2_instance,
5395 {"Instance", "gtpv2.instance",
5396 FT_UINT8, BASE_DEC, NULL, 0x0f,
5397 NULL, HFILL}
5399 {&hf_gtpv2_imsi,
5400 {"IMSI(International Mobile Subscriber Identity number)", "gtpv2.imsi",
5401 FT_STRING, BASE_NONE, NULL, 0,
5402 NULL, HFILL}
5404 { &hf_gtpv2_ipv4_addr,
5405 {"IPv4 Address", "gtpv2.ipv4_addr",
5406 FT_IPv4, BASE_NONE, NULL, 0x0,
5407 NULL, HFILL}
5409 { &hf_gtpv2_cause,
5410 {"Cause", "gtpv2.cause",
5411 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_vals_ext, 0x0,
5412 NULL, HFILL}
5414 {&hf_gtpv2_cause_cs,
5415 {"CS (Cause Source)", "gtpv2.cs",
5416 FT_BOOLEAN, 8, TFS(&gtpv2_cause_cs), 0x01,
5417 NULL, HFILL}
5419 { &hf_gtpv2_cause_bce,
5420 {"BCE (Bearer Context IE Error)", "gtpv2.bce",
5421 FT_BOOLEAN, 8, NULL, 0x02,
5422 NULL, HFILL}
5424 { &hf_gtpv2_cause_pce,
5425 {"PCE (PDN Connection IE Error)", "gtpv2.pce",
5426 FT_BOOLEAN, 8, NULL, 0x04,
5427 NULL, HFILL}
5429 { &hf_gtpv2_cause_off_ie_t,
5430 {"Type of the offending IE", "gtpv2.cause_off_ie_t",
5431 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_element_type_vals_ext, 0x0,
5432 NULL, HFILL}
5434 { &hf_gtpv2_rec,
5435 {"Restart Counter", "gtpv2.rec",
5436 FT_UINT8, BASE_DEC, NULL, 0x0,
5437 NULL, HFILL}
5439 /*Start SRVCC Messages*/
5440 { &hf_gtpv2_stn_sr,
5441 {"STN-SR", "gtpv2.stn_sr",
5442 FT_BYTES, BASE_NONE, NULL, 0x0,
5443 NULL, HFILL}
5445 { &hf_gtpv2_len_trans_con,
5446 {"Length of the Transparent Container", "gtpv2.len_trans_con",
5447 FT_UINT8, BASE_DEC, NULL, 0x0,
5448 NULL, HFILL}
5450 { &hf_gtpv2_eksi,
5451 {"eKSI", "gtpv2.eksi",
5452 FT_UINT8, BASE_DEC, NULL, 0x07,
5453 NULL, HFILL}
5455 { &hf_gtpv2_ck,
5456 {"CK", "gtpv2.ck",
5457 FT_BYTES, BASE_NONE, NULL, 0x0,
5458 NULL, HFILL}
5460 { &hf_gtpv2_ik,
5461 {"IK", "gtpv2.ik",
5462 FT_BYTES, BASE_NONE, NULL, 0x0,
5463 NULL, HFILL}
5465 { &hf_gtpv2_len_ms_classmark2,
5466 {"Length of Mobile Station Classmark2", "gtpv2.len_ms_classmark2",
5467 FT_UINT8, BASE_DEC, NULL, 0x0,
5468 NULL, HFILL}
5470 { &hf_gtpv2_len_ms_classmark3,
5471 {"Length of Mobile Station Classmark3", "gtpv2.len_ms_classmark3",
5472 FT_UINT8, BASE_DEC, NULL, 0x0,
5473 NULL, HFILL}
5475 { &hf_gtpv2_len_supp_codec_list,
5476 {"Length of Supported Codec List", "gtpv2.len_supp_codec_list",
5477 FT_UINT8, BASE_DEC, NULL, 0x0,
5478 NULL, HFILL}
5480 { &hf_gtpv2_ksi,
5481 {"KSI'cs", "gtpv2.ksi",
5482 FT_UINT8, BASE_DEC, NULL, 0x0F,
5483 NULL, HFILL}
5485 { &hf_gtpv2_cksn,
5486 {"CKSN'", "gtpv2.cksn",
5487 FT_UINT8, BASE_DEC, NULL, 0x0,
5488 NULL, HFILL}
5490 { &hf_gtpv2_srvcc_cause,
5491 {"SRVCC Cause", "gtpv2.srvcc_cause",
5492 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_srvcc_cause_vals_ext, 0x0,
5493 NULL, HFILL}
5495 {&hf_gtpv2_rac,
5496 { "Routing Area Code (RAC)", "gtpv2.rac",
5497 FT_UINT8, BASE_DEC, NULL, 0,
5498 "Routing Area Code", HFILL}
5501 { &hf_gtpv2_rnc_id,
5502 {"RNC ID", "gtpv2.rnc_id",
5503 FT_UINT16, BASE_DEC, NULL, 0x0,
5504 NULL, HFILL}
5506 { &hf_gtpv2_ext_rnc_id,
5507 {"Extended RNC-ID", "gtpv2.ext_rnc_id",
5508 FT_UINT16, BASE_DEC, NULL, 0x0,
5509 NULL, HFILL}
5511 { &hf_gtpv2_lac,
5512 { "Location Area Code (LAC)", "gtpv2.lac",
5513 FT_UINT16, BASE_HEX_DEC, NULL, 0x00,
5514 NULL, HFILL }
5516 { &hf_gtpv2_sac,
5517 { "Service Area Code (SAC)", "gtpv2.sac",
5518 FT_UINT16, BASE_HEX_DEC, NULL, 0x00,
5519 NULL, HFILL }
5521 { &hf_gtpv2_tgt_g_cell_id,
5522 {"Cell ID", "gtpv2.tgt_g_cell_id",
5523 FT_UINT16, BASE_DEC, NULL, 0x0,
5524 NULL, HFILL}
5526 {&hf_gtpv2_teid_c,
5527 {"Tunnel Endpoint Identifier for Control Plane(TEID-C)", "gtpv2.teid_c",
5528 FT_UINT32, BASE_DEC, NULL, 0x0,
5529 NULL, HFILL}
5531 {&hf_gtpv2_sv_sti,
5532 {"STI (Session Transfer Indicator)", "gtpv2.sv_sti",
5533 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL}
5535 {&hf_gtpv2_sv_ics,
5536 {"ICS (IMS Centralized Service)", "gtpv2.sv_ics",
5537 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL}
5539 {&hf_gtpv2_sv_emind,
5540 {"EmInd(Emergency Indicator)", "gtpv2.sv_emind",
5541 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}
5544 /*End SRVCC Messages*/
5545 {&hf_gtpv2_apn,
5546 {"APN (Access Point Name)", "gtpv2.apn",
5547 FT_STRING, BASE_NONE, NULL, 0x0,
5548 NULL, HFILL}
5550 {&hf_gtpv2_ambr_up,
5551 {"AMBR Uplink (Aggregate Maximum Bit Rate for Uplink)", "gtpv2.ambr_up",
5552 FT_UINT32, BASE_DEC, NULL, 0x0,
5553 NULL, HFILL}
5555 {&hf_gtpv2_ambr_down,
5556 {"AMBR Downlink(Aggregate Maximum Bit Rate for Downlink)", "gtpv2.ambr_down",
5557 FT_UINT32, BASE_DEC, NULL, 0x0,
5558 NULL, HFILL}
5560 {&hf_gtpv2_ebi,
5561 {"EPS Bearer ID (EBI)", "gtpv2.ebi",
5562 FT_UINT8, BASE_DEC, NULL, 0x0f,
5563 NULL, HFILL}
5565 { &hf_gtpv2_ip_address_ipv4,
5566 {"IP address IPv4", "gtpv2.ip_address_ipv4",
5567 FT_IPv4, BASE_NONE, NULL, 0x0,
5568 NULL, HFILL}
5570 { &hf_gtpv2_ip_address_ipv6,
5571 {"IP address IPv6", "gtpv2.ip_address_ipv6",
5572 FT_IPv6, BASE_NONE, NULL, 0x0,
5573 NULL, HFILL}
5575 {&hf_gtpv2_mei,
5576 {"MEI(Mobile Equipment Identity)", "gtpv2.mei",
5577 FT_STRING, BASE_NONE, NULL, 0,
5578 NULL, HFILL}
5580 { &hf_gtpv2_pdn_numbers_nsapi,
5581 {"NSAPI", "gtpv2.pdn_numbers_nsapi",
5582 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL}
5584 { &hf_gtpv2_p_tmsi,
5585 {"Packet TMSI (P-TMSI)", "gtpv2.p_tmsi",
5586 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
5588 { &hf_gtpv2_p_tmsi_sig,
5589 {"P-TMSI Signature", "gtpv2.p_tmsi_sig",
5590 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
5592 {&hf_gtpv2_daf,
5593 {"DAF (Dual Address Bearer Flag)", "gtpv2.daf",
5594 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
5596 {&hf_gtpv2_dtf,
5597 {"DTF (Direct Tunnel Flag)", "gtpv2.dtf",
5598 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}
5600 {&hf_gtpv2_hi,
5601 {"HI (Handover Indication)", "gtpv2.hi",
5602 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}
5604 {&hf_gtpv2_dfi,
5605 {"DFI (Direct Forwarding Indication)", "gtpv2.dfi",
5606 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}
5608 {&hf_gtpv2_oi,
5609 {"OI (Operation Indication)", "gtpv2.oi",
5610 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL}
5612 {&hf_gtpv2_isrsi,
5613 {"ISRSI (Idle mode Signalling Reduction Supported Indication)", "gtpv2.isrsi",
5614 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL}
5616 {&hf_gtpv2_israi,
5617 {"ISRAI (Idle mode Signalling Reduction Activation Indication)", "gtpv2.israi",
5618 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL}
5620 {&hf_gtpv2_sgwci,
5621 {"SGWCI (SGW Change Indication)", "gtpv2.sgwci",
5622 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}
5624 {&hf_gtpv2_sqci,
5625 {"SQCI (Subscribed QoS Change Indication", "gtpv2.sqci",
5626 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
5628 {&hf_gtpv2_uimsi,
5629 {"UIMSI (Unauthenticated IMSI)", "gtpv2.uimsi",
5630 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}
5632 {&hf_gtpv2_cfsi,
5633 {"CFSI (Change F-TEID support indication)", "gtpv2.cfsi",
5634 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}
5636 {&hf_gtpv2_crsi,
5637 {"CRSI (Change Reporting support indication):", "gtpv2.crsi",
5638 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}
5640 {&hf_gtpv2_ps,
5641 {"PS (Piggybacking Supported).)", "gtpv2.ps",
5642 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL}
5644 {&hf_gtpv2_pt,
5645 {"PT (Protocol Type)", "gtpv2.pt",
5646 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL}
5648 {&hf_gtpv2_si,
5649 {"SI (Scope Indication)", "gtpv2.si",
5650 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL}
5652 {&hf_gtpv2_msv,
5653 {"MSV (MS Validated)", "gtpv2.msv",
5654 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}
5656 {&hf_gtpv2_spare1,
5657 {"Spare", "gtpv2.spare",
5658 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
5660 {&hf_gtpv2_spare2,
5661 {"Spare", "gtpv2.spare",
5662 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}
5664 {&hf_gtpv2_spare3,
5665 {"Spare", "gtpv2.spare",
5666 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}
5668 {&hf_gtpv2_s6af,
5669 {"S6AF (Static IPv6 Address Flag)", "gtpv2.s6af",
5670 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}
5672 {&hf_gtpv2_s4af,
5673 {"S4AF (Static IPv4 Address Flag))", "gtpv2.s4af",
5674 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL}
5676 {&hf_gtpv2_mbmdt,
5677 {"MBMDT (Management Based MDT allowed flag)", "gtpv2.mbmdt",
5678 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL}
5680 {&hf_gtpv2_israu,
5681 {"ISRAU (ISR is activated for the UE)", "gtpv2.israu",
5682 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL}
5684 {&hf_gtpv2_ccrsi,
5685 {"CCRSI (CSG Change Reporting support indication)", "gtpv2.ccrsi",
5686 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}
5688 { &hf_gtpv2_pdn_type,
5689 {"PDN Type", "gtpv2.pdn_type",
5690 FT_UINT8, BASE_DEC, VALS(gtpv2_pdn_type_vals), 0x07,
5691 NULL, HFILL}
5693 #if 0
5694 { &hf_gtpv2_tra_info,
5695 {"Trace ID", "gtpv2.tra_info",
5696 FT_STRING, BASE_NONE, NULL, 0x0,
5697 NULL, HFILL}
5699 #endif
5700 { &hf_gtpv2_tra_info_msc_momt_calls,
5701 {"MO and MT calls", "gtpv2.tra_info_msc_momt_calls",
5702 FT_UINT8, BASE_DEC, NULL, 0x01,
5703 "MSC Server", HFILL}
5705 { &hf_gtpv2_tra_info_msc_momt_sms,
5706 {"MO and MT SMS", "gtpv2.tra_info_msc_momt_sms",
5707 FT_UINT8, BASE_DEC, NULL, 0x02,
5708 "MSC Server", HFILL}
5710 { &hf_gtpv2_tra_info_msc_lu_imsi_ad,
5711 {"LU, IMSI attach, IMSI detach", "gtpv2.tra_info_msc_lu_imsi_ad",
5712 FT_UINT8, BASE_DEC, NULL, 0x04,
5713 "MSC Server", HFILL}
5715 { &hf_gtpv2_tra_info_msc_handovers,
5716 {"Handovers", "gtpv2.tra_info_msc_handovers",
5717 FT_UINT8, BASE_DEC, NULL, 0x08,
5718 "MSC Server", HFILL}
5720 { &hf_gtpv2_tra_info_msc_ss,
5721 {"SS", "gtpv2.tra_info_msc_ss",
5722 FT_UINT8, BASE_DEC, NULL, 0x10,
5723 "MSC Server", HFILL}
5725 { &hf_gtpv2_tra_info_mgw_context,
5726 {"Context", "gtpv2.tra_info_mgw_context",
5727 FT_UINT8, BASE_DEC, NULL, 0x01,
5728 "MGW", HFILL}
5730 { &hf_gtpv2_tra_info_sgsn_pdp_context,
5731 {"PDP context", "gtpv2.tra_info_sgsn_pdp_context",
5732 FT_UINT8, BASE_DEC, NULL, 0x01,
5733 "SGSN", HFILL}
5735 { &hf_gtpv2_tra_info_sgsn_momt_sms,
5736 {"MO and MT SMS", "gtpv2.tra_info_sgsn_momt_sms",
5737 FT_UINT8, BASE_DEC, NULL, 0x02,
5738 "SGSN", HFILL}
5740 { &hf_gtpv2_tra_info_sgsn_rau_gprs_ad,
5741 {"RAU, GPRS attach, GPRS detach", "gtpv2.tra_info_sgsn_rau_gprs_ad",
5742 FT_UINT8, BASE_DEC, NULL, 0x04,
5743 "SGSN", HFILL}
5745 { &hf_gtpv2_tra_info_sgsn_mbms,
5746 {"MBMS Context", "gtpv2.tra_into_sgsn_mbms",
5747 FT_UINT8, BASE_DEC, NULL, 0x08,
5748 "SGSN", HFILL}
5750 { &hf_gtpv2_tra_info_sgsn_reserved,
5751 {"Reserved", "gtpv2.",
5752 FT_UINT8, BASE_DEC, NULL, 0x0,
5753 "SGSN", HFILL}
5755 { &hf_gtpv2_tra_info_ggsn_pdp,
5756 {"PDP Cpntext", "gtpv2.tra_info_ggsn_pdp",
5757 FT_UINT8, BASE_DEC, NULL, 0x01,
5758 "GGSN", HFILL}
5760 { &hf_gtpv2_tra_info_ggsn_mbms,
5761 {"MBMS Context", "gtpv2.tra_info_ggsn_mbms",
5762 FT_UINT8, BASE_DEC, NULL, 0x02,
5763 "GGSN", HFILL}
5765 { &hf_gtpv2_tra_info_bm_sc,
5766 {"MBMS Multicast service activation", "gtpv2.tra_info_bm_sc",
5767 FT_UINT8, BASE_DEC, NULL, 0x01,
5768 "BM-SC", HFILL}
5770 { &hf_gtpv2_tra_info_mme_sgw_ss,
5771 {"Session setup", "gtpv2.tra_info_mme_sgw_ss",
5772 FT_UINT8, BASE_DEC, NULL, 0x01,
5773 "MME", HFILL}
5775 { &hf_gtpv2_tra_info_mme_sgw_sr,
5776 {"Service Request", "gtpv2.tra_info_mme_sgw_sr",
5777 FT_UINT8, BASE_DEC, NULL, 0x02,
5778 "MME", HFILL}
5780 { &hf_gtpv2_tra_info_mme_sgw_iataud,
5781 {"Initial Attach, Tracking area update, Detach", "gtpv2.tra_info_mme_sgw_iataud",
5782 FT_UINT8, BASE_DEC, NULL, 0x04,
5783 "MME", HFILL}
5785 { &hf_gtpv2_tra_info_lne_msc_s,
5786 {"MSC-S", "gtpv2.tra_info_lne_msc_s",
5787 FT_UINT8, BASE_DEC, NULL, 0x01,
5788 "List of NE Types", HFILL}
5790 { &hf_gtpv2_tra_info_lne_mgw,
5791 {"MGW", "gtpv2.tra_info_lne_mgw",
5792 FT_UINT8, BASE_DEC, NULL, 0x02,
5793 "List of NE Types", HFILL}
5795 { &hf_gtpv2_tra_info_lne_sgsn,
5796 {"SGSN", "gtpv2.tra_info_lne_sgsn",
5797 FT_UINT8, BASE_DEC, NULL, 0x04,
5798 "List of NE Types", HFILL}
5800 { &hf_gtpv2_tra_info_lne_ggsn,
5801 {"GGSN", "gtpv2.tra_info_lne_ggsn",
5802 FT_UINT8, BASE_DEC, NULL, 0x08,
5803 "List of NE Types", HFILL}
5805 { &hf_gtpv2_tra_info_lne_rnc,
5806 {"RNC", "gtpv2.tra_info_lne_rnc",
5807 FT_UINT8, BASE_DEC, NULL, 0x10,
5808 "List of NE Types", HFILL}
5810 { &hf_gtpv2_tra_info_lne_bm_sc,
5811 {"BM-SC", "gtpv2.tra_info_lne_bm_sc",
5812 FT_UINT8, BASE_DEC, NULL, 0x20,
5813 "List of NE Types", HFILL}
5815 { &hf_gtpv2_tra_info_lne_mme,
5816 {"MME", "gtpv2.tra_info_lne_mme",
5817 FT_UINT8, BASE_DEC, NULL, 0x40,
5818 "List of NE Types", HFILL}
5820 { &hf_gtpv2_tra_info_lne_sgw,
5821 {"SGW", "gtpv2.tra_info_lne_sgw",
5822 FT_UINT8, BASE_DEC, NULL, 0x80,
5823 "List of NE Types", HFILL}
5825 { &hf_gtpv2_tra_info_lne_pdn_gw,
5826 {"PDN GW", "gtpv2.tra_info_lne_pdn_gw",
5827 FT_UINT8, BASE_DEC, NULL, 0x01,
5828 "List of NE Types", HFILL}
5830 { &hf_gtpv2_tra_info_lne_enb,
5831 {"eNB", "gtpv2.tra_info_lne_enb",
5832 FT_UINT8, BASE_DEC, NULL, 0x02,
5833 "List of NE Types", HFILL}
5835 { &hf_gtpv2_tra_info_tdl,
5836 {"Trace Depth Length", "gtpv2.tra_info_tdl",
5837 FT_UINT8, BASE_DEC, NULL, 0x0,
5838 NULL, HFILL}
5840 { &hf_gtpv2_tra_info_lmsc_a,
5841 {"A", "gtpv2.tra_info_lmsc_a",
5842 FT_UINT8, BASE_DEC, NULL, 0x01,
5843 "MSC Server", HFILL}
5845 { &hf_gtpv2_tra_info_lmsc_lu,
5846 {"Iu", "gtpv2.tra_info_lmsc_lu",
5847 FT_UINT8, BASE_DEC, NULL, 0x02,
5848 "MSC Server", HFILL}
5850 { &hf_gtpv2_tra_info_lmsc_mc,
5851 {"Mc", "gtpv2.tra_info_lmsc_mc",
5852 FT_UINT8, BASE_DEC, NULL, 0x04,
5853 "MSC Server", HFILL}
5855 { &hf_gtpv2_tra_info_lmsc_map_g,
5856 {"MAP-G", "gtpv2.tra_info_lmsc_map_g",
5857 FT_UINT8, BASE_DEC, NULL, 0x08,
5858 "MSC Server", HFILL}
5860 { &hf_gtpv2_tra_info_lmsc_map_b,
5861 {"MAP-B", "gtpv2.tra_info_lmsc_map_b",
5862 FT_UINT8, BASE_DEC, NULL, 0x10,
5863 "MSC Server", HFILL}
5865 { &hf_gtpv2_tra_info_lmsc_map_e,
5866 {"MAP-E", "gtpv2.tra_info_lmsc_map_e",
5867 FT_UINT8, BASE_DEC, NULL, 0x20,
5868 "MSC Server", HFILL}
5870 { &hf_gtpv2_tra_info_lmsc_map_f,
5871 {"MAP-F", "gtpv2.tra_info_lmsc_map_f",
5872 FT_UINT8, BASE_DEC, NULL, 0x40,
5873 "MSC Server", HFILL}
5875 { &hf_gtpv2_tra_info_lmsc_cap,
5876 {"CAP", "gtpv2.tra_info_lmsc_cap",
5877 FT_UINT8, BASE_DEC, NULL, 0x80,
5878 "MSC Server", HFILL}
5880 { &hf_gtpv2_tra_info_lmsc_map_d,
5881 {"MAP-D", "gtpv2.tra_info_lmsc_map_d",
5882 FT_UINT8, BASE_DEC, NULL, 0x01,
5883 "MSC Server", HFILL}
5885 { &hf_gtpv2_tra_info_lmsc_map_c,
5886 {"MAP-C", "gtpv2.tra_info_lmsc_map_c",
5887 FT_UINT8, BASE_DEC, NULL, 0x02,
5888 "MSC Server", HFILL}
5890 { &hf_gtpv2_tra_info_lmgw_mc,
5891 {"Mc", "gtpv2.tra_info_lmgw_mc",
5892 FT_UINT8, BASE_DEC, NULL, 0x01,
5893 "MGW", HFILL}
5895 { &hf_gtpv2_tra_info_lmgw_nb_up,
5896 {"Nb-UP", "gtpv2.tra_info_lmgw_nb_up",
5897 FT_UINT8, BASE_DEC, NULL, 0x2,
5898 "MGW", HFILL}
5900 { &hf_gtpv2_tra_info_lmgw_lu_up,
5901 {"Iu-UP", "gtpv2.tra_info_lmgw_lu_up",
5902 FT_UINT8, BASE_DEC, NULL, 0x04,
5903 "MGW", HFILL}
5905 { &hf_gtpv2_tra_info_lsgsn_gb,
5906 {"Gb", "gtpv2.tra_info_lsgsn_gb",
5907 FT_UINT8, BASE_DEC, NULL, 0x01,
5908 "SGSN", HFILL}
5910 { &hf_gtpv2_tra_info_lsgsn_lu,
5911 {"Iu", "gtpv2.tra_info_lsgsn_lu",
5912 FT_UINT8, BASE_DEC, NULL, 0x02,
5913 "SGSN", HFILL}
5915 { &hf_gtpv2_tra_info_lsgsn_gn,
5916 {"Gn", "gtpv2.tra_info_lsgsn_gn",
5917 FT_UINT8, BASE_DEC, NULL, 0x04,
5918 "SGSN", HFILL}
5920 { &hf_gtpv2_tra_info_lsgsn_map_gr,
5921 {"MAP-Gr", "gtpv2.tra_info_lsgsn_map_gr",
5922 FT_UINT8, BASE_DEC, NULL, 0x08,
5923 "SGSN", HFILL}
5925 { &hf_gtpv2_tra_info_lsgsn_map_gd,
5926 {"MAP-Gd", "gtpv2.tra_info_lsgsn_map_gd",
5927 FT_UINT8, BASE_DEC, NULL, 0x10,
5928 "SGSN", HFILL}
5930 { &hf_gtpv2_tra_info_lsgsn_map_gf,
5931 {"MAP-Gf", "gtpv2.tra_info_lsgsn_map_gf",
5932 FT_UINT8, BASE_DEC, NULL, 0x20,
5933 "SGSN", HFILL}
5935 { &hf_gtpv2_tra_info_lsgsn_gs,
5936 {"Gs", "gtpv2.tra_info_lsgsn_gs",
5937 FT_UINT8, BASE_DEC, NULL, 0x40,
5938 "SGSN", HFILL}
5940 { &hf_gtpv2_tra_info_lsgsn_ge,
5941 {"Ge", "gtpv2.tra_info_lsgsn_ge",
5942 FT_UINT8, BASE_DEC, NULL, 0x80,
5943 "SGSN", HFILL}
5945 { &hf_gtpv2_tra_info_lggsn_gn,
5946 {"Gn", "gtpv2.tra_info_lggsn_gn",
5947 FT_UINT8, BASE_DEC, NULL, 0x01,
5948 "GGSN", HFILL}
5950 { &hf_gtpv2_tra_info_lggsn_gi,
5951 {"Gi", "gtpv2.tra_info_lggsn_gi",
5952 FT_UINT8, BASE_DEC, NULL, 0x02,
5953 "GGSN", HFILL}
5955 { &hf_gtpv2_tra_info_lggsn_gmb,
5956 {"Gmb", "gtpv2.tra_info_lggsn_gmb",
5957 FT_UINT8, BASE_DEC, NULL, 0x04,
5958 "GGSN", HFILL}
5960 { &hf_gtpv2_tra_info_lrnc_lu,
5961 {"Iu", "gtpv2.tra_info_lrnc_lu",
5962 FT_UINT8, BASE_DEC, NULL, 0x01,
5963 "RNC", HFILL}
5965 { &hf_gtpv2_tra_info_lrnc_lur,
5966 {"Iur", "gtpv2.tra_info_lrnc_lur",
5967 FT_UINT8, BASE_DEC, NULL, 0x02,
5968 "RNC", HFILL}
5970 { &hf_gtpv2_tra_info_lrnc_lub,
5971 {"Iub", "gtpv2.tra_info_lrnc_lub",
5972 FT_UINT8, BASE_DEC, NULL, 0x04,
5973 "RNC", HFILL}
5975 { &hf_gtpv2_tra_info_lrnc_uu,
5976 {"Uu", "gtpv2.tra_info_lrnc_uu",
5977 FT_UINT8, BASE_DEC, NULL, 0x08,
5978 "RNC", HFILL}
5980 { &hf_gtpv2_tra_info_lbm_sc_gmb,
5981 {"Gmb", "gtpv2.tra_info_lbm_sc_gmb",
5982 FT_UINT8, BASE_DEC, NULL, 0x01,
5983 "BM-SC", HFILL}
5985 { &hf_gtpv2_tra_info_lmme_s1_mme,
5986 {"S1-MME", "gtpv2.tra_info_lmme_s1_mme",
5987 FT_UINT8, BASE_DEC, NULL, 0x01,
5988 "MME", HFILL}
5990 { &hf_gtpv2_tra_info_lmme_s3,
5991 {"S3", "gtpv2.tra_info_lmme_s3",
5992 FT_UINT8, BASE_DEC, NULL, 0x02,
5993 "MME", HFILL}
5995 { &hf_gtpv2_tra_info_lmme_s6a,
5996 {"S6a", "gtpv2.tra_info_lmme_s6a",
5997 FT_UINT8, BASE_DEC, NULL, 0x04,
5998 "MME", HFILL}
6000 { &hf_gtpv2_tra_info_lmme_s10,
6001 {"S10", "gtpv2.tra_info_lmme_s10",
6002 FT_UINT8, BASE_DEC, NULL, 0x08,
6003 "MME", HFILL}
6005 { &hf_gtpv2_tra_info_lmme_s11,
6006 {"S11", "gtpv2.tra_info_lmme_s11",
6007 FT_UINT8, BASE_DEC, NULL, 0x10,
6008 "MME", HFILL}
6010 { &hf_gtpv2_tra_info_lsgw_s4,
6011 {"S4", "gtpv2.tra_info_lsgw_s4",
6012 FT_UINT8, BASE_DEC, NULL, 0x01,
6013 "SGW", HFILL}
6015 { &hf_gtpv2_tra_info_lsgw_s5,
6016 {"S5", "gtpv2.tra_info_lsgw_s5",
6017 FT_UINT8, BASE_DEC, NULL, 0x02,
6018 "SGW", HFILL}
6020 { &hf_gtpv2_tra_info_lsgw_s8b,
6021 {"S8b", "gtpv2.tra_info_lsgw_s8b",
6022 FT_UINT8, BASE_DEC, NULL, 0x04,
6023 "SGW", HFILL}
6025 { &hf_gtpv2_tra_info_lsgw_s11,
6026 {"S11", "gtpv2.tra_info_lsgw_s11",
6027 FT_UINT8, BASE_DEC, NULL, 0x08,
6028 "SGW", HFILL}
6030 { &hf_gtpv2_tra_info_lpdn_gw_s2a,
6031 {"S2a", "gtpv2.tra_info_lpdn_gw_s2a",
6032 FT_UINT8, BASE_DEC, NULL, 0x01,
6033 "PDN GW", HFILL}
6035 { &hf_gtpv2_tra_info_lpdn_gw_s2b,
6036 {"S2b", "gtpv2.tra_info_lpdn_gw_s2b",
6037 FT_UINT8, BASE_DEC, NULL, 0x02,
6038 "PDN GW", HFILL}
6040 { &hf_gtpv2_tra_info_lpdn_gw_s2c,
6041 {"S2c", "gtpv2.tra_info_lpdn_gw_s2c",
6042 FT_UINT8, BASE_DEC, NULL, 0x04,
6043 "PDN GW", HFILL}
6045 { &hf_gtpv2_tra_info_lpdn_gw_s5,
6046 {"S5", "gtpv2.tra_info_lpdn_gw_s5",
6047 FT_UINT8, BASE_DEC, NULL, 0x08,
6048 "PDN GW", HFILL}
6050 { &hf_gtpv2_tra_info_lpdn_gw_s6c,
6051 {"S6c", "gtpv2.tra_info_lpdn_gw_s6c",
6052 FT_UINT8, BASE_DEC, NULL, 0x10,
6053 "PDN GW", HFILL}
6055 { &hf_gtpv2_tra_info_lpdn_gw_gx,
6056 {"Gx", "gtpv2.tra_info_lpdn_gw_gx",
6057 FT_UINT8, BASE_DEC, NULL, 0x20,
6058 "PDN GW", HFILL}
6060 { &hf_gtpv2_tra_info_lpdn_gw_s8b,
6061 {"S8b", "gtpv2.tra_info_lpdn_gw_s8b",
6062 FT_UINT8, BASE_DEC, NULL, 0x40,
6063 "PDN GW", HFILL}
6065 { &hf_gtpv2_tra_info_lpdn_gw_sgi,
6066 {"SGi", "gtpv2.tra_info_lpdn_gw_sgi",
6067 FT_UINT8, BASE_DEC, NULL, 0x80,
6068 "PDN GW", HFILL}
6070 { &hf_gtpv2_tra_info_lenb_s1_mme,
6071 {"S1-MME", "gtpv2.tra_info_lenb_s1_mme",
6072 FT_UINT8, BASE_DEC, NULL, 0x01,
6073 "eNB", HFILL}
6075 { &hf_gtpv2_tra_info_lenb_x2,
6076 {"X2", "gtpv2.tra_info_lenb_x2",
6077 FT_UINT8, BASE_DEC, NULL, 0x02,
6078 "eNB", HFILL}
6080 { &hf_gtpv2_tra_info_lenb_uu,
6081 {"Uu", "gtpv2.tra_info_lenb_uu",
6082 FT_UINT8, BASE_DEC, NULL, 0x04,
6083 "eNB", HFILL}
6085 { &hf_gtpv2_pdn_ipv4,
6086 {"PDN Address and Prefix(IPv4)", "gtpv2.pdn_addr_and_prefix.ipv4",
6087 FT_IPv4, BASE_NONE, NULL, 0x0,
6088 NULL, HFILL}
6090 { &hf_gtpv2_pdn_ipv6_len,
6091 {"IPv6 Prefix Length", "gtpv2.pdn_ipv6_len",
6092 FT_UINT8, BASE_DEC, NULL, 0x0,
6093 NULL, HFILL}
6095 { &hf_gtpv2_pdn_ipv6,
6096 {"PDN Address and Prefix(IPv6)", "gtpv2.pdn_addr_and_prefix.ipv6",
6097 FT_BYTES, BASE_NONE, NULL, 0x0,
6098 NULL, HFILL}
6100 /* Bit 1 - PVI (Pre-emption Vulnerability): See 3GPP TS 29.212[29],
6101 * clause 5.3.47 Pre-emption-Vulnerability AVP.
6102 * 5.3.47 Pre-emption-Vulnerability AVP
6103 * The following values are defined:
6104 * PRE-EMPTION_VULNERABILITY_ENABLED (0)
6105 * PRE-EMPTION_VULNERABILITY_DISABLED (1)
6107 {&hf_gtpv2_bearer_qos_pvi,
6108 {"PVI (Pre-emption Vulnerability)", "gtpv2.bearer_qos_pvi",
6109 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
6110 NULL, HFILL}
6112 {&hf_gtpv2_bearer_qos_pl,
6113 {"PL (Priority Level)", "gtpv2.bearer_qos_pl",
6114 FT_UINT8, BASE_DEC, NULL, 0x3c,
6115 NULL, HFILL}
6117 /* Bit 7 - PCI (Pre-emption Capability): See 3GPP TS 29.212[29], clause 5.3.46 Pre-emption-Capability AVP.
6118 * clause 5.3.46 Pre-emption-Capability AVP.
6119 * 5.3.46 Pre-emption-Capability AVP
6120 * The following values are defined:
6121 * PRE-EMPTION_CAPABILITY_ENABLED (0)
6122 * PRE-EMPTION_CAPABILITY_DISABLED (1)
6124 {&hf_gtpv2_bearer_qos_pci,
6125 {"PCI (Pre-emption Capability)", "gtpv2.bearer_qos_pci",
6126 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
6127 NULL, HFILL}
6129 {&hf_gtpv2_bearer_qos_label_qci,
6130 {"Label (QCI)", "gtpv2.bearer_qos_label_qci",
6131 FT_UINT8, BASE_DEC, NULL, 0x0,
6132 NULL, HFILL}
6134 {&hf_gtpv2_bearer_qos_mbr_up,
6135 {"Maximum Bit Rate For Uplink", "gtpv2.bearer_qos_mbr_up",
6136 FT_UINT64, BASE_DEC, NULL, 0x0,
6137 NULL, HFILL}
6139 {&hf_gtpv2_bearer_qos_mbr_down,
6140 {"Maximum Bit Rate For Downlink", "gtpv2.bearer_qos_mbr_down",
6141 FT_UINT64, BASE_DEC, NULL, 0x0,
6142 NULL, HFILL}
6144 {&hf_gtpv2_bearer_qos_gbr_up,
6145 {"Guaranteed Bit Rate For Uplink", "gtpv2.bearer_qos_gbr_up",
6146 FT_UINT64, BASE_DEC, NULL, 0x0,
6147 NULL, HFILL}
6149 {&hf_gtpv2_bearer_qos_gbr_down,
6150 {"Guaranteed Bit Rate For Downlink", "gtpv2.bearer_qos_gbr_down",
6151 FT_UINT64, BASE_DEC, NULL, 0x0,
6152 NULL, HFILL}
6154 {&hf_gtpv2_flow_qos_label_qci,
6155 {"Label (QCI)", "gtpv2.flow_qos_label_qci",
6156 FT_UINT8, BASE_DEC, NULL, 0x0,
6157 NULL, HFILL}
6159 {&hf_gtpv2_flow_qos_mbr_up,
6160 {"Maximum Bit Rate For Uplink", "gtpv2.flow_qos_mbr_up",
6161 FT_UINT64, BASE_DEC, NULL, 0x0,
6162 NULL, HFILL}
6164 {&hf_gtpv2_flow_qos_mbr_down,
6165 {"Maximum Bit Rate For Downlink", "gtpv2.flow_qos_mbr_down",
6166 FT_UINT64, BASE_DEC, NULL, 0x0,
6167 NULL, HFILL}
6169 {&hf_gtpv2_flow_qos_gbr_up,
6170 {"Guaranteed Bit Rate For Uplink", "gtpv2.flow_qos_gbr_up",
6171 FT_UINT64, BASE_DEC, NULL, 0x0,
6172 NULL, HFILL}
6174 {&hf_gtpv2_flow_qos_gbr_down,
6175 {"Guaranteed Bit Rate For Downlink", "gtpv2.flow_qos_gbr_down",
6176 FT_UINT64, BASE_DEC, NULL, 0x0,
6177 NULL, HFILL}
6179 { &hf_gtpv2_rat_type,
6180 {"RAT Type", "gtpv2.rat_type",
6181 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_rat_type_vals_ext, 0x0,
6182 NULL, HFILL}
6184 { &hf_gtpv2_uli_ecgi_flg,
6185 {"ECGI Present Flag", "gtpv2.uli_ecgi_flg",
6186 FT_BOOLEAN, 8, NULL, GTPv2_ULI_ECGI_MASK,
6187 NULL, HFILL}
6189 { &hf_gtpv2_uli_lai_flg,
6190 {"LAI Present Flag", "gtpv2.uli_lai_flg",
6191 FT_BOOLEAN, 8, NULL, GTPv2_ULI_LAI_MASK,
6192 NULL, HFILL}
6194 { &hf_gtpv2_uli_tai_flg,
6195 {"TAI Present Flag", "gtpv2.uli_tai_flg",
6196 FT_BOOLEAN, 8, NULL, GTPv2_ULI_TAI_MASK,
6197 NULL, HFILL}
6199 { &hf_gtpv2_uli_rai_flg,
6200 {"RAI Present Flag", "gtpv2.uli_rai_flg",
6201 FT_BOOLEAN, 8, NULL, GTPv2_ULI_RAI_MASK,
6202 NULL, HFILL}
6204 { &hf_gtpv2_uli_sai_flg,
6205 {"SAI Present Flag", "gtpv2.uli_sai_flg",
6206 FT_BOOLEAN, 8, NULL, GTPv2_ULI_SAI_MASK,
6207 NULL, HFILL}
6209 { &hf_gtpv2_uli_cgi_flg,
6210 {"CGI Present Flag", "gtpv2.uli_cgi_flg",
6211 FT_BOOLEAN, 8, NULL, GTPv2_ULI_CGI_MASK,
6212 NULL, HFILL}
6214 { &hf_gtpv2_glt,
6215 {"Geographic Location Type", "gtpv2.glt",
6216 FT_UINT8, BASE_DEC, VALS(geographic_location_type_vals), 0x0,
6217 NULL, HFILL}
6219 { &hf_gtpv2_uli_cgi_lac,
6220 {"Location Area Code", "gtpv2.uli_cgi_lac",
6221 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
6222 NULL, HFILL}
6224 { &hf_gtpv2_uli_cgi_ci,
6225 {"Cell Identity", "gtpv2.uli_cgi_ci",
6226 FT_UINT16, BASE_DEC, NULL, 0x0,
6227 NULL, HFILL}
6229 { &hf_gtpv2_uli_sai_lac,
6230 {"Location Area Code", "gtpv2.uli_sai_lac",
6231 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
6232 NULL, HFILL}
6234 { &hf_gtpv2_uli_sai_sac,
6235 {"Service Area Code", "gtpv2.uli_sai_sac",
6236 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
6237 NULL, HFILL}
6239 { &hf_gtpv2_uli_rai_lac,
6240 {"Location Area Code", "gtpv2.uli_rai_lac",
6241 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
6242 NULL, HFILL}
6244 { &hf_gtpv2_uli_rai_rac,
6245 {"Routing Area Code", "gtpv2.uli_rai_rac",
6246 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
6247 NULL, HFILL}
6249 { &hf_gtpv2_uli_tai_tac,
6250 {"Tracking Area Code", "gtpv2.uli_tai_tac",
6251 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
6252 NULL, HFILL}
6254 {&hf_gtpv2_uli_ecgi_eci,
6255 {"ECI (E-UTRAN Cell Identifier)", "gtpv2.uli_ecgi_eci",
6256 FT_UINT32, BASE_DEC, NULL, 0x0,
6257 NULL, HFILL}
6259 {&hf_gtpv2_uli_lai_lac,
6260 {"Location Area Code (LAC)", "gtpv2.uli_lai_lac",
6261 FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
6262 NULL, HFILL}
6264 {&hf_gtpv2_uli_ecgi_eci_spare,
6265 {"Spare", "gtpv2.uli_ecgi_eci_spare",
6266 FT_UINT8, BASE_DEC, NULL, 0x0,
6267 NULL, HFILL}
6269 { &hf_gtpv2_nsapi,
6270 {"NSAPI", "gtpv2.nsapi",
6271 FT_UINT8, BASE_DEC, NULL, 0x0f,
6272 NULL, HFILL}
6274 {&hf_gtpv2_f_teid_v4,
6275 {"V4", "gtpv2.f_teid_v4",
6276 FT_BOOLEAN, 8, TFS(&gtpv2_f_teid_v4_vals), 0x80,
6277 NULL, HFILL}
6279 {&hf_gtpv2_f_teid_v6,
6280 {"V6", "gtpv2.f_teid_v6",
6281 FT_BOOLEAN, 8, TFS(&gtpv2_f_teid_v6_vals), 0x40,
6282 NULL, HFILL}
6284 {&hf_gtpv2_f_teid_interface_type,
6285 {"Interface Type", "gtpv2.f_teid_interface_type",
6286 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_f_teid_interface_type_vals_ext, 0x3f,
6287 NULL , HFILL}
6289 {&hf_gtpv2_f_teid_gre_key,
6290 {"TEID/GRE Key", "gtpv2.f_teid_gre_key",
6291 FT_UINT32, BASE_HEX, NULL, 0x0,
6292 NULL , HFILL}
6294 { &hf_gtpv2_f_teid_ipv4,
6295 {"F-TEID IPv4", "gtpv2.f_teid_ipv4",
6296 FT_IPv4, BASE_NONE, NULL, 0x0,
6297 NULL, HFILL}
6299 { &hf_gtpv2_f_teid_ipv6,
6300 {"F-TEID IPv6", "gtpv2.f_teid_ipv6",
6301 FT_IPv6, BASE_NONE, NULL, 0x0,
6302 NULL, HFILL}
6304 { &hf_gtpv2_tmsi,
6305 {"TMSI", "gtpv2.tmsi",
6306 FT_UINT32, BASE_HEX, NULL, 0x0,
6307 NULL, HFILL}
6309 { &hf_gtpv2_hsgw_addr_f_len,
6310 {"HSGW Address for forwarding Length", "gtpv2.hsgw_addr_f_len",
6311 FT_UINT8, BASE_DEC, NULL, 0x0,
6312 NULL, HFILL}
6314 { &hf_gtpv2_hsgw_addr_ipv4,
6315 {"HSGW Address for forwarding", "gtpv2.hsgw_addr_ipv4",
6316 FT_IPv4, BASE_NONE, NULL, 0x0,
6317 NULL, HFILL}
6319 { &hf_gtpv2_hsgw_addr_ipv6,
6320 {"HSGW Address for forwarding", "gtpv2.hsgw_addr_ipv6",
6321 FT_IPv6, BASE_NONE, NULL, 0x0,
6322 NULL, HFILL}
6324 { &hf_gtpv2_gre_key,
6325 {"GRE Key", "gtpv2.gre_key",
6326 FT_UINT32, BASE_DEC, NULL, 0x0,
6327 NULL , HFILL}
6329 { &hf_gtpv2_sgw_addr_ipv4,
6330 {"Serving GW Address", "gtpv2.sgw_addr_ipv4",
6331 FT_IPv4, BASE_NONE, NULL, 0x0,
6332 NULL, HFILL}
6334 { &hf_gtpv2_sgw_addr_ipv6,
6335 {"Serving GW Address", "gtpv2.sgw_addr_ipv6",
6336 FT_IPv6, BASE_NONE, NULL, 0x0,
6337 NULL, HFILL}
6339 { &hf_gtpv2_sgw_s1u_teid,
6340 {"Serving GW S1-U TEID", "gtpv2.sgw_s1u_teid",
6341 FT_UINT32, BASE_HEX, NULL, 0x0,
6342 NULL, HFILL}
6344 {&hf_gtpv2_delay_value,
6345 {"Delay Value (In integer multiples of 50 milliseconds or zero)", "gtpv2.delay_value",
6346 FT_UINT8, BASE_DEC, NULL, 0x0,
6347 NULL, HFILL}
6349 {&hf_gtpv2_charging_id,
6350 {"Charging id", "gtpv2.charging_id",
6351 FT_UINT32, BASE_DEC, NULL, 0x0,
6352 NULL, HFILL}
6354 {&hf_gtpv2_charging_characteristic,
6355 {"Charging Characteristic", "gtpv2.charging_characteristic",
6356 FT_UINT16, BASE_HEX, NULL, 0xffff,
6357 NULL, HFILL}
6359 {&hf_gtpv2_bearer_flag_ppc,
6360 {"PPC (Prohibit Payload Compression)", "gtpv2.bearer_flag.ppc",
6361 FT_BOOLEAN, 8, NULL, 0x01,
6362 NULL, HFILL}
6364 {&hf_gtpv2_bearer_flag_vb,
6365 {"VB (Voice Bearer)", "gtpv2.bearer_flag.vb",
6366 FT_BOOLEAN, 8, NULL, 0x02,
6367 NULL, HFILL}
6369 {&hf_gtpv2_pti,
6370 {"Procedure Transaction Id", "gtpv2.pti",
6371 FT_UINT8, BASE_DEC, NULL, 0x0,
6372 NULL, HFILL}
6374 /* MM Context */
6375 { &hf_gtpv2_mm_context_sm,
6376 {"Security Mode", "gtpv2.mm_context_sm",
6377 FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_security_mode), 0xe0,
6378 NULL, HFILL}
6380 { &hf_gtpv2_mm_context_nhi,
6381 {"NHI(Next Hop Indicator)", "gtpv2.mm_context_nhi",
6382 FT_BOOLEAN, 8, TFS(&gtpv2_nhi_vals), 0x10,
6383 NULL, HFILL}
6385 { &hf_gtpv2_mm_context_drxi,
6386 {"DRXI", "gtpv2.mm_context_drxi",
6387 FT_UINT8, BASE_DEC, NULL, 0x08,
6388 NULL, HFILL}
6390 { &hf_gtpv2_mm_context_cksn,
6391 {"CKSN", "gtpv2.mm_context_cksn",
6392 FT_UINT8, BASE_DEC, NULL, 0x07,
6393 NULL, HFILL}
6395 { &hf_gtpv2_mm_context_cksn_ksi,
6396 {"CKSN/KSI", "gtpv2.mm_context_cksn_ksi",
6397 FT_UINT8, BASE_DEC, NULL, 0x07,
6398 NULL, HFILL}
6400 { &hf_gtpv2_mm_context_ksi_a,
6401 {"KSI_asme", "gtpv2.mm_context_ksi_a",
6402 FT_UINT8, BASE_DEC, NULL, 0x07,
6403 NULL, HFILL}
6405 { &hf_gtpv2_mm_context_nr_tri,
6406 {"Number of Triplet", "gtpv2.mm_context_nr_tri",
6407 FT_UINT8, BASE_DEC, NULL, 0xe0,
6408 NULL, HFILL}
6410 { &hf_gtpv2_mm_context_used_cipher,
6411 {"Used Cipher", "gtpv2.mm_context_used_cipher",
6412 FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_used_cipher_vals), 0x07,
6413 NULL, HFILL}
6415 { &hf_gtpv2_mm_context_unipa,
6416 {"Used NAS integrity protection algorithm", "gtpv2.mm_context_unipa",
6417 FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_unipa_vals), 0x70,
6418 NULL, HFILL}
6421 { &hf_gtpv2_mm_context_unc,
6422 {"Used NAS Cipher", "gtpv2.mm_context_unc",
6423 FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_unc_vals), 0x0f,
6424 NULL, HFILL}
6426 { &hf_gtpv2_mm_context_nas_dl_cnt,
6427 {"NAS Downlink Count", "gtpv2.mm_context_nas_dl_cnt",
6428 FT_UINT24, BASE_DEC, NULL, 0x0,
6429 NULL, HFILL}
6431 { &hf_gtpv2_mm_context_nas_ul_cnt,
6432 {"NAS Uplink Count", "gtpv2.mm_context_nas_ul_cnt",
6433 FT_UINT24, BASE_DEC, NULL, 0x0,
6434 NULL, HFILL}
6436 { &hf_gtpv2_mm_context_kasme,
6437 {"Kasme", "gtpv2.mm_context_kasme",
6438 FT_BYTES, BASE_NONE, NULL, 0x0,
6439 NULL, HFILL}
6441 { &hf_gtpv2_mm_context_rand,
6442 {"RAND", "gtpv2.mm_context_rand",
6443 FT_BYTES, BASE_NONE, NULL, 0x0,
6444 NULL, HFILL}
6446 { &hf_gtpv2_mm_context_xres_len,
6447 {"XRES Length", "gtpv2.mm_context_xres_len",
6448 FT_UINT8, BASE_DEC, NULL, 0x0,
6449 NULL, HFILL}
6451 { &hf_gtpv2_mm_context_xres,
6452 {"XRES", "gtpv2.mm_context_xres",
6453 FT_BYTES, BASE_NONE, NULL, 0x0,
6454 NULL, HFILL}
6456 { &hf_gtpv2_mm_context_autn_len,
6457 {"AUTN Length", "gtpv2.mm_context_autn_len",
6458 FT_UINT8, BASE_DEC, NULL, 0x0,
6459 NULL, HFILL}
6461 { &hf_gtpv2_mm_context_autn,
6462 {"AUTN", "gtpv2.mm_context_autn",
6463 FT_BYTES, BASE_NONE, NULL, 0x0,
6464 NULL, HFILL}
6466 { &hf_gtpv2_mm_context_drx,
6467 {"DRX", "gtpv2.mm_context_drx",
6468 FT_UINT16, BASE_HEX, NULL, 0x0,
6469 NULL, HFILL}
6471 { &hf_gtpv2_vdp_length,
6472 {"VDP and UE's Usage Setting length", "gtpv2.vdp_length",
6473 FT_UINT8, BASE_DEC, NULL, 0x0,
6474 NULL, HFILL}
6477 { &hf_gtpv2_mm_context_ue_net_cap_len,
6478 {"Length of UE Network Capability", "gtpv2.mm_context_ue_net_cap_len",
6479 FT_UINT8, BASE_DEC, NULL, 0x0,
6480 NULL, HFILL}
6482 { &hf_gtpv2_mm_context_ms_net_cap_len,
6483 {"Length of MS Network Capability", "gtpv2.mm_context_ms_net_cap_len",
6484 FT_UINT8, BASE_DEC, NULL, 0x0,
6485 NULL, HFILL}
6487 { &hf_gtpv2_mm_context_mei_len,
6488 {"Length of Mobile Equipment Identity (MEI)", "gtpv2.mm_context_mei_len",
6489 FT_UINT8, BASE_DEC, NULL, 0x0,
6490 NULL, HFILL}
6492 { &hf_gtpv2_mm_context_vdp_len,
6493 {"Length of Voice Domain Preference and UE's Usage Setting", "gtpv2.mm_context_vdp_len",
6494 FT_UINT8, BASE_DEC, NULL, 0x0,
6495 NULL, HFILL}
6497 { &hf_gtpv2_una,
6498 { "UTRAN", "gtpv2.mm_context.una",
6499 FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x01,
6500 NULL, HFILL }
6502 { &hf_gtpv2_gena,
6503 { "GERAN", "gtpv2.mm_context.gena",
6504 FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x02,
6505 NULL, HFILL }
6507 { &hf_gtpv2_gana,
6508 { "GAN", "gtpv2.mm_context.gana",
6509 FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x04,
6510 NULL, HFILL }
6512 { &hf_gtpv2_ina,
6513 { "I-HSPA-EVOLUTION", "gtpv2.mm_context.ina",
6514 FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x08,
6515 NULL, HFILL }
6517 { &hf_gtpv2_ena,
6518 { "E-UTRAN", "gtpv2.mm_context.ena",
6519 FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x10,
6520 NULL, HFILL }
6522 { &hf_gtpv2_hnna,
6523 { "HO-toNone3GPP-Access", "gtpv2.mm_context.hnna",
6524 FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x20,
6525 NULL, HFILL }
6527 { &hf_gtpv2_mm_context_ksi,
6528 {"KSI", "gtpv2.mm_context_ksi",
6529 FT_UINT8, BASE_DEC, NULL, 0x07,
6530 NULL, HFILL}
6532 { &hf_gtpv2_mm_context_nr_qui,
6533 {"Number of Quintuplets", "gtpv2.mm_context_nr_qui",
6534 FT_UINT8, BASE_DEC, NULL, 0xe0,
6535 NULL, HFILL}
6538 { &hf_gtpv2_mm_context_nr_qua,
6539 {"Number of Quadruplet", "gtpv2.mm_context_nr_qua",
6540 FT_UINT8, BASE_DEC, NULL, 0x1c,
6541 NULL, HFILL}
6543 { &hf_gtpv2_mm_context_uamb_ri,
6544 {"UAMB RI", "gtpv2.mm_context_uamb_ri",
6545 FT_BOOLEAN, 8, NULL, 0x02,
6546 NULL, HFILL}
6548 { &hf_gtpv2_mm_context_osci,
6549 {"OSCI", "gtpv2.mm_context_osci",
6550 FT_BOOLEAN, 8, NULL, 0x02,
6551 NULL, HFILL}
6553 { &hf_gtpv2_mm_context_samb_ri,
6554 {"SAMB RI", "gtpv2.mm_context_samb_ri",
6555 FT_BOOLEAN, 8, NULL, 0x0,
6556 NULL, HFILL}
6558 { &hf_gtpv2_ue_time_zone_dst,
6559 {"Daylight Saving Time", "gtpv2.ue_time_zone_dst",
6560 FT_UINT8, BASE_DEC, VALS(gtpv2_ue_time_zone_dst_vals), 0x03,
6561 NULL, HFILL}
6563 { &hf_gtpv2_fq_csid_type,
6564 {"Node-ID Type", "gtpv2.fq_csid_type",
6565 FT_UINT8, BASE_DEC, NULL, 0xf0,
6566 NULL, HFILL}
6568 { &hf_gtpv2_fq_csid_nr,
6569 {"Number of CSIDs", "gtpv2.fq_csid_nr",
6570 FT_UINT8, BASE_DEC, NULL, 0x0f,
6571 NULL, HFILL}
6573 { &hf_gtpv2_fq_csid_ipv4,
6574 {"Node-ID (IPv4)", "gtpv2.fq_csid_ipv4",
6575 FT_IPv4, BASE_NONE, NULL, 0x0,
6576 NULL, HFILL}
6578 { &hf_gtpv2_fq_csid_ipv6,
6579 {"Node-ID (IPv6)", "gtpv2.fq_csid_ipv6",
6580 FT_IPv6, BASE_NONE, NULL, 0x0,
6581 NULL, HFILL}
6583 { &hf_gtpv2_fq_csid_id,
6584 {"CSID", "gtpv2.fq_csid_id",
6585 FT_UINT16, BASE_DEC, NULL, 0x0,
6586 NULL, HFILL}
6588 { &hf_gtpv2_complete_req_msg_type,
6589 {"Complete Request Message Type", "gtpv2.complete_req_msg_type",
6590 FT_UINT8, BASE_DEC, VALS(gtpv2_complete_req_msg_type_vals), 0x0,
6591 NULL, HFILL}
6593 {&hf_gtpv2_mme_grp_id,
6594 {"MME Group ID", "gtpv2.mme_grp_id",
6595 FT_UINT16, BASE_DEC, NULL, 0x0,
6596 NULL, HFILL}
6598 { &hf_gtpv2_mme_code,
6599 {"MME Code", "gtpv2.mme_code",
6600 FT_UINT8, BASE_DEC, NULL, 0x0,
6601 NULL, HFILL}
6603 { &hf_gtpv2_m_tmsi,
6604 {"M-TMSI", "gtpv2.m_tmsi",
6605 FT_BYTES, BASE_NONE, NULL, 0x0,
6606 NULL, HFILL}
6608 { &hf_gtpv2_container_type,
6609 {"Container Type", "gtpv2.container_type",
6610 FT_UINT8, BASE_DEC, VALS(gtpv2_container_type_vals), 0x0f,
6611 NULL, HFILL}
6613 { &hf_gtpv2_cause_type,
6614 {"Cause Type", "gtpv2.cause_type",
6615 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_type_vals_ext, 0x0f,
6616 NULL, HFILL}
6618 { &hf_gtpv2_CauseRadioNetwork,
6619 {"Radio Network Layer Cause", "gtpv2.CauseRadioNetwork",
6620 FT_UINT8, BASE_DEC, VALS(s1ap_CauseRadioNetwork_vals), 0x0,
6621 NULL, HFILL}
6623 { &hf_gtpv2_CauseTransport,
6624 {"Transport Layer Cause", "gtpv2.CauseTransport",
6625 FT_UINT8, BASE_DEC, VALS(s1ap_CauseTransport_vals), 0x0,
6626 NULL, HFILL}
6628 { &hf_gtpv2_CauseNas,
6629 {"NAS Cause", "gtpv2.CauseNas",
6630 FT_UINT8, BASE_DEC, VALS(s1ap_CauseNas_vals), 0x0,
6631 NULL, HFILL}
6633 { &hf_gtpv2_CauseMisc,
6634 {"Miscellaneous Cause", "gtpv2.CauseMisc",
6635 FT_UINT8, BASE_DEC, VALS(s1ap_CauseMisc_vals), 0x0,
6636 NULL, HFILL}
6638 { &hf_gtpv2_target_type,
6639 {"Target Type", "gtpv2.target_type",
6640 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_target_type_vals_ext, 0x0,
6641 NULL, HFILL}
6643 {&hf_gtpv2_macro_enodeb_id,
6644 {"Macro eNodeB ID", "gtpv2.macro_enodeb_id",
6645 FT_UINT24, BASE_HEX, NULL, 0x0fffff,
6646 NULL, HFILL}
6648 { &hf_gtpv2_CauseProtocol,
6649 {"Protocol Cause", "gtpv2.CauseProtocol",
6650 FT_UINT8, BASE_DEC, VALS(s1ap_CauseProtocol_vals), 0x0,
6651 NULL, HFILL}
6653 {&hf_gtpv2_apn_rest,
6654 {"APN Restriction", "gtpv2.apn_rest",
6655 FT_UINT8, BASE_DEC, NULL, 0x0,
6656 NULL, HFILL}
6658 {&hf_gtpv2_selec_mode,
6659 {"Selection Mode", "gtpv2.selec_mode",
6660 FT_UINT8, BASE_DEC, VALS(gtpv2_selec_mode_vals), 0x03,
6661 NULL, HFILL}
6663 { &hf_gtpv2_source_type,
6664 {"Source Type", "gtpv2.source_type",
6665 FT_UINT8, BASE_DEC, NULL, 0x0,
6666 NULL, HFILL}
6668 {&hf_gtpv2_bearer_control_mode,
6669 {"Bearer Control Mode", "gtpv2.bearer_control_mode",
6670 FT_UINT8, BASE_DEC, VALS(gtpv2_bearer_control_mode_vals), 0x0,
6671 NULL, HFILL}
6673 { &hf_gtpv2_cng_rep_act,
6674 {"Change Reporting Action", "gtpv2.cng_rep_act",
6675 FT_UINT8, BASE_DEC, VALS(gtpv2_cng_rep_act_vals), 0x0,
6676 NULL, HFILL}
6678 { &hf_gtpv2_node_type,
6679 {"Node Type", "gtpv2.node_type",
6680 FT_UINT8, BASE_DEC, VALS(gtpv2_node_type_vals), 0x0,
6681 NULL, HFILL}
6683 {&hf_gtpv2_fqdn,
6684 {"FQDN", "gtpv2.fqdn",
6685 FT_STRING, BASE_NONE, NULL, 0x0,
6686 NULL, HFILL}
6688 { &hf_gtpv2_enterprise_id,
6689 {"Enterprise ID", "gtpv2.enterprise_id",
6690 FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0,
6691 NULL, HFILL}
6693 { &hf_gtpv2_address_digits,
6694 { "Address digits", "gtpv2.address_digits",
6695 FT_STRING, BASE_NONE, NULL, 0,
6696 NULL, HFILL }
6698 { &hf_gtpv2_ti,
6699 {"Transaction Identifier", "gtpv2.ti",
6700 FT_BYTES, BASE_NONE, NULL, 0x0,
6701 NULL, HFILL}
6703 { &hf_gtpv2_bss_container_phx,
6704 {"PHX", "gtpv2.bss_cont.phx",
6705 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
6706 NULL, HFILL}
6708 { &hf_gtpv2_bss_con_sapi_flg,
6709 {"SAPI", "gtpv2.bss_cont.sapi_flg",
6710 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
6711 NULL, HFILL}
6713 { &hf_gtpv2_bss_con_rp_flg,
6714 {"RP", "gtpv2.bss_cont.rp_flg",
6715 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
6716 NULL, HFILL}
6718 { &hf_gtpv2_bss_con_pfi_flg,
6719 {"PFI", "gtpv2.bss_cont.pfi_flg",
6720 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
6721 NULL, HFILL}
6723 { &hf_gtpv2_bss_con_pfi,
6724 {"Packet Flow ID(PFI)", "gtpv2.bss_cont.pfi",
6725 FT_UINT8, BASE_DEC, NULL, 0x0,
6726 NULL, HFILL}
6728 { &hf_gtpv2_bss_con_rp,
6729 {"Radio Priority(RP)", "gtpv2.bss_cont.rp",
6730 FT_UINT8, BASE_DEC, NULL, 0x07,
6731 NULL, HFILL}
6733 { &hf_gtpv2_bss_con_sapi,
6734 {"SAPI", "gtpv2.bss_cont.sapi",
6735 FT_UINT8, BASE_DEC, NULL, 0xf0,
6736 NULL, HFILL}
6738 { &hf_gtpv2_bss_con_xid_len,
6739 {"XiD parameters length", "gtpv2.bss_cont.xid_len",
6740 FT_UINT8, BASE_DEC, NULL, 0x0,
6741 NULL, HFILL}
6743 { &hf_gtpv2_bss_con_xid,
6744 {"XiD parameters", "gtpv2.bss_cont.xid",
6745 FT_BYTES, BASE_NONE, NULL, 0x0,
6746 NULL, HFILL}
6748 { &hf_gtpv2_home_enodeb_id,
6749 {"Home eNodeB ID", "gtpv2.home_enodeb_id",
6750 FT_UINT32, BASE_HEX, NULL, 0x0fffffff,
6751 NULL, HFILL}
6753 { &hf_gtpv2_tac,
6754 {"Tracking Area Code (TAC)", "gtpv2.tac",
6755 FT_UINT16, BASE_DEC, NULL, 0x0,
6756 NULL, HFILL}
6758 { &hf_gtpv2_mbms_service_area_nr,
6759 {"Number of MBMS Service Area codes", "gtpv2.mbms_service_area_nr",
6760 FT_UINT16, BASE_DEC, NULL, 0x0,
6761 NULL, HFILL}
6763 { &hf_gtpv2_mbms_service_area_id,
6764 {"MBMS Service Area code (Service Area Identity)", "gtpv2.mbms_service_area_id",
6765 FT_UINT16, BASE_DEC, NULL, 0x0,
6766 NULL, HFILL}
6768 { &hf_gtpv2_mbms_session_id,
6769 {"MBMS Session Identifier", "gtpv2.mbms_session_id",
6770 FT_BYTES, BASE_NONE, NULL, 0x0,
6771 NULL, HFILL}
6773 { &hf_gtpv2_mbms_flow_id,
6774 {"MBMS Flow Identifier", "gtpv2.mbms_flow_id",
6775 FT_BYTES, BASE_NONE, NULL, 0x0,
6776 NULL, HFILL}
6778 { &hf_gtpv2_cteid,
6779 {"Common Tunnel Endpoint Identifier", "gtpv2.cetid",
6780 FT_UINT32, BASE_DEC, NULL, 0x0,
6781 NULL, HFILL}
6783 { &hf_gtpv2_ip_addr_type,
6784 {"IP Address Type", "gtpv2.ip_addr_type",
6785 FT_UINT8, BASE_DEC, NULL, 0xc0,
6786 NULL, HFILL}
6788 { &hf_gtpv2_ip_addr_len,
6789 {"IP Address Length", "gtpv2.ip_addr_len",
6790 FT_UINT8, BASE_DEC, NULL, 0x3f,
6791 NULL, HFILL}
6793 { &hf_gtpv2_mbms_ip_mc_dist_addrv4,
6794 {"MBMS IP Multicast Distribution Address (IPv4)", "gtpv2.mbms_ip_mc_dist_addrv4",
6795 FT_IPv4, BASE_NONE, NULL, 0x0,
6796 NULL, HFILL}
6798 { &hf_gtpv2_mbms_ip_mc_dist_addrv6,
6799 {"MBMS IP Multicast Distribution Address (IPv6)", "gtpv2.mbms_ip_mc_dist_addrv6",
6800 FT_IPv6, BASE_NONE, NULL, 0x0,
6801 NULL, HFILL}
6803 { &hf_gtpv2_mbms_ip_mc_src_addrv4,
6804 {"MBMS IP Multicast Source Address (IPv4)", "gtpv2.mbms_ip_mc_src_addrv4",
6805 FT_IPv4, BASE_NONE, NULL, 0x0,
6806 NULL, HFILL}
6808 { &hf_gtpv2_mbms_ip_mc_src_addrv6,
6809 {"MBMS IP Multicast Source Address (IPv6)", "gtpv2.mbms_ip_mc_src_addrv6",
6810 FT_IPv6, BASE_NONE, NULL, 0x0,
6811 NULL, HFILL}
6813 { &hf_gtpv2_mbms_hc_indicator,
6814 {"MBMS HC Indicator", "gtpv2.mbms_hc_indicator",
6815 FT_UINT8, BASE_DEC, VALS(gtpv2_mbms_hc_indicator_vals), 0x0,
6816 NULL, HFILL}
6818 { &hf_gtpv2_mbms_dist_indication,
6819 {"MBMS Distribution Indication", "gtpv2.mbms_dist_indication",
6820 FT_UINT8, BASE_DEC, VALS(gtpv2_mbms_dist_indication_vals), 0x03,
6821 NULL, HFILL}
6823 { &hf_gtpv2_subscriber_rfsp,
6824 {"Subscribed RFSP Index", "gtpv2.subscriber_rfsp",
6825 FT_INT16, BASE_DEC, NULL, 0x0,
6826 NULL, HFILL}
6828 { &hf_gtpv2_rfsp_inuse,
6829 {"RFSP Index in Use", "gtpv2.rfsp_inuse",
6830 FT_INT16, BASE_DEC, NULL, 0x0,
6831 NULL, HFILL}
6833 { &hf_gtpv2_mbms_service_id,
6834 {"MBMS Service ID", "gtpv2.mbms_service_id",
6835 FT_BYTES, BASE_NONE, NULL, 0x0,
6836 NULL, HFILL}
6838 { &hf_gtpv2_add_flags_for_srvcc_ics,
6839 {"ICS (IMS Centralized Service)", "gtpv2.add_flags_for_srvcc_ics",
6840 FT_BOOLEAN, 8, NULL, 0x01,
6841 NULL, HFILL}
6843 { &hf_gtpv2_vsrvcc_flag,
6844 {"VF (vSRVCC Flag)", "gtpv2.vsrvcc_flag",
6845 FT_BOOLEAN, 8, NULL, 0x02,
6846 NULL, HFILL}
6848 { &hf_gtpv2_henb_info_report_fti,
6849 {"FTI", "gtpv2.henb_info_report_fti",
6850 FT_BOOLEAN, 8, TFS(&gtpv2_henb_info_report_fti_vals), 0x01,
6851 NULL, HFILL}
6853 { &hf_gtpv2_ip4cp_subnet_prefix_len,
6854 {"Subnet Prefix Length", "gtpv2.ip4cp_subnet_prefix_len",
6855 FT_UINT8, BASE_DEC, NULL, 0x0,
6856 NULL, HFILL}
6858 { &hf_gtpv2_ip4cp_ipv4,
6859 {"IPv4 Default Router Address", "gtpv2.ip4cp_ipv4",
6860 FT_IPv4, BASE_NONE, NULL, 0x0,
6861 NULL, HFILL}
6863 { &hf_gtpv2_change_report_flags_sncr,
6864 {"SNCR (Service Network Change to Report)", "gtpv2.change_report_flags_sncr",
6865 FT_BOOLEAN, 8, NULL, 0x01,
6866 NULL, HFILL}
6868 { &hf_gtpv2_change_report_flags_tzcr,
6869 {"TZCR (Time Zone Change to Report)", "gtpv2.change_report_flags_tzcr",
6870 FT_BOOLEAN, 8, NULL, 0x02,
6871 NULL, HFILL}
6873 {&hf_gtpv2_action_indication_val,
6874 {"Action Indication", "gtpv2.action_indication_val",
6875 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_action_indication_vals_ext, 0x07,
6876 NULL , HFILL}
6878 { &hf_gtpv2_abs_time_mbms_data,
6879 {"Absolute Time of MBMS Data Transfer", "gtpv2.abs_time_mbms_data",
6880 FT_STRING, BASE_NONE, NULL, 0,
6881 NULL, HFILL}
6883 { &hf_gtpv2_mbms_session_duration_days,
6884 {"MBMS Session Duration (days)", "gtpv2.mbms_session_duration_days",
6885 FT_UINT24, BASE_DEC, NULL, 0x00007F,
6886 NULL, HFILL}
6888 { &hf_gtpv2_mbms_session_duration_secs,
6889 {"MBMS Session Duration (seconds)", "gtpv2.mbms_session_duration_secs",
6890 FT_UINT24, BASE_DEC, NULL, 0xFFFF80,
6891 NULL, HFILL}
6893 { &hf_gtpv2_node_features_prn,
6894 {"PGW Restart Notification (PRN)", "gtpv2.node_features_prn",
6895 FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x01,
6896 NULL, HFILL}
6898 { &hf_gtpv2_node_features_mabr,
6899 {"Modify Access Bearers Request (MABR)", "gtpv2.node_features_mabr",
6900 FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x02,
6901 NULL, HFILL}
6903 { &hf_gtpv2_node_features_ntsr,
6904 {"Network Triggered Service Restoration (NTSR)", "gtpv2.node_features_ntsr",
6905 FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x04,
6906 NULL, HFILL}
6908 { &hf_gtpv2_time_to_data_xfer,
6909 {"MBMS Time to Data Transfer", "gtpv2.time_to_data_xfer",
6910 FT_STRING, BASE_NONE, NULL, 0,
6911 NULL, HFILL}
6913 { &hf_gtpv2_arp_pvi,
6914 {"Pre-emption Vulnerability (PVI)", "gtpv2.arp_pvi",
6915 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
6916 NULL, HFILL}
6918 { &hf_gtpv2_arp_pl,
6919 {"Priority Level", "gtpv2.arp_pl",
6920 FT_UINT8, BASE_DEC, NULL, 0x3c,
6921 NULL, HFILL}
6923 { &hf_gtpv2_arp_pci,
6924 {"Pre-emption Capability (PCI)", "gtpv2.arp_pci",
6925 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
6926 NULL, HFILL}
6928 { &hf_gtpv2_timer_unit,
6929 {"Timer unit", "gtpv2.timer_unit",
6930 FT_UINT8, BASE_DEC, VALS(gtpv2_timer_unit_vals), 0xe0,
6931 NULL, HFILL}
6933 { &hf_gtpv2_timer_value,
6934 {"Timer value", "gtpv2.timer_value",
6935 FT_UINT8, BASE_DEC, NULL, 0x1f,
6936 NULL, HFILL}
6938 { &hf_gtpv2_lapi,
6939 {"LAPI (Low Access Priority Indication)", "gtpv2.lapi",
6940 FT_BOOLEAN, 8, NULL, 0x01,
6941 NULL, HFILL}
6943 { &hf_gtpv2_mm_context_higher_br_16mb_flg_len,
6944 {"Length of Higher bitrates than 16 Mbps flag", "gtpv2.mm_context_higher_br_16mb_flg_len",
6945 FT_UINT8, BASE_DEC, NULL, 0x0,
6946 NULL, HFILL}
6948 { &hf_gtpv2_mm_context_higher_br_16mb_flg,
6949 {"Higher bitrates than 16 Mbps flag", "gtpv2.mm_context_higher_br_16mb_flg",
6950 FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_higher_br_16mb_flg_vals), 0x0,
6951 NULL, HFILL}
6953 { &hf_gtpv2_mmbr_ul,
6954 {"Max MBR/APN-AMBR for uplink", "gtpv2.mmbr_ul",
6955 FT_UINT32, BASE_DEC, NULL, 0x0,
6956 NULL, HFILL}
6958 { &hf_gtpv2_mmbr_dl,
6959 {"Max MBR/APN-AMBR for downlink", "gtpv2.mmbr_dl",
6960 FT_UINT32, BASE_DEC, NULL, 0x0,
6961 NULL, HFILL}
6965 static gint *ett_gtpv2_array[] = {
6966 &ett_gtpv2,
6967 &ett_gtpv2_flags,
6968 &ett_gtpv2_ie,
6969 &ett_gtpv2_uli_flags,
6970 &ett_gtpv2_uli_field,
6971 &ett_gtpv2_bearer_ctx,
6972 &ett_gtpv2_PDN_conn,
6973 &ett_gtpv2_mm_context_flag,
6974 &ett_gtpv2_pdn_numbers_nsapi,
6975 &ett_gtpv2_tra_info_trigg,
6976 &ett_gtpv2_tra_info_trigg_msc_server,
6977 &ett_gtpv2_tra_info_trigg_mgw,
6978 &ett_gtpv2_tra_info_trigg_sgsn,
6979 &ett_gtpv2_tra_info_trigg_ggsn,
6980 &ett_gtpv2_tra_info_trigg_bm_sc,
6981 &ett_gtpv2_tra_info_trigg_sgw_mme,
6982 &ett_gtpv2_tra_info_interfaces,
6983 &ett_gtpv2_tra_info_interfaces_imsc_server,
6984 &ett_gtpv2_tra_info_interfaces_lmgw,
6985 &ett_gtpv2_tra_info_interfaces_lsgsn,
6986 &ett_gtpv2_tra_info_interfaces_lggsn,
6987 &ett_gtpv2_tra_info_interfaces_lrnc,
6988 &ett_gtpv2_tra_info_interfaces_lbm_sc,
6989 &ett_gtpv2_tra_info_interfaces_lmme,
6990 &ett_gtpv2_tra_info_interfaces_lsgw,
6991 &ett_gtpv2_tra_info_interfaces_lpdn_gw,
6992 &ett_gtpv2_tra_info_interfaces_lpdn_lenb,
6993 &ett_gtpv2_tra_info_ne_types,
6994 &ett_gtpv2_rai,
6995 &ett_gtpv2_stn_sr,
6996 &ett_gtpv2_ms_mark,
6997 &ett_gtpv2_supp_codec_list,
6998 &ett_gtpv2_bss_con,
6999 &ett_gtpv2_mm_context_auth_qua,
7000 &ett_gtpv2_mm_context_auth_qui,
7001 &ett_gtpv2_mm_context_auth_tri,
7002 &ett_gtpv2_mm_context_net_cap,
7003 &ett_gtpv2_ms_network_capability,
7004 &ett_gtpv2_vd_pref,
7005 &ett_gtpv2_access_rest_data,
7006 &ett_gtpv2_qua,
7007 &ett_gtpv2_qui,
7010 static ei_register_info ei[] = {
7011 { &ei_gtpv2_ie_data_not_dissected, { "gtpv2.ie_data_not_dissected", PI_PROTOCOL, PI_NOTE, "IE data not dissected yet", EXPFILL }},
7012 { &ei_gtpv2_ie_len_invalid, { "gtpv2.ie_len_invalid", PI_PROTOCOL, PI_ERROR, "Wrong length", EXPFILL }},
7013 { &ei_gtpv2_source_type_unknown, { "gtpv2.source_type.unknown", PI_PROTOCOL, PI_ERROR, "Unknown source type", EXPFILL }},
7014 { &ei_gtpv2_fq_csid_type_bad, { "gtpv2.fq_csid_type.unknown", PI_PROTOCOL, PI_ERROR, "Wrong Node-ID Type", EXPFILL }},
7017 expert_module_t* expert_gtpv2;
7019 proto_gtpv2 = proto_register_protocol("GPRS Tunneling Protocol V2", "GTPv2", "gtpv2");
7020 proto_register_field_array(proto_gtpv2, hf_gtpv2, array_length(hf_gtpv2));
7021 proto_register_subtree_array(ett_gtpv2_array, array_length(ett_gtpv2_array));
7022 expert_gtpv2 = expert_register_protocol(proto_gtpv2);
7023 expert_register_field_array(expert_gtpv2, ei, array_length(ei));
7025 /* AVP Code: 22 3GPP-User-Location-Info */
7026 dissector_add_uint("diameter.3gpp", 22, new_create_dissector_handle(dissect_diameter_3gpp_uli, proto_gtpv2));
7028 register_dissector("gtpv2", dissect_gtpv2, proto_gtpv2);
7029 /* Dissector table for private extensions */
7030 gtpv2_priv_ext_dissector_table = register_dissector_table("gtpv2.priv_ext", "GTPv2 PRIVATE EXT", FT_UINT16, BASE_DEC);
7033 void
7034 proto_reg_handoff_gtpv2(void)
7036 nas_eps_handle = find_dissector("nas-eps");
7040 * Editor modelines
7042 * Local Variables:
7043 * c-basic-offset: 4
7044 * tab-width: 8
7045 * indent-tabs-mode: nil
7046 * End:
7048 * ex: set shiftwidth=4 tabstop=8 expandtab:
7049 * :indentSize=4:tabSize=8:noTabs=true: