/epan/dissectors/packet-gtpv2.c

https://bitbucket.org/stevexiao/wireshark · C · 4504 lines · 3453 code · 379 blank · 672 comment · 58 complexity · f9a378f893bdf921e74fb028818d20aa MD5 · raw file

  1. /* packet-gtpv2.c
  2. *
  3. * Routines for GTPv2 dissection
  4. * Copyright 2009 - 2011, Anders Broman <anders.broman [at] ericcsson.com>
  5. *
  6. * $Id: packet-gtpv2.c 38852 2011-09-01 23:27:28Z gerald $
  7. *
  8. * Wireshark - Network traffic analyzer
  9. * By Gerald Combs <gerald@wireshark.org>
  10. * Copyright 1998 Gerald Combs
  11. *
  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.
  16. *
  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.
  21. *
  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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  25. * Ref: 3GPP TS 29.274 version 8.1.1 Release 8 ETSI TS 129 274 V8.1.1 (2009-04)
  26. */
  27. #ifdef HAVE_CONFIG_H
  28. # include "config.h"
  29. #endif
  30. #include <stdlib.h>
  31. #include <glib.h>
  32. #include <epan/packet.h>
  33. #include <epan/asn1.h>
  34. #include <epan/expert.h>
  35. #include <epan/sminmpec.h>
  36. #include "packet-gsm_a_common.h"
  37. #include "packet-gsm_map.h"
  38. #include "packet-e164.h"
  39. #include "packet-e212.h"
  40. #include "packet-s1ap.h"
  41. #include "packet-ranap.h"
  42. static dissector_handle_t nas_eps_handle;
  43. /*GTPv2 Message->GTP Header(SB)*/
  44. static int proto_gtpv2 = -1;
  45. static int hf_gtpv2_reserved = -1;
  46. static int hf_gtpv2_spare_half_octet = -1;
  47. static int hf_gtpv2_spare_bits = -1;
  48. static int hf_gtpv2_flags = -1;
  49. static int hf_gtpv2_version = -1;
  50. static int hf_gtpv2_p = -1;
  51. static int hf_gtpv2_t = -1;
  52. static int hf_gtpv2_message_type = -1;
  53. static int hf_gtpv2_msg_length = -1;
  54. static int hf_gtpv2_teid = -1;
  55. static int hf_gtpv2_seq = -1;
  56. static int hf_gtpv2_spare = -1;
  57. static int hf_gtpv2_ie = -1;
  58. static int hf_gtpv2_ie_len = -1;
  59. static int hf_gtpv2_cr = -1;
  60. static int hf_gtpv2_instance = -1;
  61. static int hf_gtpv2_cause = -1;
  62. static int hf_gtpv2_cause_cs = -1;
  63. static int hf_gtpv2_cause_bce = -1;
  64. static int hf_gtpv2_cause_pce = -1;
  65. static int hf_gtpv2_cause_off_ie_t = -1;
  66. static int hf_gtpv2_rec = -1;
  67. static int hf_gtpv2_apn = -1;
  68. static int hf_gtpv2_ebi = -1;
  69. static int hf_gtpv2_daf = -1;
  70. static int hf_gtpv2_dtf = -1;
  71. static int hf_gtpv2_hi = -1;
  72. static int hf_gtpv2_dfi = -1;
  73. static int hf_gtpv2_oi = -1;
  74. static int hf_gtpv2_isrsi = -1;
  75. static int hf_gtpv2_israi = -1;
  76. static int hf_gtpv2_sgwci = -1;
  77. static int hf_gtpv2_sqci = -1;
  78. static int hf_gtpv2_uimsi = -1;
  79. static int hf_gtpv2_cfsi = -1;
  80. static int hf_gtpv2_crsi = -1;
  81. static int hf_gtpv2_pt = -1;
  82. static int hf_gtpv2_ps = -1;
  83. static int hf_gtpv2_si = -1;
  84. static int hf_gtpv2_msv = -1;
  85. static int hf_gtpv2_ccrsi = -1;
  86. static int hf_gtpv2_pdn_type = -1;
  87. static int hf_gtpv2_pdn_ipv4 = -1;
  88. static int hf_gtpv2_pdn_ipv6_len = -1;
  89. static int hf_gtpv2_pdn_ipv6 = -1;
  90. static int hf_gtpv2_pdn_numbers_nsapi = -1;
  91. static int hf_gtpv2_p_tmsi = -1;
  92. static int hf_gtpv2_p_tmsi_sig = -1;
  93. static int hf_gtpv2_rat_type = -1;
  94. static int hf_gtpv2_uli_ecgi_flg = -1;
  95. static int hf_gtpv2_uli_lai_flg = -1;
  96. static int hf_gtpv2_uli_tai_flg = -1;
  97. static int hf_gtpv2_uli_rai_flg = -1;
  98. static int hf_gtpv2_uli_sai_flg = -1;
  99. static int hf_gtpv2_uli_cgi_flg = -1;
  100. static int hf_gtpv2_cng_rep_act = -1;
  101. static int hf_gtpv2_selec_mode = -1;
  102. static int hf_gtpv2_source_type = -1;
  103. static int hf_gtpv2_f_teid_v4 = -1;
  104. static int hf_gtpv2_f_teid_v6 = -1;
  105. static int hf_gtpv2_f_teid_interface_type= -1;
  106. static int hf_gtpv2_f_teid_gre_key= -1;
  107. static int hf_gtpv2_f_teid_ipv4= -1;
  108. static int hf_gtpv2_f_teid_ipv6= -1;
  109. static int hf_gtpv2_tmsi = -1;
  110. static int hf_gtpv2_hsgw_addr_f_len = -1;
  111. static int hf_gtpv2_hsgw_addr_ipv4 = -1;
  112. static int hf_gtpv2_hsgw_addr_ipv6 = -1;
  113. static int hf_gtpv2_gre_key = -1;
  114. static int hf_gtpv2_sgw_addr_ipv4 = -1;
  115. static int hf_gtpv2_sgw_addr_ipv6 = -1;
  116. static int hf_gtpv2_sgw_s1u_teid = -1;
  117. static int hf_gtpv2_imsi= -1;
  118. static int hf_gtpv2_ipv4_addr = -1;
  119. static int hf_gtpv2_ambr_up= -1;
  120. static int hf_gtpv2_ambr_down= -1;
  121. static int hf_gtpv2_ip_address_ipv4= -1;
  122. static int hf_gtpv2_ip_address_ipv6= -1;
  123. static int hf_gtpv2_mei= -1;
  124. /* Trace Information */
  125. static int hf_gtpv2_tra_info = -1;
  126. static int hf_gtpv2_tra_info_msc_momt_calls = -1;
  127. static int hf_gtpv2_tra_info_msc_momt_sms = -1;
  128. static int hf_gtpv2_tra_info_msc_lu_imsi_ad = -1;
  129. static int hf_gtpv2_tra_info_msc_handovers = -1;
  130. static int hf_gtpv2_tra_info_msc_ss = -1;
  131. static int hf_gtpv2_tra_info_mgw_context = -1;
  132. static int hf_gtpv2_tra_info_sgsn_pdp_context = -1;
  133. static int hf_gtpv2_tra_info_sgsn_momt_sms = -1;
  134. static int hf_gtpv2_tra_info_sgsn_rau_gprs_ad = -1;
  135. static int hf_gtpv2_tra_info_sgsn_mbms = -1;
  136. static int hf_gtpv2_tra_info_sgsn_reserved = -1;
  137. static int hf_gtpv2_tra_info_ggsn_pdp = -1;
  138. static int hf_gtpv2_tra_info_ggsn_mbms = -1;
  139. static int hf_gtpv2_tra_info_bm_sc = -1;
  140. static int hf_gtpv2_tra_info_mme_sgw_ss = -1;
  141. static int hf_gtpv2_tra_info_mme_sgw_sr = -1;
  142. static int hf_gtpv2_tra_info_mme_sgw_iataud = -1;
  143. static int hf_gtpv2_tra_info_lne_msc_s = -1;
  144. static int hf_gtpv2_tra_info_lne_mgw = -1;
  145. static int hf_gtpv2_tra_info_lne_sgsn = -1;
  146. static int hf_gtpv2_tra_info_lne_ggsn = -1;
  147. static int hf_gtpv2_tra_info_lne_rnc = -1;
  148. static int hf_gtpv2_tra_info_lne_bm_sc = -1;
  149. static int hf_gtpv2_tra_info_lne_mme = -1;
  150. static int hf_gtpv2_tra_info_lne_sgw = -1;
  151. static int hf_gtpv2_tra_info_lne_pdn_gw = -1;
  152. static int hf_gtpv2_tra_info_lne_enb = -1;
  153. static int hf_gtpv2_tra_info_tdl = -1;
  154. static int hf_gtpv2_tra_info_lmsc_a = -1;
  155. static int hf_gtpv2_tra_info_lmsc_lu = -1;
  156. static int hf_gtpv2_tra_info_lmsc_mc = -1;
  157. static int hf_gtpv2_tra_info_lmsc_map_g = -1;
  158. static int hf_gtpv2_tra_info_lmsc_map_b = -1;
  159. static int hf_gtpv2_tra_info_lmsc_map_e = -1;
  160. static int hf_gtpv2_tra_info_lmsc_map_f = -1;
  161. static int hf_gtpv2_tra_info_lmsc_cap = -1;
  162. static int hf_gtpv2_tra_info_lmsc_map_d = -1;
  163. static int hf_gtpv2_tra_info_lmsc_map_c = -1;
  164. static int hf_gtpv2_tra_info_lmgw_mc = -1;
  165. static int hf_gtpv2_tra_info_lmgw_nb_up = -1;
  166. static int hf_gtpv2_tra_info_lmgw_lu_up = -1;
  167. static int hf_gtpv2_tra_info_lsgsn_gb = -1;
  168. static int hf_gtpv2_tra_info_lsgsn_lu = -1;
  169. static int hf_gtpv2_tra_info_lsgsn_gn = -1;
  170. static int hf_gtpv2_tra_info_lsgsn_map_gr = -1;
  171. static int hf_gtpv2_tra_info_lsgsn_map_gd = -1;
  172. static int hf_gtpv2_tra_info_lsgsn_map_gf = -1;
  173. static int hf_gtpv2_tra_info_lsgsn_gs = -1;
  174. static int hf_gtpv2_tra_info_lsgsn_ge = -1;
  175. static int hf_gtpv2_tra_info_lggsn_gn = -1;
  176. static int hf_gtpv2_tra_info_lggsn_gi = -1;
  177. static int hf_gtpv2_tra_info_lggsn_gmb = -1;
  178. static int hf_gtpv2_tra_info_lrnc_lu = -1;
  179. static int hf_gtpv2_tra_info_lrnc_lur = -1;
  180. static int hf_gtpv2_tra_info_lrnc_lub = -1;
  181. static int hf_gtpv2_tra_info_lrnc_uu = -1;
  182. static int hf_gtpv2_tra_info_lbm_sc_gmb = -1;
  183. static int hf_gtpv2_tra_info_lmme_s1_mme = -1;
  184. static int hf_gtpv2_tra_info_lmme_s3 = -1;
  185. static int hf_gtpv2_tra_info_lmme_s6a = -1;
  186. static int hf_gtpv2_tra_info_lmme_s10 = -1;
  187. static int hf_gtpv2_tra_info_lmme_s11 = -1;
  188. static int hf_gtpv2_tra_info_lsgw_s4 = -1;
  189. static int hf_gtpv2_tra_info_lsgw_s5 = -1;
  190. static int hf_gtpv2_tra_info_lsgw_s8b = -1;
  191. static int hf_gtpv2_tra_info_lsgw_s11 = -1;
  192. static int hf_gtpv2_tra_info_lpdn_gw_s2a = -1;
  193. static int hf_gtpv2_tra_info_lpdn_gw_s2b = -1;
  194. static int hf_gtpv2_tra_info_lpdn_gw_s2c = -1;
  195. static int hf_gtpv2_tra_info_lpdn_gw_s5 = -1;
  196. static int hf_gtpv2_tra_info_lpdn_gw_s6c = -1;
  197. static int hf_gtpv2_tra_info_lpdn_gw_gx = -1;
  198. static int hf_gtpv2_tra_info_lpdn_gw_s8b = -1;
  199. static int hf_gtpv2_tra_info_lpdn_gw_sgi = -1;
  200. static int hf_gtpv2_tra_info_lenb_s1_mme = -1;
  201. static int hf_gtpv2_tra_info_lenb_x2 = -1;
  202. static int hf_gtpv2_tra_info_lenb_uu = -1;
  203. static int hf_gtpv2_address_digits = -1;
  204. static int hf_gtpv2_ti = -1;
  205. static int hf_gtpv2_bearer_qos_pvi= -1;
  206. static int hf_gtpv2_bearer_qos_pl= -1;
  207. static int hf_gtpv2_bearer_qos_pci= -1;
  208. static int hf_gtpv2_bearer_qos_label_qci = -1;
  209. static int hf_gtpv2_bearer_qos_mbr_up = -1;
  210. static int hf_gtpv2_bearer_qos_mbr_down = -1;
  211. static int hf_gtpv2_bearer_qos_gbr_up = -1;
  212. static int hf_gtpv2_bearer_qos_gbr_down = -1;
  213. static int hf_gtpv2_flow_qos_label_qci = -1;
  214. static int hf_gtpv2_flow_qos_mbr_up = -1;
  215. static int hf_gtpv2_flow_qos_mbr_down = -1;
  216. static int hf_gtpv2_flow_qos_gbr_up = -1;
  217. static int hf_gtpv2_flow_qos_gbr_down = -1;
  218. static int hf_gtpv2_delay_value = -1;
  219. static int hf_gtpv2_charging_id = -1;
  220. static int hf_gtpv2_charging_characteristic = -1;
  221. static int hf_gtpv2_bearer_flag_ppc = -1;
  222. static int hf_gtpv2_bearer_flag_vb = -1;
  223. static int hf_gtpv2_ue_time_zone_dst = -1;
  224. static int hf_gtpv2_fq_csid_type = -1;
  225. static int hf_gtpv2_fq_csid_nr = -1;
  226. static int hf_gtpv2_fq_csid_ipv4 = -1;
  227. static int hf_gtpv2_fq_csid_ipv6 = -1;
  228. static int hf_gtpv2_fq_csid_id = -1;
  229. static int hf_gtpv2_complete_req_msg_type = -1;
  230. static int hf_gtpv2_mme_grp_id = -1;
  231. static int hf_gtpv2_mme_code = -1;
  232. static int hf_gtpv2_m_tmsi = -1;
  233. static int hf_gtpv2_container_type = -1;
  234. static int hf_gtpv2_cause_type = -1;
  235. static int hf_gtpv2_CauseRadioNetwork = -1;
  236. static int hf_gtpv2_CauseTransport = -1;
  237. static int hf_gtpv2_CauseNas = -1;
  238. static int hf_gtpv2_CauseProtocol = -1;
  239. static int hf_gtpv2_CauseMisc = -1;
  240. static int hf_gtpv2_target_type = -1;
  241. static int hf_gtpv2_macro_enodeb_id = -1;
  242. static int hf_gtpv2_node_type= -1;
  243. static int hf_gtpv2_fqdn = -1;
  244. static int hf_gtpv2_enterprise_id = -1;
  245. static int hf_gtpv2_apn_rest= -1;
  246. static int hf_gtpv2_pti= -1;
  247. static int hf_gtpv2_mm_context_sm = -1;
  248. static int hf_gtpv2_mm_context_nhi = -1;
  249. static int hf_gtpv2_mm_context_drxi = -1;
  250. static int hf_gtpv2_mm_context_cksn = -1;
  251. static int hf_gtpv2_mm_context_cksn_ksi = -1;
  252. static int hf_gtpv2_mm_context_ksi_a= -1;
  253. static int hf_gtpv2_mm_context_ksi = -1;
  254. static int hf_gtpv2_mm_context_nr_tri = -1;
  255. static int hf_gtpv2_mm_context_nr_qui = -1;
  256. static int hf_gtpv2_mm_context_nr_qua = -1;
  257. static int hf_gtpv2_mm_context_unipa = -1;
  258. static int hf_gtpv2_mm_context_unc = -1;
  259. static int hf_gtpv2_mm_context_nas_dl_cnt = -1;
  260. static int hf_gtpv2_mm_context_nas_ul_cnt = -1;
  261. static int hf_gtpv2_uli_cgi_lac= -1;
  262. static int hf_gtpv2_uli_cgi_ci= -1;
  263. static int hf_gtpv2_uli_sai_lac= -1;
  264. static int hf_gtpv2_uli_sai_sac= -1;
  265. static int hf_gtpv2_uli_rai_lac= -1;
  266. static int hf_gtpv2_uli_rai_rac= -1;
  267. static int hf_gtpv2_uli_tai_tac= -1;
  268. static int hf_gtpv2_uli_ecgi_eci= -1;
  269. static int hf_gtpv2_uli_lai_lac = -1;
  270. static int hf_gtpv2_uli_ecgi_eci_spare= -1;
  271. static int hf_gtpv2_nsapi = -1;
  272. static int hf_gtpv2_bearer_control_mode= -1;
  273. static gint ett_gtpv2 = -1;
  274. static gint ett_gtpv2_flags = -1;
  275. static gint ett_gtpv2_ie = -1;
  276. static gint ett_gtpv2_uli_flags = -1;
  277. static gint ett_gtpv2_uli_field = -1;
  278. static gint ett_gtpv2_bearer_ctx = -1;
  279. static gint ett_gtpv2_PDN_conn = -1;
  280. static gint ett_gtpv2_mm_context_flag = -1;
  281. static gint ett_gtpv2_pdn_numbers_nsapi = -1;
  282. static gint ett_gtpv2_tra_info_trigg = -1;
  283. static gint ett_gtpv2_tra_info_trigg_msc_server = -1;
  284. static gint ett_gtpv2_tra_info_trigg_mgw = -1;
  285. static gint ett_gtpv2_tra_info_trigg_sgsn = -1;
  286. static gint ett_gtpv2_tra_info_trigg_ggsn = -1;
  287. static gint ett_gtpv2_tra_info_trigg_bm_sc = -1;
  288. static gint ett_gtpv2_tra_info_trigg_sgw_mme = -1;
  289. static gint ett_gtpv2_tra_info_interfaces = -1;
  290. static gint ett_gtpv2_tra_info_interfaces_imsc_server = -1;
  291. static gint ett_gtpv2_tra_info_interfaces_lmgw = -1;
  292. static gint ett_gtpv2_tra_info_interfaces_lsgsn = -1;
  293. static gint ett_gtpv2_tra_info_interfaces_lggsn = -1;
  294. static gint ett_gtpv2_tra_info_interfaces_lrnc = -1;
  295. static gint ett_gtpv2_tra_info_interfaces_lbm_sc = -1;
  296. static gint ett_gtpv2_tra_info_interfaces_lmme = -1;
  297. static gint ett_gtpv2_tra_info_interfaces_lsgw = -1;
  298. static gint ett_gtpv2_tra_info_interfaces_lpdn_gw = -1;
  299. static gint ett_gtpv2_tra_info_interfaces_lpdn_lenb = -1;
  300. static gint ett_gtpv2_tra_info_ne_types = -1;
  301. /* Definition of User Location Info (AVP 22) masks */
  302. #define GTPv2_ULI_CGI_MASK 0x01
  303. #define GTPv2_ULI_SAI_MASK 0x02
  304. #define GTPv2_ULI_RAI_MASK 0x04
  305. #define GTPv2_ULI_TAI_MASK 0x08
  306. #define GTPv2_ULI_ECGI_MASK 0x10
  307. #define GTPv2_ULI_LAI_MASK 0x20
  308. #define GTPV2_CREATE_SESSION_REQUEST 32
  309. #define GTPV2_CREATE_SESSION_RESPONSE 33
  310. #define GTPV2_FORWARD_RELOCATION_REQ 133
  311. #define GTPV2_FORWARD_CTX_NOTIFICATION 137
  312. static void dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, gint offset, guint8 message_type);
  313. /*Message Types for GTPv2 (Refer Pg19 29.274) (SB)*/
  314. static const value_string gtpv2_message_type_vals[] = {
  315. {0, "Reserved"},
  316. {1, "Echo Request"},
  317. {2, "Echo Response"},
  318. {3, "Version Not Supported Indication"},
  319. /* 4-24 Reserved for S101 interface TS 29.276 */
  320. /* 25-31 Reserved for Sv interface TS 29.280 */
  321. /* SGSN/MME to PGW (S4/S11, S5/S8) */
  322. {32, "Create Session Request"},
  323. {33, "Create Session Response"},
  324. {34, "Modify Bearer Request"},
  325. {35, "Modify Bearer Response"},
  326. {36, "Delete Session Request"},
  327. {37, "Delete Session Response"},
  328. /* SGSN to PGW (S4, S5/S8) */
  329. {38, "Change Notification Request"},
  330. {39, "Change Notification Response"},
  331. /* 40-63 For future use */
  332. /* Messages without explicit response */
  333. {64, "Modify Bearer Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */
  334. {65, "Modify Bearer Failure Indication"}, /*(PGW to MME/SGSN -S5/S8, S11/S4) */
  335. {66, "Delete Bearer Command"}, /* (MME to PGW -S11, S5/S8) */
  336. {67, "Delete Bearer Failure Indication"}, /* (PGW to MME -S5/S8, S11) */
  337. {68, "Bearer Resource Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */
  338. {69, "Bearer Resource Failure Indication"}, /* (PGW to MME/SGSN -S5/S8, S11/S4) */
  339. {70, "Downlink Data Notification Failure Indication"}, /*(SGSN/MME to SGW -S4/S11) */
  340. {71, "Trace Session Activation"},
  341. {72, "Trace Session Deactivation"},
  342. {73, "Stop Paging Indication"},
  343. /* 74-94 For future use */
  344. /* PDN-GW to SGSN/MME (S5/S8, S4/S11) */
  345. {95, "Create Bearer Request"},
  346. {96, "Create Bearer Response"},
  347. {97, "Update Bearer Request"},
  348. {98, "Update Bearer Response"},
  349. {99, "Delete Bearer Request"},
  350. {100, "Delete Bearer Response"},
  351. /* PGW to MME, MME to PGW, SGW to PGW, SGW to MME (S5/S8, S11) */
  352. {101, "Delete PDN Connection Set Request"},
  353. {102, "Delete PDN Connection Set Response"},
  354. /* 103-127 For future use */
  355. /* MME to MME, SGSN to MME, MME to SGSN, SGSN to SGSN (S3/10/S16) */
  356. {128, "Identification Request"},
  357. {129, "Identification Response"},
  358. {130, "Context Request"},
  359. {131, "Context Response"},
  360. {132, "Context Acknowledge"},
  361. {133, "Forward Relocation Request"},
  362. {134, "Forward Relocation Response"},
  363. {135, "Forward Relocation Complete Notification"},
  364. {136, "Forward Relocation Complete Acknowledge"},
  365. {137, "Forward Access Context Notification"},
  366. {138, "Forward Access Context Acknowledge"},
  367. {139, "Relocation Cancel Request"},
  368. {140, "Relocation Cancel Response"},
  369. {141, "Configuration Transfer Tunnel"},
  370. /* 142-148 For future use */
  371. /* SGSN to MME, MME to SGSN (S3)*/
  372. {149, "Detach Notification"},
  373. {150, "Detach Acknowledge"},
  374. {151, "CS Paging Indication"},
  375. {152, "RAN Information Relay"},
  376. {153, "Alert MME Notification"},
  377. {154, "Alert MME Acknowledge"},
  378. {155, "UE Activity Notification"},
  379. {156, "UE Activity Acknowledge"},
  380. /* 157 to 159 For future use */
  381. /* MME to SGW (S11) */
  382. {160, "Create Forwarding Tunnel Request"},
  383. {161, "Create Forwarding Tunnel Response"},
  384. {162, "Suspend Notification"},
  385. {163, "Suspend Acknowledge"},
  386. {164, "Resume Notification"},
  387. {165, "Resume Acknowledge"},
  388. {166, "Create Indirect Data Forwarding Tunnel Request"},
  389. {167, "Create Indirect Data Forwarding Tunnel Response"},
  390. {168, "Delete Indirect Data Forwarding Tunnel Request"},
  391. {169, "Delete Indirect Data Forwarding Tunnel Response"},
  392. {170, "Release Access Bearers Request"},
  393. {171, "Release Access Bearers Response"},
  394. /* 172-175 For future use */
  395. /* SGW to SGSN/MME (S4/S11) */
  396. {176, "Downlink Data Notification"},
  397. {177, "Downlink Data Notification Acknowledgement"},
  398. /* SGW to SGSN (S4) */
  399. {178, "Update Bearer Complete"},
  400. /* 179-191 For future use */
  401. /* Other */
  402. {200, "Update PDN Connection Set Request"},
  403. {201, "Update PDN Connection Set Response"},
  404. /* 202 to 230 For future use */
  405. /* MBMS GW to MME/SGSN (Sm/Sn) */
  406. {231, "MBMS Session Start Request"},
  407. {323, "MBMS Session Start Response"},
  408. {233, "MBMS Session Update Request"},
  409. {234, "MBMS Session Update Response"},
  410. {235, "MBMS Session Stop Request"},
  411. {236, "MBMS Session Stop Response"},
  412. /* 237 to 239 For future use */
  413. /* 240-255 Reserved for GTP-U TS 29.281 [13] */
  414. {0, NULL}
  415. };
  416. #define GTPV2_IE_RESERVED 0
  417. #define GTPV2_IE_IMSI 1
  418. #define GTPV2_IE_CAUSE 2
  419. #define GTPV2_REC_REST_CNT 3
  420. #define GTPV2_APN 71
  421. #define GTPV2_AMBR 72
  422. #define GTPV2_EBI 73
  423. #define GTPV2_IP_ADDRESS 74
  424. #define GTPV2_MEI 75
  425. #define GTPV2_IE_MSISDN 76
  426. #define GTPV2_INDICATION 77
  427. #define GTPV2_PCO 78
  428. #define GTPV2_PAA 79
  429. #define GTPV2_BEARER_QOS 80
  430. #define GTPV2_IE_FLOW_QOS 81
  431. #define GTPV2_IE_RAT_TYPE 82
  432. #define GTPV2_IE_SERV_NET 83
  433. #define GTPV2_IE_BEARER_TFT 84
  434. #define GTPV2_IE_TAD 85
  435. #define GTPV2_IE_ULI 86
  436. #define GTPV2_IE_F_TEID 87
  437. #define GTPV2_IE_TMSI 88
  438. #define GTPV2_IE_GLOBAL_CNID 89
  439. #define GTPV2_IE_S103PDF 90
  440. #define GTPV2_IE_S1UDF 91
  441. #define GTPV2_IE_DEL_VAL 92
  442. #define GTPV2_IE_BEARER_CTX 93
  443. #define GTPV2_IE_CHAR_ID 94
  444. #define GTPV2_IE_CHAR_CHAR 95
  445. #define GTPV2_IE_TRA_INFO 96
  446. #define GTPV2_BEARER_FLAG 97
  447. /* define GTPV2_IE_PAGING_CAUSE 98 (void) */
  448. #define GTPV2_IE_PDN_TYPE 99
  449. #define GTPV2_IE_PTI 100
  450. #define GTPV2_IE_DRX_PARAM 101
  451. #define GTPV2_IE_UE_NET_CAPABILITY 102
  452. #define GTPV2_IE_MM_CONTEXT_GSM_T 103
  453. #define GTPV2_IE_MM_CONTEXT_UTMS_CQ 104
  454. #define GTPV2_IE_MM_CONTEXT_GSM_CQ 105
  455. #define GTPV2_IE_MM_CONTEXT_UTMS_Q 106
  456. #define GTPV2_IE_MM_CONTEXT_EPS_QQ 107
  457. #define GTPV2_IE_MM_CONTEXT_UTMS_QQ 108
  458. #define GTPV2_IE_PDN_CONNECTION 109
  459. #define GTPV2_IE_PDN_NUMBERS 110
  460. #define GTPV2_IE_P_TMSI 111
  461. #define GTPV2_IE_P_TMSI_SIG 112
  462. #define GTPV2_IE_HOP_COUNTER 113
  463. #define GTPV2_IE_UE_TIME_ZONE 114
  464. #define GTPV2_IE_TRACE_REFERENCE 115
  465. #define GTPV2_IE_COMPLETE_REQUEST_MSG 116
  466. #define GTPV2_IE_GUTI 117
  467. #define GTPV2_IE_F_CONTAINER 118
  468. #define GTPV2_IE_F_CAUSE 119
  469. #define GTPV2_IE_SEL_PLMN_ID 120
  470. #define GTPV2_IE_TARGET_ID 121
  471. /* GTPV2_IE_NSAPI 122 */
  472. #define GTPV2_IE_PKT_FLOW_ID 123
  473. #define GTPV2_IE_RAB_CONTEXT 124
  474. #define GTPV2_IE_S_RNC_PDCP_CTX_INFO 125
  475. #define GTPV2_IE_UDP_S_PORT_NR 126
  476. #define GTPV2_IE_APN_RESTRICTION 127
  477. #define GTPV2_IE_SEL_MODE 128
  478. #define GTPV2_IE_SOURCE_IDENT 129
  479. #define GTPV2_IE_BEARER_CONTROL_MODE 130
  480. #define GTPV2_IE_CNG_REP_ACT 131
  481. #define GTPV2_IE_FQ_CSID 132
  482. #define GTPV2_IE_CHANNEL_NEEDED 133
  483. #define GTPV2_IE_EMLPP_PRI 134
  484. #define GTPV2_IE_NODE_TYPE 135
  485. #define GTPV2_IE_FQDN 136
  486. #define GTPV2_IE_TI 137
  487. #define GTPV2_IE_PRIVATE_EXT 255
  488. #define SPARE 0X0
  489. #define CREATE_NEW_TFT 0X20
  490. #define DELETE_TFT 0X40
  491. #define ADD_PACKET_FILTERS_TFT 0X60
  492. #define REPLACE_PACKET_FILTERS_TFT 0X80
  493. #define DELETE_PACKET_FILTERS_TFT 0XA0
  494. #define NO_TFT_OPERATION 0XC0
  495. #define RESERVED 0XE0
  496. /* Table 8.1-1: Information Element types for GTPv2 */
  497. static const value_string gtpv2_element_type_vals[] = {
  498. {0, "Reserved"},
  499. {1, "International Mobile Subscriber Identity (IMSI)"}, /* Variable Length / 8.3 */
  500. {2, "Cause"}, /* Variable Length / 8.4 */
  501. {3, "Recovery (Restart Counter)"}, /* Variable Length / 8.5 */
  502. /* 4-50 Reserved for S101 interface Extendable / See 3GPP TS 29.276 [14] */
  503. /* 51-70 Reserved for Sv interface Extendable / See 3GPP TS 29.280 [15] */
  504. {71, "Access Point Name (APN)"}, /* Variable Length / 8.6 */
  505. {72, "Aggregate Maximum Bit Rate (AMBR)"}, /* Fixed Length / 8.7 */
  506. {73, "EPS Bearer ID (EBI)"}, /* Extendable / 8.8 */
  507. {74, "IP Address"}, /* Extendable / 8.9 */
  508. {75, "Mobile Equipment Identity (MEI)"}, /* Variable Length / 8.10 */
  509. {76, "MSISDN"}, /* Variable Length / 8.11 */
  510. {77, "Indication"}, /* Extendable / 8.12 */
  511. {78, "Protocol Configuration Options (PCO)"}, /* Variable Length / 8.13 */
  512. {79, "PDN Address Allocation (PAA)"}, /* Variable Length / 8.14 */
  513. {80, "Bearer Level Quality of Service (Bearer QoS)"}, /* Variable Length / 8.15 */
  514. {81, "Flow Quality of Service (Flow QoS)"}, /* Extendable / 8.16 */
  515. {82, "RAT Type"}, /* Extendable / 8.17 */
  516. {83, "Serving Network"}, /* Extendable / 8.18 */
  517. {84, "EPS Bearer Level Traffic Flow Template (Bearer TFT)"}, /* Variable Length / 8.19 */
  518. {85, "Traffic Aggregation Description (TAD)"}, /* Variable Length / 8.20 */
  519. {86, "User Location Info (ULI)"}, /* Variable Length / 8.21 */
  520. {87, "Fully Qualified Tunnel Endpoint Identifier (F-TEID)"}, /* Extendable / 8.22 */
  521. {88, "TMSI"}, /* Variable Length / 8.23 */
  522. {89, "Global CN-Id"}, /* Variable Length / 8.24 */
  523. {90, "S103 PDN Data Forwarding Info (S103PDF)"}, /* Variable Length / 8.25 */
  524. {91, "S1-U Data Forwarding Info (S1UDF)"}, /* Variable Length/ 8.26 */
  525. {92, "Delay Value"}, /* Extendable / 8.27 */
  526. {93, "Bearer Context"}, /* Extendable / 8.28 */
  527. {94, "Charging ID"}, /* Extendable / 8.29 */
  528. {95, "Charging Characteristics"}, /* Extendable / 8.30 */
  529. {96, "Trace Information"}, /* Extendable / 8.31 */
  530. {97, "Bearer Flags"}, /* Extendable / 8.32 */
  531. {98, "Paging Cause"}, /* Variable Length / 8.33 */
  532. {99, "PDN Type"}, /* Extendable / 8.34 */
  533. {100, "Procedure Transaction ID"}, /* Extendable / 8.35 */
  534. {101, "DRX Parameter"}, /* Variable Length/ 8.36 */
  535. {102, "UE Network Capability"}, /* Variable Length / 8.37 */
  536. {103, "MM Context (GSM Key and Triplets)"}, /* Variable Length / 8.38 */
  537. {104, "MM Context (UMTS Key, Used Cipher and Quintuplets)"}, /* Variable Length / 8.38 */
  538. {105, "MM Context (GSM Key, Used Cipher and Quintuplets)"}, /* Variable Length / 8.38 */
  539. {106, "MM Context (UMTS Key and Quintuplets)"}, /* Variable Length / 8.38 */
  540. {107, "MM Context (EPS Security Context, Quadruplets and Quintuplets)"}, /* Variable Length / 8.38 */
  541. {108, "MM Context (UMTS Key, Quadruplets and Quintuplets)"}, /* Variable Length / 8.38 */
  542. {109, "PDN Connection"}, /* Extendable / 8.39 */
  543. {110, "PDU Numbers"}, /* Extendable / 8.40 */
  544. {111, "P-TMSI"}, /* Variable Length / 8.41 */
  545. {112, "P-TMSI Signature"}, /* Variable Length / 8.42 */
  546. {113, "Hop Counter"}, /* Extendable / 8.43 */
  547. {114, "UE Time Zone"}, /* Variable Length / 8.44 */
  548. {115, "Trace Reference"}, /* Fixed Length / 8.45 */
  549. {116, "Complete Request Message"}, /* Variable Length / 8.46 */
  550. {117, "GUTI"}, /* Variable Length / 8.47 */
  551. {118, "F-Container"}, /* Variable Length / 8.48 */
  552. {119, "F-Cause"}, /* Variable Length / 8.49 */
  553. {120, "Selected PLMN ID"}, /* Variable Length / 8.50 */
  554. {121, "Target Identification"}, /* Variable Length / 8.51 */
  555. {122, "NSAPI"}, /* Extendable / 8.52 */
  556. {123, "Packet Flow ID"}, /* Variable Length / 8.53 */
  557. {124, "RAB Context"}, /* Fixed Length / 8.54 */
  558. {125, "Source RNC PDCP Context Info"}, /* Variable Length / 8.55 */
  559. {126, "UDP Source Port Number"}, /* Extendable / 8.56 */
  560. {127, "APN Restriction"}, /* Extendable / 8.57 */
  561. {128, "Selection Mode"}, /* Extendable / 8.58 */
  562. {129, "Source Identification"}, /* Variable Length / 8.50 */
  563. {130, "Bearer Control Mode"}, /* Extendable / 8.60 */
  564. {131, "Change Reporting Action"}, /* Variable Length / 8.61 */
  565. {132, "Fully Qualified PDN Connection Set Identifier (FQ-CSID)"}, /* Variable Length / 8.62 */
  566. {133, "Channel needed"}, /* Extendable / 8.63 */
  567. {134, "eMLPP Priority"}, /* Extendable / 8.64 */
  568. {135, "Node Type"}, /* Extendable / 8.65 */
  569. {136, "Fully Qualified Domain Name (FQDN)"}, /* Variable Length / 8.66 */
  570. {137, "Transaction Identifier (TI)"}, /* Variable Length / 8.68 */
  571. {138, "MBMS Session"}, /* Duration Extendable / 8.69 */
  572. {139, "MBMS Service Area"}, /* Extendable / 8.70 */
  573. {140, "MBMS Session Identifier"}, /* Extendable / 8.71 */
  574. {141, "MBMS Flow Identifier"}, /* Extendable / 8.72 */
  575. {142, "MBMS IP Multicast Distribution"}, /* Extendable / 8.73 */
  576. {143, "MBMS Distribution Acknowledge"}, /* Extendable / 8.74 */
  577. {144, "RFSP Index"}, /* Fixed Length / 8.77 */
  578. {145, "User CSG Information (UCI)"}, /* Extendable / 8.75 */
  579. {146, "CSG Information Reporting Action"}, /* Extendable / 8.76 */
  580. {147, "CSG ID"}, /* Extendable / 8.78 */
  581. {148, "CSG Membership Indication (CMI)"}, /* Extendable / 8.79 */
  582. {149, "Service indicator"}, /* Fixed Length / 8.80 */
  583. {150, "Detach Type"}, /* Fixed Length / 8.81 */
  584. {151, "Local Distiguished Name (LDN)"}, /* Variable / 8.82 */
  585. {152, "Node Features"}, /* Extendable / 8.83 */
  586. {153, "MBMS Time to Data Transfer"}, /* Extendable / 8.84 */
  587. {154, "Throttling"}, /* Extendable / 8.85 */
  588. {155, "Allocation/Retention Priority (ARP)"}, /* Extendable / 8.86 */
  589. /* 156 to 254 Spare. For future use. */ /* For future use. FFS */
  590. {255, "Private"}, /* Extension Extendable / 8.67 */
  591. {0, NULL}
  592. };
  593. /* Code to dissect IE's */
  594. static void
  595. dissect_gtpv2_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  596. {
  597. proto_item *expert_item;
  598. expert_item = proto_tree_add_text(tree, tvb, 0, length, "IE data not dissected yet");
  599. expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_NOTE, "IE data not dissected yet");
  600. PROTO_ITEM_SET_GENERATED(expert_item);
  601. }
  602. /*
  603. * 8.3 International Mobile Subscriber Identity (IMSI)
  604. *
  605. * IMSI is defined in 3GPP TS 23.003
  606. * Editor's note: IMSI coding will be defined in 3GPP TS 24.301
  607. * Editor's note: In the first release of GTPv2 spec (TS 29.274v8.0.0) n = 8.
  608. * That is, the overall length of the IE is 11 octets.
  609. */
  610. static void
  611. dissect_gtpv2_imsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  612. {
  613. int offset= 0;
  614. const gchar *imsi_str;
  615. /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
  616. * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
  617. * allocated string will be returned.
  618. */
  619. imsi_str = tvb_bcd_dig_to_ep_str( tvb, offset, length, NULL, FALSE);
  620. proto_tree_add_string(tree, hf_gtpv2_imsi, tvb, offset, length, imsi_str);
  621. proto_item_append_text(item, "%s", imsi_str);
  622. }
  623. /*
  624. * 8.4 Cause
  625. */
  626. /* Table 8.4-1: Cause values */
  627. static const value_string gtpv2_cause_vals[] = {
  628. {0, "Reserved"},
  629. /* Request */
  630. {1, "Paging Cause"},
  631. {2, "Local Detach"},
  632. {3, "Complete Detach"},
  633. {4, "RAT changed from 3GPP to Non-3GPP"},
  634. {5, "ISR is activated"},
  635. {6, "Error Indication received from RNC/eNodeB"},
  636. {7, "IMSI Detach Only"},
  637. {8, "Reactivation Requested"},
  638. {9, "PDN reconnection to this APN disallowed"},
  639. {10, "Access changed from Non-3GPP to 3GPP"},
  640. /* 11-15 Spare. This value range is reserved for Cause values in a request message */
  641. {11, "Spare"},
  642. {12, "Spare"},
  643. {13, "Spare"},
  644. {14, "Spare"},
  645. {15, "Spare"},
  646. /* Acceptance Response */
  647. {16, "Request accepted"},
  648. {17, "Request accepted partially"},
  649. {18, "New PDN type due to network preference"},
  650. {19, "New PDN type due to single address bearer only"},
  651. /* 20-63 Spare. This value range is reserved for Cause values in acceptance response message */
  652. /* Rejection Response */
  653. {20, "Spare"},
  654. {21, "Spare"},
  655. {22, "Spare"},
  656. {23, "Spare"},
  657. {24, "Spare"},
  658. {25, "Spare"},
  659. {26, "Spare"},
  660. {27, "Spare"},
  661. {28, "Spare"},
  662. {29, "Spare"},
  663. {30, "Spare"},
  664. {31, "Spare"},
  665. {32, "Spare"},
  666. {33, "Spare"},
  667. {34, "Spare"},
  668. {35, "Spare"},
  669. {36, "Spare"},
  670. {37, "Spare"},
  671. {38, "Spare"},
  672. {39, "Spare"},
  673. {40, "Spare"},
  674. {41, "Spare"},
  675. {42, "Spare"},
  676. {43, "Spare"},
  677. {44, "Spare"},
  678. {45, "Spare"},
  679. {46, "Spare"},
  680. {47, "Spare"},
  681. {48, "Spare"},
  682. {49, "Spare"},
  683. {50, "Spare"},
  684. {51, "Spare"},
  685. {52, "Spare"},
  686. {53, "Spare"},
  687. {54, "Spare"},
  688. {55, "Spare"},
  689. {56, "Spare"},
  690. {57, "Spare"},
  691. {58, "Spare"},
  692. {59, "Spare"},
  693. {60, "Spare"},
  694. {61, "Spare"},
  695. {62, "Spare"},
  696. {63, "Spare"},
  697. {64, "Context Not Found"},
  698. {65, "Invalid Message Format"},
  699. {66, "Version not supported by next peer"},
  700. {67, "Invalid length"},
  701. {68, "Service not supported"},
  702. {69, "Mandatory IE incorrect"},
  703. {70, "Mandatory IE missing"},
  704. {71, "Optional IE incorrect"},
  705. {72, "System failure"},
  706. {73, "No resources available"},
  707. {74, "Semantic error in the TFT operation"},
  708. {75, "Syntactic error in the TFT operation"},
  709. {76, "Semantic errors in packet filter(s)"},
  710. {77, "Syntactic errors in packet filter(s)"},
  711. {78, "Missing or unknown APN"},
  712. {79, "Unexpected repeated IE"},
  713. {80, "GRE key not found"},
  714. {81, "Reallocation failure"},
  715. {82, "Denied in RAT"},
  716. {83, "Preferred PDN type not supported"},
  717. {84, "All dynamic addresses are occupied"},
  718. {85, "UE context without TFT already activated"},
  719. {86, "Protocol type not supported"},
  720. {87, "UE not responding"},
  721. {88, "UE refuses"},
  722. {89, "Service denied"},
  723. {90, "Unable to page UE"},
  724. {91, "No memory available"},
  725. {92, "User authentication failed"},
  726. {93, "APN access denied - no subscription"},
  727. {94, "Request rejected"},
  728. {95, "P-TMSI Signature mismatch"},
  729. {96, "IMSI not known"},
  730. {97, "Semantic error in the TAD operation"},
  731. {98, "Syntactic error in the TAD operation"},
  732. {99, "Reserved Message Value Received"},
  733. {100, "PGW not responding"},
  734. {101, "Collision with network initiated request"},
  735. {102, "Unable to page UE due to Suspension"},
  736. {103, "Conditional IE missing"},
  737. {104, "APN Restriction type Incompatible with currently active PDN connection"},
  738. {105, "Invalid overall length of the triggered response message and a piggybacked initial message"},
  739. {106, "Data forwarding not supported"},
  740. {107, "Invalid reply from remote peer"},
  741. {108, "Fallback to GTPv1"},
  742. {109, "Invalid peer"},
  743. {110, "Temporarily rejected due to handover procedure in progress"},
  744. {111, "Modifications not limited to S1-U bearers"},
  745. {112, "Request rejected for a PMIPv6 reason "},
  746. /* 113-239 Spare. For future use in a triggered/response message */
  747. /* 240-255 Spare. For future use in an initial/request message */
  748. {0, NULL}
  749. };
  750. static value_string_ext gtpv2_cause_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_cause_vals);
  751. /* Table 8.4-1: CS (Cause Source) */
  752. static const true_false_string gtpv2_cause_cs = {
  753. "Originated by remote node",
  754. "Originated by node sending the message",
  755. };
  756. static void
  757. dissect_gtpv2_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  758. {
  759. int offset = 0;
  760. guint8 tmp;
  761. /* Cause value octet 5 */
  762. tmp = tvb_get_guint8(tvb, offset);
  763. proto_tree_add_item(tree, hf_gtpv2_cause, tvb, offset, 1, FALSE);
  764. /* Add Cause to ie_tree */
  765. proto_item_append_text(item, "%s (%u)", val_to_str_ext_const(tmp, &gtpv2_cause_vals_ext, "Unknown"),tmp);
  766. offset++;
  767. /* Octet 6 Spare PCE BCE CS */
  768. proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, FALSE);
  769. proto_tree_add_item(tree, hf_gtpv2_cause_pce, tvb, offset, 1, FALSE);
  770. proto_tree_add_item(tree, hf_gtpv2_cause_bce, tvb, offset, 1, FALSE);
  771. proto_tree_add_item(tree, hf_gtpv2_cause_cs, tvb, offset, 1, FALSE);
  772. offset++;
  773. /* If n = 2, a = 0 and the Cause IE shall be 6 octets long.
  774. * Therefore, octets "a(n+1) to a(n+4)" will not be present.
  775. * If n = 6, a = 1 and the Cause IE will be 10 octets long.
  776. */
  777. if ( length == 2 ) {
  778. return;
  779. }
  780. /*
  781. * If the rejection is due to a mandatory IE or a verifiable conditional IE is faulty
  782. * or missing, the offending IE shall be included within an additional field "a(n+1)
  783. * to a(n+4)". Only Type and Instance fields of the offending IE that caused the
  784. * rejection have a meaning. The length in the Octet 8-9 and spare bits in the Octet 10
  785. * shall be set to "0". In this case, the value of "n" shall be "6".
  786. * Otherwise, the value of "n" is equal to "2".
  787. */
  788. /* Type of the offending IE */
  789. proto_tree_add_item(tree, hf_gtpv2_cause_off_ie_t, tvb, offset, 1, FALSE);
  790. offset++;
  791. /* Length */
  792. proto_tree_add_item(tree, hf_gtpv2_ie_len, tvb, offset, 2, FALSE);
  793. offset+=2;
  794. /* a(n+4) Spare Instance */
  795. proto_tree_add_bits_item(tree, hf_gtpv2_spare_half_octet, tvb, offset>>3, 4, FALSE);
  796. proto_tree_add_item(tree, hf_gtpv2_instance, tvb, offset, 1, FALSE);
  797. offset++;
  798. }
  799. /*
  800. * 8.5 Recovery (Restart Counter)
  801. */
  802. static void
  803. dissect_gtpv2_recovery(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  804. {
  805. int offset = 0;
  806. guint8 recovery;
  807. recovery = tvb_get_guint8(tvb, offset);
  808. proto_tree_add_item(tree, hf_gtpv2_rec, tvb, offset, 1, FALSE);
  809. proto_item_append_text(item, "%u", recovery);
  810. }
  811. /*
  812. * 8.6 Access Point Name (APN)
  813. * The encoding the APN field follows 3GPP TS 23.003 [2] subclause 9.1.
  814. * The content of the APN field shall be the full APN with both the APN Network Identifier
  815. * and APN Operator Identifier being present as specified in 3GPP TS 23.003 [2]
  816. * 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.
  817. */
  818. static void
  819. dissect_gtpv2_apn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  820. {
  821. int offset = 0;
  822. guint8 *apn = NULL;
  823. int name_len, tmp;
  824. if (length > 0) {
  825. name_len = tvb_get_guint8(tvb, offset);
  826. if (name_len < 0x20) {
  827. apn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
  828. for (;;) {
  829. if (name_len >= length - 1)
  830. break;
  831. tmp = name_len;
  832. name_len = name_len + apn[tmp] + 1;
  833. apn[tmp] = '.';
  834. }
  835. } else{
  836. apn = tvb_get_ephemeral_string(tvb, offset, length);
  837. }
  838. proto_tree_add_string(tree, hf_gtpv2_apn, tvb, offset, length, apn);
  839. }
  840. if (apn)
  841. proto_item_append_text(item, "%s", apn);
  842. }
  843. /*
  844. * 8.7 Aggregate Maximum Bit Rate (AMBR)
  845. */
  846. static void
  847. 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_)
  848. {
  849. int offset = 0;
  850. proto_tree_add_item(tree, hf_gtpv2_ambr_up, tvb, offset, 4, FALSE);
  851. offset= offset + 4;
  852. proto_tree_add_item(tree, hf_gtpv2_ambr_down, tvb, offset, 4, FALSE);
  853. }
  854. /*
  855. * 8.8 EPS Bearer ID (EBI)
  856. */
  857. static void
  858. dissect_gtpv2_ebi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  859. {
  860. int offset = 0;
  861. guint8 ebi;
  862. /* Spare (all bits set to 0) B8 - B5*/
  863. proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset, 4, FALSE);
  864. /* EPS Bearer ID (EBI) B4 - B1 */
  865. ebi = tvb_get_guint8(tvb, offset);
  866. proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 1, FALSE);
  867. proto_item_append_text(item, "%u", ebi);
  868. }
  869. /*
  870. * 8.9 IP Address
  871. */
  872. static void
  873. dissect_gtpv2_ip_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  874. {
  875. int offset = 0;
  876. struct e_in6_addr ipv6_addr;
  877. if (length==4)
  878. {
  879. proto_tree_add_item(tree, hf_gtpv2_ip_address_ipv4, tvb, offset, length, FALSE);
  880. proto_item_append_text(item, "IPv4 %s", tvb_ip_to_str(tvb, offset));
  881. }
  882. else if (length==16)
  883. {
  884. proto_tree_add_item(tree, hf_gtpv2_ip_address_ipv6, tvb, offset, length, FALSE);
  885. tvb_get_ipv6(tvb, offset, &ipv6_addr);
  886. proto_item_append_text(item, "IPv6 %s", ip6_to_str(&ipv6_addr));
  887. }
  888. }
  889. /*
  890. * 8.10 Mobile Equipment Identity (MEI)
  891. * The ME Identity field contains either the IMEI or the IMEISV
  892. * as defined in clause 6.2 of 3GPP TS 23.003 [2]. It is encoded
  893. * as specified in clause 7.7.53 of 3GPP TS 29.060 [4], beginning
  894. * with octet 4 of Figure 7.7.53.1. The IMEI(SV) digits are encoded
  895. * using BCD coding where IMEI is 15 BCD digits and IMEISV is 16 BCD
  896. * digits. For IMEI, bits 5 to 8 of the last octet shall be filled
  897. * with an end mark coded as '1111'.
  898. */
  899. static void
  900. dissect_gtpv2_mei(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  901. {
  902. int offset= 0;
  903. const gchar *mei_str;
  904. /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
  905. * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
  906. * allocated string will be returned.
  907. */
  908. mei_str = tvb_bcd_dig_to_ep_str( tvb, 0, length, NULL, FALSE);
  909. proto_tree_add_string(tree, hf_gtpv2_mei, tvb, offset, length, mei_str);
  910. proto_item_append_text(item, "%s", mei_str);
  911. }
  912. /*
  913. * 8.11 MSISDN
  914. *
  915. * MSISDN is defined in 3GPP TS 23.003
  916. * Editor's note: MSISDN coding will be defined in TS 24.301.
  917. */
  918. static void
  919. dissect_gtpv2_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  920. {
  921. const char *digit_str;
  922. /* Octets 5 to (n+4) represent the MSISDN value is in international number format
  923. * as described in ITU-T Rec E.164 [25] and 3GPP TS 29.002 [41].
  924. * MSISDN value contains only the actual MSISDN number (does not contain the "nature of
  925. * address indicator" octet, which indicates "international number"
  926. * as in 3GPP TS 29.002 [41]) and is encoded as TBCD digits, i.e.
  927. * digits from 0 through 9 are encoded "0000" to "1001".
  928. * When there is an odd number of digits, bits 8 to 5 of the last octet are encoded with
  929. * the filler "1111".
  930. */
  931. dissect_e164_cc(tvb, tree, 0, TRUE);
  932. /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
  933. * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
  934. * allocated string will be returned.
  935. */
  936. digit_str = tvb_bcd_dig_to_ep_str( tvb, 0, length, NULL, FALSE);
  937. proto_tree_add_string(tree, hf_gtpv2_address_digits, tvb, 0, length, digit_str);
  938. proto_item_append_text(item, "%s", digit_str);
  939. }
  940. /*
  941. * 8.12 Indication
  942. */
  943. static void
  944. 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_)
  945. {
  946. int offset = 0;
  947. /* Octet 5 DAF DTF HI DFI OI ISRSI ISRAI SGWCI */
  948. proto_tree_add_item(tree, hf_gtpv2_daf, tvb, offset, 1, FALSE);
  949. proto_tree_add_item(tree, hf_gtpv2_dtf, tvb, offset, 1, FALSE);
  950. proto_tree_add_item(tree, hf_gtpv2_hi, tvb, offset, 1, FALSE);
  951. proto_tree_add_item(tree, hf_gtpv2_dfi, tvb, offset, 1, FALSE);
  952. proto_tree_add_item(tree, hf_gtpv2_oi, tvb, offset, 1, FALSE);
  953. proto_tree_add_item(tree, hf_gtpv2_isrsi, tvb, offset, 1, FALSE);
  954. proto_tree_add_item(tree, hf_gtpv2_israi, tvb, offset, 1, FALSE);
  955. proto_tree_add_item(tree, hf_gtpv2_sgwci, tvb, offset, 1, FALSE);
  956. if(length==1) {
  957. proto_tree_add_text(tree, tvb, 0, length, "Older version?, should be 2 octets in 8.0.0");
  958. return;
  959. }
  960. offset++;
  961. /* Octet 6 SQCI UIMSI CFSI CRSI P PT SI MSV
  962. * 3GPP TS 29.274 version 9.4.0 Release 9
  963. */
  964. proto_tree_add_item(tree, hf_gtpv2_sqci, tvb, offset, 1, FALSE);
  965. proto_tree_add_item(tree, hf_gtpv2_uimsi, tvb, offset, 1, FALSE);
  966. proto_tree_add_item(tree, hf_gtpv2_cfsi, tvb, offset, 1, FALSE);
  967. proto_tree_add_item(tree, hf_gtpv2_crsi, tvb, offset, 1, FALSE);
  968. proto_tree_add_item(tree, hf_gtpv2_ps, tvb, offset, 1, FALSE);
  969. proto_tree_add_item(tree, hf_gtpv2_pt, tvb, offset, 1, FALSE);
  970. proto_tree_add_item(tree, hf_gtpv2_si, tvb, offset, 1, FALSE);
  971. proto_tree_add_item(tree, hf_gtpv2_msv, tvb, offset, 1, FALSE);
  972. offset++;
  973. if(length==2){
  974. return;
  975. }
  976. /* Only present in version 9 and higher */
  977. /* Octet 7 Spare Spare Spare Spare Spare Spare Spare CCRSI */
  978. proto_tree_add_item(tree, hf_gtpv2_ccrsi, tvb, offset, 1, FALSE);
  979. }
  980. /*
  981. * 8.13 Protocol Configuration Options (PCO)
  982. * Protocol Configuration Options (PCO) is transferred via GTP tunnels. The sending entity copies the value part of the
  983. * 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
  984. * as per clause 10.5.6.3 of 3GPP TS 24.008 [5], starting with octet 3.
  985. * Dissected in packet-gsm_a_gm.c
  986. */
  987. static void
  988. dissect_gtpv2_pco(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  989. {
  990. switch(message_type){
  991. case GTPV2_CREATE_SESSION_REQUEST:
  992. /* PCO options as MS to network direction */
  993. pinfo->link_dir = P2P_DIR_UL;
  994. break;
  995. case GTPV2_CREATE_SESSION_RESPONSE:
  996. /* PCO options as Network to MS direction: */
  997. pinfo->link_dir = P2P_DIR_DL;
  998. break;
  999. default:
  1000. break;
  1001. }
  1002. de_sm_pco(tvb, tree, pinfo, 0, length, NULL, 0);
  1003. }
  1004. /*
  1005. * 8.14 PDN Address Allocation (PAA)
  1006. */
  1007. static const value_string gtpv2_pdn_type_vals[] = {
  1008. {1, "IPv4"},
  1009. {2, "IPv6"},
  1010. {3, "IPv4/IPv6"},
  1011. {0, NULL}
  1012. };
  1013. static void
  1014. 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_)
  1015. {
  1016. int offset = 0;
  1017. guint8 pdn_type;
  1018. pdn_type = tvb_get_guint8(tvb, offset);
  1019. proto_tree_add_item(tree, hf_gtpv2_pdn_type, tvb, offset, 1, FALSE);
  1020. offset++;
  1021. switch(pdn_type)
  1022. {
  1023. case 1:
  1024. /* IPv4 */
  1025. proto_tree_add_item(tree, hf_gtpv2_pdn_ipv4, tvb, offset, 4, FALSE);
  1026. offset+=4;
  1027. break;
  1028. case 2:
  1029. /* IPv6*/
  1030. /* If PDN type value indicates IPv6, octet 6 contains the IPv6 Prefix Length.
  1031. * Octets 7 through 22 contain an IPv6 Prefix and Interface Identifier.
  1032. * Bit 8 of octet 7 represents the most significant bit of the IPv6 Prefix
  1033. * and Interface Identifier and bit 1 of octet 22 the least significant bit.
  1034. */
  1035. proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6_len, tvb, offset, 1, FALSE);
  1036. offset++;
  1037. proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6, tvb, offset, 16, FALSE);
  1038. offset+=16;
  1039. break;
  1040. case 3:
  1041. /* IPv4/IPv6 */
  1042. /* If PDN type value indicates IPv4v6, octet 6 contains the IPv6 Prefix Length.
  1043. * Octets 7 through 22 contain an IPv6 Prefix and Interface Identifier.
  1044. * Bit 8 of octet 7 represents the most significant bit of the IPv6 Prefix
  1045. * and Interface Identifier and bit 1 of octet 22 the least significant bit.
  1046. * Octets 23 through 26 contain an IPv4 address. Bit 8 of octet 23 represents
  1047. * the most significant bit of the IPv4 address and bit 1 of octet 26 the least
  1048. * significant bit.
  1049. */
  1050. proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6_len, tvb, offset, 1, FALSE);
  1051. offset++;
  1052. proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6, tvb, offset, 16, FALSE);
  1053. offset+=16;
  1054. proto_tree_add_item(tree, hf_gtpv2_pdn_ipv4, tvb, offset, 4, FALSE);
  1055. offset+=4;
  1056. break;
  1057. default:
  1058. break;
  1059. }
  1060. }
  1061. /*
  1062. * 8.15 Bearer Quality of Service (Bearer QoS)
  1063. */
  1064. static void
  1065. 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_)
  1066. {
  1067. int offset = 0;
  1068. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pvi, tvb, offset, 1, FALSE);
  1069. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pl, tvb, offset, 1, FALSE);
  1070. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pci, tvb, offset, 1, FALSE);
  1071. offset++;
  1072. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_label_qci, tvb, offset, 1, FALSE);
  1073. offset++;
  1074. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_mbr_up, tvb, offset, 5, FALSE);
  1075. offset= offset+5;
  1076. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_mbr_down, tvb, offset, 5, FALSE);
  1077. offset= offset+5;
  1078. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_gbr_up, tvb, offset, 5, FALSE);
  1079. offset= offset+5;
  1080. proto_tree_add_item(tree, hf_gtpv2_bearer_qos_gbr_down, tvb, offset, 5, FALSE);
  1081. offset= offset+5;
  1082. }
  1083. /*
  1084. * 8.16 Flow Quality of Service (Flow QoS)
  1085. */
  1086. static void
  1087. 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_)
  1088. {
  1089. int offset = 0;
  1090. proto_tree_add_item(tree, hf_gtpv2_flow_qos_label_qci, tvb, offset, 1, FALSE);
  1091. offset++;
  1092. proto_tree_add_item(tree, hf_gtpv2_flow_qos_mbr_up, tvb, offset, 5, FALSE);
  1093. offset= offset+5;
  1094. proto_tree_add_item(tree, hf_gtpv2_flow_qos_mbr_down, tvb, offset, 5, FALSE);
  1095. offset= offset+5;
  1096. proto_tree_add_item(tree, hf_gtpv2_flow_qos_gbr_up, tvb, offset, 5, FALSE);
  1097. offset= offset+5;
  1098. proto_tree_add_item(tree, hf_gtpv2_flow_qos_gbr_down, tvb, offset, 5, FALSE);
  1099. offset= offset+5;
  1100. }
  1101. /*
  1102. * 8.17 RAT Type
  1103. */
  1104. static const value_string gtpv2_rat_type_vals[] = {
  1105. {0, "Reserved"},
  1106. {1, "UTRAN"},
  1107. {2, "GERAN"},
  1108. {3, "WLAN"},
  1109. {4, "GAN"},
  1110. {5, "HSPA Evolution"},
  1111. {6, "EUTRAN"},
  1112. {7, "Virtual"},
  1113. {0, NULL}
  1114. };
  1115. static value_string_ext gtpv2_rat_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_rat_type_vals);
  1116. static void
  1117. dissect_gtpv2_rat_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1118. {
  1119. guint8 rat_type;
  1120. rat_type = tvb_get_guint8(tvb, 0);
  1121. proto_tree_add_item(tree, hf_gtpv2_rat_type, tvb, 0, 1, FALSE);
  1122. proto_item_append_text(tree, "%s (%u)", val_to_str_ext_const(rat_type, &gtpv2_rat_type_vals_ext, "Unknown"),rat_type);
  1123. }
  1124. /*
  1125. * 8.18 Serving Network
  1126. */
  1127. static void
  1128. dissect_gtpv2_serv_net(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1129. {
  1130. gchar *mcc_mnc_str;
  1131. mcc_mnc_str = dissect_e212_mcc_mnc_ep_str(tvb, pinfo, tree, 0, TRUE);
  1132. proto_item_append_text(tree,"%s", mcc_mnc_str);
  1133. }
  1134. /*
  1135. * 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT)
  1136. */
  1137. static void
  1138. dissect_gtpv2_bearer_tft(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1139. {
  1140. /* The detailed coding of Traffic Aggregate
  1141. * Description is specified in 3GPP TS 24.008 [5] ,
  1142. * clause 10.5.6.12, beginning with octet 3..
  1143. * Use the decoding in packet-gsm_a_gm.c
  1144. */
  1145. de_sm_tflow_temp(tvb, tree, pinfo, 0, length, NULL, 0);
  1146. }
  1147. /* 8.20 Traffic Aggregate Description (TAD)
  1148. */
  1149. static void
  1150. dissect_gtpv2_tad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1151. {
  1152. /* The detailed coding of Traffic Aggregate
  1153. * Description is specified in 3GPP TS 24.008 [5] ,
  1154. * clause 10.5.6.12, beginning with octet 3..
  1155. * Use the decoding in packet-gsm_a_gm.c
  1156. */
  1157. de_sm_tflow_temp(tvb, tree, pinfo, 0, length, NULL, 0);
  1158. }
  1159. /*
  1160. * 8.21 User Location Info (ULI)
  1161. *
  1162. * The flags ECGI, TAI, RAI, SAI and CGI in octed 5 indicate if the corresponding
  1163. * fields are present in the IE or not. If one of these flags is set to "0",
  1164. * the corresponding field is not present at all. The respective identities are defined in 3GPP
  1165. * TS 23.003 [2].
  1166. * Editor's Note: The definition of ECGI is missing in 3GPP TS 23.003 v8.1.0.
  1167. * It can be found in 3GPP TS 36.413 v8.3.0, but it is expected that it will be moved
  1168. * to 23.003 in a future version.
  1169. */
  1170. static void
  1171. decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 instance _U_, guint flags)
  1172. {
  1173. int offset = 1;
  1174. proto_item *fi;
  1175. proto_tree *part_tree;
  1176. /* 8.21.1 CGI field */
  1177. if (flags & GTPv2_ULI_CGI_MASK)
  1178. {
  1179. proto_item_append_text(item, "CGI ");
  1180. fi = proto_tree_add_text(tree, tvb, offset + 1, 7, "Cell Global Identity (CGI)");
  1181. part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
  1182. dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
  1183. offset+=3;
  1184. proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_lac, tvb, offset, 2, FALSE);
  1185. proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_ci, tvb, offset, 2, FALSE);
  1186. offset+=4;
  1187. if(offset==length)
  1188. return;
  1189. }
  1190. /* 8.21.2 SAI field */
  1191. if (flags & GTPv2_ULI_SAI_MASK)
  1192. {
  1193. proto_item_append_text(item, "SAI ");
  1194. fi = proto_tree_add_text(tree, tvb, offset + 1, 7, "Service Area Identity (SAI)");
  1195. part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
  1196. dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
  1197. offset+=3;
  1198. proto_tree_add_item(part_tree, hf_gtpv2_uli_sai_lac, tvb, offset, 2, FALSE);
  1199. proto_tree_add_item(part_tree, hf_gtpv2_uli_sai_sac, tvb, offset, 2, FALSE);
  1200. offset+=4;
  1201. if(offset==length)
  1202. return;
  1203. }
  1204. /* 8.21.3 RAI field */
  1205. if (flags & GTPv2_ULI_RAI_MASK)
  1206. {
  1207. proto_item_append_text(item, "RAI ");
  1208. fi = proto_tree_add_text(tree, tvb, offset + 1, 7, "Routeing Area Identity (RAI)");
  1209. part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
  1210. dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
  1211. offset+=3;
  1212. proto_tree_add_item(part_tree, hf_gtpv2_uli_rai_lac, tvb, offset, 2, FALSE);
  1213. proto_tree_add_item(part_tree, hf_gtpv2_uli_rai_rac, tvb, offset, 2, FALSE);
  1214. offset+=4;
  1215. if(offset==length)
  1216. return;
  1217. }
  1218. /* 8.21.4 TAI field */
  1219. if (flags & GTPv2_ULI_TAI_MASK)
  1220. {
  1221. proto_item_append_text(item, "TAI ");
  1222. fi = proto_tree_add_text(tree, tvb, offset + 1, 7, "Tracking Area Identity (TAI)");
  1223. part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
  1224. dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
  1225. offset+=3;
  1226. proto_tree_add_item(part_tree, hf_gtpv2_uli_tai_tac, tvb, offset, 2, FALSE);
  1227. offset+=2;
  1228. if(offset==length)
  1229. return;
  1230. }
  1231. /* 8.21.5 ECGI field */
  1232. if (flags & GTPv2_ULI_ECGI_MASK)
  1233. {
  1234. guint8 octet;
  1235. guint32 octet4;
  1236. guint8 spare;
  1237. guint32 ECGI;
  1238. proto_item_append_text(item, "ECGI ");
  1239. fi = proto_tree_add_text(tree, tvb, offset + 1, 7, "E-UTRAN Cell Global Identifier (ECGI)");
  1240. part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
  1241. dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
  1242. offset+=3;
  1243. /* The bits 8 through 5, of octet e+3 (Fig 8.21.5-1 in TS 29.274 V8.2.0) are spare
  1244. * and hence they would not make any difference to the hex string following it,
  1245. * thus we directly read 4 bytes from the tvb
  1246. */
  1247. octet = tvb_get_guint8(tvb,offset);
  1248. spare = octet & 0xF0;
  1249. octet4 = tvb_get_ntohl(tvb,offset);
  1250. ECGI = octet4 & 0x0FFFFFFF;
  1251. proto_tree_add_uint(part_tree, hf_gtpv2_uli_ecgi_eci_spare, tvb, offset, 1, spare);
  1252. /* The coding of the E-UTRAN cell identifier is the responsibility of each administration.
  1253. * Coding using full hexadecimal representation shall be used.
  1254. */
  1255. proto_tree_add_uint(part_tree, hf_gtpv2_uli_ecgi_eci, tvb, offset, 4, ECGI);
  1256. /*proto_tree_add_item(tree, hf_gtpv2_uli_ecgi_eci, tvb, offset, 4, FALSE);*/
  1257. offset+=4;
  1258. if(offset==length)
  1259. return;
  1260. }
  1261. /* 8.21.6 LAI field */
  1262. if (flags & GTPv2_ULI_LAI_MASK)
  1263. {
  1264. proto_item_append_text(item, "LAI ");
  1265. fi = proto_tree_add_text(tree, tvb, offset + 1, 5, "LAI (Location Area Identifier)");
  1266. part_tree = proto_item_add_subtree(fi, ett_gtpv2_uli_field);
  1267. dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE);
  1268. offset+=3;
  1269. /* The Location Area Code (LAC) consists of 2 octets. Bit 8 of Octet f+3 is the most significant bit
  1270. * and bit 1 of Octet f+4 the least significant bit. The coding of the location area code is the
  1271. * responsibility of each administration. Coding using full hexadecimal representation shall be used.
  1272. */
  1273. proto_tree_add_item(part_tree, hf_gtpv2_uli_lai_lac, tvb, offset, 2, FALSE);
  1274. offset+=2;
  1275. }
  1276. }
  1277. static void
  1278. dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1279. {
  1280. proto_item *flags_item;
  1281. proto_tree *flag_tree;
  1282. int offset = 0;
  1283. guint flags;
  1284. flags_item = proto_tree_add_text(tree, tvb, offset, 1, "Flags");
  1285. flag_tree = proto_item_add_subtree(flags_item, ett_gtpv2_uli_flags);
  1286. flags = tvb_get_guint8(tvb,offset)&0x3f;
  1287. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset>>3, 2, FALSE);
  1288. /* LAI B6 */
  1289. proto_tree_add_item(flag_tree, hf_gtpv2_uli_lai_flg, tvb, offset, 1, FALSE);
  1290. /* ECGI B5 */
  1291. proto_tree_add_item(flag_tree, hf_gtpv2_uli_ecgi_flg, tvb, offset, 1, FALSE);
  1292. /* TAI B4 */
  1293. proto_tree_add_item(flag_tree, hf_gtpv2_uli_tai_flg, tvb, offset, 1, FALSE);
  1294. /* RAI B3 */
  1295. proto_tree_add_item(flag_tree, hf_gtpv2_uli_rai_flg, tvb, offset, 1, FALSE);
  1296. /* SAI B2 */
  1297. proto_tree_add_item(flag_tree, hf_gtpv2_uli_sai_flg, tvb, offset, 1, FALSE);
  1298. /* CGI B1 */
  1299. proto_tree_add_item(flag_tree, hf_gtpv2_uli_cgi_flg, tvb, offset, 1, FALSE);
  1300. decode_gtpv2_uli(tvb, pinfo, tree, item, length, instance, flags);
  1301. return;
  1302. }
  1303. /* Diameter 3GPP AVP Code: 22 3GPP-User-Location-Info */
  1304. /*
  1305. * TS 29.061 v9.2.0
  1306. * 16.4.7.2 Coding 3GPP Vendor-Specific RADIUS attributes
  1307. *
  1308. * For P-GW, the Geographic Location Type values and coding are defined as follows:
  1309. *
  1310. * 0 CGI
  1311. * 1 SAI
  1312. * 2 RAI
  1313. * 3-127 Spare for future use
  1314. * 128 TAI
  1315. * 129 ECGI
  1316. * 130 TAI and ECGI
  1317. * 131-255 Spare for future use
  1318. */
  1319. static int
  1320. dissect_diameter_3gpp_uli(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_)
  1321. {
  1322. int offset = 0;
  1323. guint length;
  1324. guint flags;
  1325. guint flags_3gpp;
  1326. length = tvb_length(tvb);
  1327. flags_3gpp = tvb_get_guint8(tvb,offset);
  1328. switch(flags_3gpp)
  1329. {
  1330. case 128:
  1331. /* TAI */
  1332. flags = GTPv2_ULI_TAI_MASK;
  1333. break;
  1334. case 129:
  1335. /* ECGI */
  1336. flags = GTPv2_ULI_ECGI_MASK;
  1337. break;
  1338. case 130:
  1339. /* TAI and ECGI */
  1340. flags = GTPv2_ULI_TAI_MASK + GTPv2_ULI_ECGI_MASK;
  1341. break;
  1342. default:
  1343. flags = flags_3gpp;
  1344. break;
  1345. }
  1346. decode_gtpv2_uli(tvb, pinfo, tree, NULL, length, 0, flags);
  1347. return length;
  1348. }
  1349. /*
  1350. * 8.22 Fully Qualified TEID (F-TEID)
  1351. */
  1352. static const value_string gtpv2_f_teid_interface_type_vals[] = {
  1353. {0, "S1-U eNodeB GTP-U interface"},
  1354. {1, "S1-U SGW GTP-U interface"},
  1355. {2, "S12 RNC GTP-U interface"},
  1356. {3, "S12 SGW GTP-U interface"},
  1357. {4, "S5/S8 SGW GTP-U interface"},
  1358. {5, "S5/S8 PGW GTP-U interface"},
  1359. {6, "S5/S8 SGW GTP-C interface"},
  1360. {7, "S5/S8 PGW GTP-C interface"},
  1361. {8, "S5/S8 SGW PMIPv6 interface"},/* (the 32 bit GRE key is encoded in 32 bit TEID field "
  1362. "and since alternate CoA is not used the control plane and user plane addresses are the same for PMIPv6)"}, */
  1363. {9, "S5/S8 PGW PMIPv6 interface"},/* (the 32 bit GRE key is encoded in 32 bit TEID field "
  1364. "and the control plane and user plane addresses are the same for PMIPv6)"}, */
  1365. {10, "S11 MME GTP-C interface"},
  1366. {11, "S11/S4 SGW GTP-C interface"},
  1367. {12, "S10 MME GTP-C interface"},
  1368. {13, "S3 MME GTP-C interface"},
  1369. {14, "S3 SGSN GTP-C interface"},
  1370. {15, "S4 SGSN GTP-U interface"},
  1371. {16, "S4 SGW GTP-U interface"},
  1372. {17, "S4 SGSN GTP-C interface"},
  1373. {18, "S16 SGSN GTP-C interface"},
  1374. {19, "eNodeB GTP-U interface for DL data forwarding"},
  1375. {20, "eNodeB GTP-U interface for UL data forwarding"},
  1376. {21, "RNC GTP-U interface for data forwarding"},
  1377. {22, "SGSN GTP-U interface for data forwarding"},
  1378. {23, "SGW GTP-U interface for data forwarding"},
  1379. {24, "Sm MBMS GW GTP-C interface"},
  1380. {25, "Sn MBMS GW GTP-C interface"},
  1381. {26, "Sm MME GTP-C interface"},
  1382. {27, "Sn SGSN GTP-C interface"},
  1383. {28, "SGW GTP-U interface for UL data forwarding"},
  1384. {29, "Sn SGSN GTP-U interface"},
  1385. {30, "S2b ePDG GTP-C interface"},
  1386. {31, "S2b-U ePDG GTP-U interface"},
  1387. {32, "S2b PGW GTP-C interface"},
  1388. {33, "S2b-U PGW GTP-U interface"},
  1389. {0, NULL}
  1390. };
  1391. static value_string_ext gtpv2_f_teid_interface_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_f_teid_interface_type_vals);
  1392. static const true_false_string gtpv2_f_teid_v4_vals = {
  1393. "IPv4 address present",
  1394. "IPv4 address not present",
  1395. };
  1396. static const true_false_string gtpv2_f_teid_v6_vals = {
  1397. "IPv6 address present",
  1398. "IPv6 address not present",
  1399. };
  1400. static void
  1401. dissect_gtpv2_f_teid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1402. {
  1403. int offset = 0;
  1404. guint8 flags;
  1405. flags = tvb_get_guint8(tvb, offset);
  1406. proto_tree_add_item(tree, hf_gtpv2_f_teid_v4, tvb, offset, 1, FALSE);
  1407. proto_tree_add_item(tree, hf_gtpv2_f_teid_v6, tvb, offset, 1, FALSE);
  1408. proto_tree_add_item(tree, hf_gtpv2_f_teid_interface_type, tvb, offset, 1, FALSE);
  1409. offset++;
  1410. proto_tree_add_item(tree, hf_gtpv2_f_teid_gre_key, tvb, offset, 4, FALSE);
  1411. proto_item_append_text(tree, "%s, TEID/GRE Key: 0x%s", val_to_str_ext_const((flags & 0x1f), &gtpv2_f_teid_interface_type_vals_ext, "Unknown"),
  1412. tvb_bytes_to_str(tvb, offset, 4));
  1413. offset= offset+4;
  1414. if (flags&0x80)
  1415. {
  1416. proto_tree_add_item(tree, hf_gtpv2_f_teid_ipv4, tvb, offset, 4, FALSE);
  1417. proto_item_append_text(item, ", IPv4 %s", tvb_ip_to_str(tvb, offset));
  1418. offset= offset+4;
  1419. }
  1420. if (flags&0x40)
  1421. {
  1422. proto_tree_add_item(tree, hf_gtpv2_f_teid_ipv6, tvb, offset, 16, FALSE);
  1423. proto_item_append_text(item, ", IPv6 %s", tvb_ip6_to_str(tvb, offset));
  1424. offset= offset+16;
  1425. }
  1426. }
  1427. /*
  1428. * 8.23 TMSI
  1429. */
  1430. static void
  1431. dissect_gtpv2_tmsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
  1432. {
  1433. proto_tree_add_item(tree, hf_gtpv2_tmsi, tvb, 0, 4, FALSE);
  1434. proto_tree_add_text(item, tvb, 0, length, "TMSI: %s", tvb_bytes_to_str(tvb, 0, 4));
  1435. }
  1436. /*
  1437. * 8.24 Global CN-Id
  1438. * (TS 23.003)
  1439. * 12.3 CN Identifier
  1440. *
  1441. * A CN node is uniquely identified within a PLMN by its CN Identifier (CN-Id). The CN-Id together with the PLMN
  1442. * identifier globally identifies the CN node. The CN-Id together with the PLMN-Id is used as the CN node identifier in
  1443. * RANAP signalling over the Iu interface.
  1444. * Global CN-Id = PLMN-Id || CN-Id
  1445. * The CN-Id is defined by the operator, and set in the nodes via O&M.
  1446. * For the syntax description and the use of this identifier in RANAP signalling, see 3GPP TS 25.413 [17].
  1447. */
  1448. static void
  1449. dissect_gtpv2_g_cn_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_)
  1450. {
  1451. int offset = 0;
  1452. dissect_e212_mcc_mnc(tvb, pinfo, tree, 0, TRUE);
  1453. offset +=3;
  1454. /* >CN-ID M INTEGER (0..4095) */
  1455. proto_tree_add_text(tree, tvb, offset, 2, "CN-Id: %s",
  1456. tvb_bytes_to_str(tvb, offset, 2));
  1457. }
  1458. /*
  1459. * 8.25 S103 PDN Data Forwarding Info (S103PDF)
  1460. */
  1461. static void
  1462. dissect_gtpv2_s103pdf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1463. {
  1464. proto_item *expert_item;
  1465. int offset = 0;
  1466. guint8 m,k,i;
  1467. /* The HSGW Address and GRE Key identify a GRE Tunnel towards a HSGW over S103 interface for a specific PDN
  1468. * connection of the UE. The EPS Bearer IDs specify the EPS Bearers which require data forwarding that belonging to this
  1469. * PDN connection. The number of EPS bearer Ids included is specified by the value of EPS Bearer ID Number.
  1470. */
  1471. /* Octet 5 HSGW Address for forwarding Length = m */
  1472. m = tvb_get_guint8(tvb, offset);
  1473. proto_tree_add_item(tree, hf_gtpv2_hsgw_addr_f_len, tvb, offset, 1, FALSE);
  1474. offset++;
  1475. /* 6 to (m+5) HSGW Address for forwarding [4..16] */
  1476. switch(m) {
  1477. case 4:
  1478. /* IPv4 */
  1479. proto_tree_add_item(tree, hf_gtpv2_hsgw_addr_ipv4, tvb, offset, 1, FALSE);
  1480. offset+=4;
  1481. break;
  1482. case 16:
  1483. /* IPv6 */
  1484. proto_tree_add_item(tree, hf_gtpv2_hsgw_addr_ipv6, tvb, offset, 1, FALSE);
  1485. offset+=16;
  1486. break;
  1487. default:
  1488. /* Error */
  1489. expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length %u, should be 4 or 16",m);
  1490. expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_ERROR, "Wrong length %u, should be 4 or 16",m);
  1491. PROTO_ITEM_SET_GENERATED(expert_item);
  1492. return;
  1493. }
  1494. /* (m+6)- to (m+9) GRE Key */
  1495. proto_tree_add_item(tree, hf_gtpv2_gre_key, tvb, offset, 4, FALSE);
  1496. offset+=4;
  1497. /* (m+10) EPS Bearer ID Number = k */
  1498. k = tvb_get_guint8(tvb, offset);
  1499. proto_tree_add_text(tree, tvb, offset, 1, "EPS Bearer ID Number = %d", k);
  1500. offset += 1;
  1501. /* (m+11) to (m+10+k)
  1502. * Spare EPS Bearer ID
  1503. */
  1504. for ( i = 0; i < k; i++ ){
  1505. proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 4, FALSE);
  1506. proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 1, FALSE);
  1507. offset++;
  1508. }
  1509. }
  1510. /*
  1511. * 8.26 S1-U Data Forwarding (S1UDF)
  1512. */
  1513. static void
  1514. dissect_gtpv2_s1udf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
  1515. {
  1516. proto_item *expert_item;
  1517. int offset = 0;
  1518. guint8 m;
  1519. /* 5 Spare EPS Bearer ID */
  1520. proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 4, FALSE);
  1521. proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 1, FALSE);
  1522. offset++;
  1523. /* 6 Serving GW Address Length = m */
  1524. m = tvb_get_guint8(tvb, offset);
  1525. proto_tree_add_text(tree, tvb, offset, 1, "Serving GW Address Length = %u", m);
  1526. offset++;
  1527. /* 7 to (m+6) Serving GW Address [4..16] */
  1528. switch(m) {
  1529. case 4:
  1530. /* IPv4 */
  1531. proto_tree_add_item(tree, hf_gtpv2_sgw_addr_ipv4, tvb, offset, 1, FALSE);
  1532. offset+=4;
  1533. break;
  1534. case 16:
  1535. /* IPv6 */
  1536. proto_tree_add_item(tree, hf_gtpv2_sgw_addr_ipv6, tvb, offset, 1, FALSE);
  1537. offset+=16;
  1538. break;
  1539. default:
  1540. /* Error */
  1541. expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length %u, should be 4 or 16",m);
  1542. expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_ERROR, "Wrong length %u, should be 4 or 16",m);
  1543. PROTO_ITEM_SET_GENERATED(expert_item);
  1544. return;
  1545. }
  1546. /* (m+7) to (m+10)
  1547. * Serving GW S1-U TEID
  1548. */
  1549. proto_tree_add_item(tree, hf_gtpv2_sgw_s1u_teid, tvb, offset, 4, FALSE);
  1550. }
  1551. /*
  1552. * 8.27 Delay Value
  1553. */
  1554. static void
  1555. 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_)
  1556. {
  1557. int offset = 0;
  1558. proto_tree_add_item(tree, hf_gtpv2_delay_value, tvb, offset, 1, FALSE);
  1559. }
  1560. /*
  1561. * 8.28 Bearer Context (grouped IE)
  1562. */
  1563. static void
  1564. dissect_gtpv2_bearer_ctx(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  1565. {
  1566. int offset= 0;
  1567. tvbuff_t *new_tvb;
  1568. proto_tree *grouped_tree;
  1569. proto_item_append_text(item, "[Grouped IE]");
  1570. grouped_tree = proto_item_add_subtree(item, ett_gtpv2_bearer_ctx);
  1571. new_tvb = tvb_new_subset(tvb, offset, length, length );
  1572. dissect_gtpv2_ie_common(new_tvb, pinfo, grouped_tree, 0, message_type);
  1573. }
  1574. /* 8.29 Charging ID */
  1575. static void
  1576. dissect_gtpv2_charging_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_)
  1577. {
  1578. int offset = 0;
  1579. proto_tree_add_item(tree, hf_gtpv2_charging_id, tvb, offset, length, FALSE);
  1580. }
  1581. /* 8.30 Charging Characteristics
  1582. * The charging characteristics information element is defined in 3GPP TS 32.251 [8]
  1583. * and is a way of informing both the SGW and PGW of the rules for producing charging
  1584. * information based on operator configured triggers. For the encoding of this
  1585. * information element see 3GPP TS 32.298 [9].
  1586. */
  1587. static void
  1588. dissect_gtpv2_char_char(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1589. {
  1590. int offset = 0;
  1591. proto_tree_add_item(tree, hf_gtpv2_charging_characteristic, tvb, offset, 2, FALSE);
  1592. if(length>2){
  1593. offset+=2;
  1594. /* These octet(s) is/are present only if explicitly specified */
  1595. proto_tree_add_text(tree, tvb, offset, length-2, "Remaining octets");
  1596. }
  1597. }
  1598. /*
  1599. * 8.30 Bearer Flag
  1600. */
  1601. static void
  1602. dissect_gtpv2_bearer_flag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1603. {
  1604. int offset = 0;
  1605. /* Octet 5 Spare VB PPC */
  1606. proto_tree_add_item(tree, hf_gtpv2_bearer_flag_ppc, tvb, offset, length, FALSE);
  1607. proto_tree_add_item(tree, hf_gtpv2_bearer_flag_vb, tvb, offset, length, FALSE);
  1608. }
  1609. /*
  1610. * 8.34 PDN Type
  1611. */
  1612. static void
  1613. dissect_gtpv2_pdn_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1614. {
  1615. int offset = 0;
  1616. guint8 pdn;
  1617. if (length != 1) {
  1618. proto_item *expert_item;
  1619. expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
  1620. expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
  1621. PROTO_ITEM_SET_GENERATED(expert_item);
  1622. return;
  1623. }
  1624. proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, FALSE);
  1625. pdn = tvb_get_guint8(tvb, offset)& 0x7;
  1626. proto_tree_add_item(tree, hf_gtpv2_pdn_type, tvb, offset, length, FALSE);
  1627. proto_item_append_text(tree, "%s", val_to_str(pdn, gtpv2_pdn_type_vals, "Unknown"));
  1628. }
  1629. /*
  1630. * 8.31 Trace Information
  1631. */
  1632. static void
  1633. dissect_gtpv2_tra_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
  1634. {
  1635. proto_item *trigg, *msc_server, *mgw, *sgsn, *ggsn, *bm_sc, *sgw_mme, *ne_types;
  1636. proto_tree *trigg_tree, *msc_server_tree, *mgw_tree, *sgsn_tree, *ggsn_tree, *bm_sc_tree, *sgw_mme_tree, *ne_types_tree;
  1637. proto_item *interfaces, *imsc_server, *lmgw, *lsgsn, *lggsn, *lrnc, *lbm_sc, *lmme, *lsgw, *lpdn_gw, *lenb;
  1638. proto_tree *interfaces_tree, *imsc_server_tree, *lmgw_tree, *lsgsn_tree, *lggsn_tree, *lrnc_tree, *lbm_sc_tree, *lmme_tree, *lsgw_tree, *lpdn_gw_tree, *lenb_tree;
  1639. int offset = 0;
  1640. /*--------------------------------------------------
  1641. * guint8 *trace_id = NULL;
  1642. *--------------------------------------------------*/
  1643. guint8 tdl;
  1644. guint16 tid;
  1645. guint32 bit_offset;
  1646. dissect_e212_mcc_mnc(tvb, pinfo, tree, 0, TRUE);
  1647. offset +=3;
  1648. /* Append Trace ID to main tree */
  1649. tid = tvb_get_ntohs(tvb, offset);
  1650. proto_item_append_text(tree, "Trace ID: %d ", tid);
  1651. /* Trace ID */
  1652. /*--------------------------------------------------
  1653. * trace_id = tvb_format_text(tvb, offset, 2);
  1654. * proto_tree_add_string(tree, hf_gtpv2_tra_info, tvb, offset, length, trace_id);
  1655. *--------------------------------------------------*/
  1656. proto_tree_add_text(tree, tvb, offset, 3, "Trace ID: %d", tid);
  1657. offset +=3;
  1658. /* Triggering Events, put all into a new tree called trigging_tree */
  1659. trigg = proto_tree_add_text(tree, tvb, offset, 8, "Trigging Events");
  1660. trigg_tree = proto_item_add_subtree(trigg, ett_gtpv2_tra_info_trigg);
  1661. /* Create all subtrees */
  1662. msc_server = proto_tree_add_text(trigg_tree, tvb, offset, 2, "MSC Server");
  1663. msc_server_tree = proto_item_add_subtree(msc_server, ett_gtpv2_tra_info_trigg_msc_server);
  1664. mgw = proto_tree_add_text(trigg_tree, tvb, offset + 2, 1, "MGW");
  1665. mgw_tree = proto_item_add_subtree(mgw, ett_gtpv2_tra_info_trigg_mgw);
  1666. sgsn = proto_tree_add_text(trigg_tree, tvb, offset + 3, 2, "SGSN");
  1667. sgsn_tree = proto_item_add_subtree(sgsn, ett_gtpv2_tra_info_trigg_sgsn);
  1668. ggsn = proto_tree_add_text(trigg_tree, tvb, offset + 5, 1, "GGSN");
  1669. ggsn_tree = proto_item_add_subtree(ggsn, ett_gtpv2_tra_info_trigg_ggsn);
  1670. bm_sc = proto_tree_add_text(trigg_tree, tvb, offset + 6, 1, "BM-SC");
  1671. bm_sc_tree = proto_item_add_subtree(bm_sc, ett_gtpv2_tra_info_trigg_bm_sc);
  1672. sgw_mme = proto_tree_add_text(trigg_tree, tvb, offset + 7, 1, "SGW MME");
  1673. sgw_mme_tree = proto_item_add_subtree(sgw_mme, ett_gtpv2_tra_info_trigg_sgw_mme);
  1674. /* MSC Server - 2 octets */
  1675. proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_momt_calls, tvb, offset, 1, FALSE);
  1676. proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_momt_sms, tvb, offset, 1, FALSE);
  1677. proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_lu_imsi_ad, tvb, offset, 1, FALSE);
  1678. proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_handovers, tvb, offset, 1, FALSE);
  1679. proto_tree_add_item(msc_server_tree, hf_gtpv2_tra_info_msc_ss, tvb, offset, 1, FALSE);
  1680. bit_offset = offset<<3;
  1681. proto_tree_add_bits_item(msc_server_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 3, FALSE);
  1682. offset += 1;
  1683. bit_offset = offset<<3;
  1684. proto_tree_add_bits_item(msc_server_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 8, FALSE);
  1685. offset += 1;
  1686. /* MGW - 1 octet */
  1687. proto_tree_add_item(mgw_tree, hf_gtpv2_tra_info_mgw_context, tvb, offset, 1, FALSE);
  1688. bit_offset = offset<<3;
  1689. proto_tree_add_bits_item(mgw_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 7, FALSE);
  1690. offset += 1;
  1691. /* SGSN - 2 octets */
  1692. proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_pdp_context, tvb, offset, 1, FALSE);
  1693. proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_momt_sms, tvb, offset, 1, FALSE);
  1694. proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_rau_gprs_ad, tvb, offset, 1, FALSE);
  1695. proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_mbms, tvb, offset, 1, FALSE);
  1696. bit_offset = offset<<3;
  1697. proto_tree_add_bits_item(sgsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 4, FALSE);
  1698. offset += 1;
  1699. proto_tree_add_item(sgsn_tree, hf_gtpv2_tra_info_sgsn_reserved, tvb, offset, 1, FALSE);
  1700. bit_offset = offset<<3;
  1701. proto_tree_add_bits_item(sgsn_tree, hf_gtpv2_reserved, tvb, bit_offset, 8, FALSE);
  1702. offset += 1;
  1703. /* GGSN - 1 octet */
  1704. proto_tree_add_item(ggsn_tree, hf_gtpv2_tra_info_ggsn_pdp, tvb, offset, 1, FALSE);
  1705. proto_tree_add_item(ggsn_tree, hf_gtpv2_tra_info_ggsn_mbms, tvb, offset, 1, FALSE);
  1706. bit_offset = offset<<3;
  1707. proto_tree_add_bits_item(ggsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 6, FALSE);
  1708. offset += 1;
  1709. /* BM-SC - 1 octet */
  1710. proto_tree_add_item(bm_sc_tree, hf_gtpv2_tra_info_bm_sc, tvb, offset, 1, FALSE);
  1711. bit_offset = offset<<3;
  1712. proto_tree_add_bits_item(bm_sc_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 7, FALSE);
  1713. offset += 1;
  1714. /* MME/SGW - 1 octet */
  1715. proto_tree_add_item(sgw_mme_tree, hf_gtpv2_tra_info_mme_sgw_ss, tvb, offset, 1, FALSE);
  1716. proto_tree_add_item(sgw_mme_tree, hf_gtpv2_tra_info_mme_sgw_sr, tvb, offset, 1, FALSE);
  1717. proto_tree_add_item(sgw_mme_tree, hf_gtpv2_tra_info_mme_sgw_iataud, tvb, offset, 1, FALSE);
  1718. bit_offset = offset<<3;
  1719. proto_tree_add_bits_item(sgw_mme_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, FALSE);
  1720. offset += 1;
  1721. /* Create NE Types subtree */
  1722. ne_types = proto_tree_add_text(tree, tvb, offset, 2, "List of NE Types");
  1723. ne_types_tree = proto_item_add_subtree(ne_types, ett_gtpv2_tra_info_ne_types);
  1724. /* List of NE Types */
  1725. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_msc_s, tvb, offset, 1, FALSE);
  1726. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_mgw, tvb, offset, 1, FALSE);
  1727. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_sgsn, tvb, offset, 1, FALSE);
  1728. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_ggsn, tvb, offset, 1, FALSE);
  1729. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_rnc, tvb, offset, 1, FALSE);
  1730. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_bm_sc, tvb, offset, 1, FALSE);
  1731. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_mme, tvb, offset, 1, FALSE);
  1732. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_sgw, tvb, offset, 1, FALSE);
  1733. offset += 1;
  1734. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_pdn_gw, tvb, offset, 1, FALSE);
  1735. proto_tree_add_item(ne_types_tree, hf_gtpv2_tra_info_lne_enb, tvb, offset, 1, FALSE);
  1736. bit_offset = offset<<3;
  1737. proto_tree_add_bits_item(ne_types_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 6, FALSE);
  1738. offset += 1;
  1739. /* Trace Depth Length */
  1740. tdl = tvb_get_guint8(tvb, offset);
  1741. proto_tree_add_item(tree, hf_gtpv2_tra_info_tdl, tvb, offset, 1, FALSE);
  1742. offset += 1;
  1743. /* Trace Depth List
  1744. * Will be displayed if length of Trace Depth Length is > 0
  1745. * The list will only contains UTF8String, RAW DATA
  1746. */
  1747. proto_tree_add_text(tree, tvb, offset, tdl, "Trace Depth List: %s", tvb_bytes_to_str(tvb, offset, tdl));
  1748. offset += tdl;
  1749. /* Set up subtree interfaces and put all interfaces under it */
  1750. interfaces = proto_tree_add_text(tree, tvb, offset, 12, "List of Interfaces");
  1751. interfaces_tree = proto_item_add_subtree(interfaces, ett_gtpv2_tra_info_interfaces);
  1752. /* Create all subtrees */
  1753. imsc_server = proto_tree_add_text(interfaces_tree, tvb, offset, 2, "MSC Server");
  1754. imsc_server_tree = proto_item_add_subtree(imsc_server, ett_gtpv2_tra_info_interfaces_imsc_server);
  1755. lmgw = proto_tree_add_text(interfaces_tree, tvb, offset + 2, 1, "MGW");
  1756. lmgw_tree = proto_item_add_subtree(lmgw, ett_gtpv2_tra_info_interfaces_lmgw);
  1757. lsgsn = proto_tree_add_text(interfaces_tree, tvb, offset + 3, 2, "SGSN");
  1758. lsgsn_tree = proto_item_add_subtree(lsgsn, ett_gtpv2_tra_info_interfaces_lsgsn);
  1759. lggsn = proto_tree_add_text(interfaces_tree, tvb, offset + 5, 1, "GGSN");
  1760. lggsn_tree = proto_item_add_subtree(lggsn, ett_gtpv2_tra_info_interfaces_lggsn);
  1761. lrnc = proto_tree_add_text(interfaces_tree, tvb, offset + 6, 1, "RNC");
  1762. lrnc_tree = proto_item_add_subtree(lrnc, ett_gtpv2_tra_info_interfaces_lrnc);
  1763. lbm_sc = proto_tree_add_text(interfaces_tree, tvb, offset + 7, 1, "BM-SC");
  1764. lbm_sc_tree = proto_item_add_subtree(lbm_sc, ett_gtpv2_tra_info_interfaces_lbm_sc);
  1765. lmme = proto_tree_add_text(interfaces_tree, tvb, offset + 8, 1, "MME");
  1766. lmme_tree = proto_item_add_subtree(lmme, ett_gtpv2_tra_info_interfaces_lmme);
  1767. lsgw = proto_tree_add_text(interfaces_tree, tvb, offset + 9, 1, "SGW");
  1768. lsgw_tree = proto_item_add_subtree(lsgw, ett_gtpv2_tra_info_interfaces_lsgw);
  1769. lpdn_gw = proto_tree_add_text(interfaces_tree, tvb, offset + 10, 1, "PDN GW");
  1770. lpdn_gw_tree = proto_item_add_subtree(lpdn_gw, ett_gtpv2_tra_info_interfaces_lpdn_gw);
  1771. lenb = proto_tree_add_text(interfaces_tree, tvb, offset + 11, 1, "eNB");
  1772. lenb_tree = proto_item_add_subtree(lenb, ett_gtpv2_tra_info_interfaces_lpdn_lenb);
  1773. /* MSC Server - 2 octests */
  1774. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_a, tvb, offset, 1, FALSE);
  1775. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_lu, tvb, offset, 1, FALSE);
  1776. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_mc, tvb, offset, 1, FALSE);
  1777. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_g, tvb, offset, 1, FALSE);
  1778. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_b, tvb, offset, 1, FALSE);
  1779. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_e, tvb, offset, 1, FALSE);
  1780. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_f, tvb, offset, 1, FALSE);
  1781. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_cap, tvb, offset, 1, FALSE);
  1782. offset += 1;
  1783. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_d, tvb, offset, 1, FALSE);
  1784. proto_tree_add_item(imsc_server_tree, hf_gtpv2_tra_info_lmsc_map_c, tvb, offset, 1, FALSE);
  1785. bit_offset = offset<<3;
  1786. proto_tree_add_bits_item(imsc_server_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 6, FALSE);
  1787. offset += 1;
  1788. /* MGW - 1 octet */
  1789. proto_tree_add_item(lmgw_tree, hf_gtpv2_tra_info_lmgw_mc, tvb, offset, 1, FALSE);
  1790. proto_tree_add_item(lmgw_tree, hf_gtpv2_tra_info_lmgw_nb_up, tvb, offset, 1, FALSE);
  1791. proto_tree_add_item(lmgw_tree, hf_gtpv2_tra_info_lmgw_lu_up, tvb, offset, 1, FALSE);
  1792. bit_offset = offset<<3;
  1793. proto_tree_add_bits_item(lmgw_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, FALSE);
  1794. offset += 1;
  1795. /* SGSN - 2 octets */
  1796. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_gb, tvb, offset, 1, FALSE);
  1797. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_lu, tvb, offset, 1, FALSE);
  1798. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_gn, tvb, offset, 1, FALSE);
  1799. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_map_gr, tvb, offset, 1, FALSE);
  1800. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_map_gd, tvb, offset, 1, FALSE);
  1801. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_map_gf, tvb, offset, 1, FALSE);
  1802. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_gs, tvb, offset, 1, FALSE);
  1803. proto_tree_add_item(lsgsn_tree, hf_gtpv2_tra_info_lsgsn_ge, tvb, offset, 1, FALSE);
  1804. offset += 1;
  1805. bit_offset = offset<<3;
  1806. proto_tree_add_bits_item(lsgsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 8, FALSE);
  1807. offset += 1;
  1808. /* GGSN - 1 octet */
  1809. proto_tree_add_item(lggsn_tree, hf_gtpv2_tra_info_lggsn_gn, tvb, offset, 1, FALSE);
  1810. proto_tree_add_item(lggsn_tree, hf_gtpv2_tra_info_lggsn_gi, tvb, offset, 1, FALSE);
  1811. proto_tree_add_item(lggsn_tree, hf_gtpv2_tra_info_lggsn_gmb, tvb, offset, 1, FALSE);
  1812. bit_offset = offset<<3;
  1813. proto_tree_add_bits_item(lggsn_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, FALSE);
  1814. offset += 1;
  1815. /* RNC - 1 octet */
  1816. proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_lu, tvb, offset, 1, FALSE);
  1817. proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_lur, tvb, offset, 1, FALSE);
  1818. proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_lub, tvb, offset, 1, FALSE);
  1819. proto_tree_add_item(lrnc_tree, hf_gtpv2_tra_info_lrnc_uu, tvb, offset, 1, FALSE);
  1820. bit_offset = offset<<3;
  1821. proto_tree_add_bits_item(lrnc_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 4, FALSE);
  1822. offset += 1;
  1823. /* BM_SC - 1 octet */
  1824. proto_tree_add_item(lbm_sc_tree, hf_gtpv2_tra_info_lbm_sc_gmb, tvb, offset, 1, FALSE);
  1825. bit_offset = offset<<3;
  1826. proto_tree_add_bits_item(lbm_sc_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 7, FALSE);
  1827. offset += 1;
  1828. /* MME - 1 octet */
  1829. proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s1_mme, tvb, offset, 1, FALSE);
  1830. proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s3, tvb, offset, 1, FALSE);
  1831. proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s6a, tvb, offset, 1, FALSE);
  1832. proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s10, tvb, offset, 1, FALSE);
  1833. proto_tree_add_item(lmme_tree, hf_gtpv2_tra_info_lmme_s11, tvb, offset, 1, FALSE);
  1834. bit_offset = offset<<3;
  1835. proto_tree_add_bits_item(lmme_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 3, FALSE);
  1836. offset += 1;
  1837. /* SGW - 1 octet */
  1838. proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s4, tvb, offset, 1, FALSE);
  1839. proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s5, tvb, offset, 1, FALSE);
  1840. proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s8b, tvb, offset, 1, FALSE);
  1841. proto_tree_add_item(lsgw_tree, hf_gtpv2_tra_info_lsgw_s11, tvb, offset, 1, FALSE);
  1842. bit_offset = offset<<3;
  1843. proto_tree_add_bits_item(lsgw_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 4, FALSE);
  1844. offset += 1;
  1845. /* PDN GW - 1 octet */
  1846. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s2a, tvb, offset, 1, FALSE);
  1847. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s2b, tvb, offset, 1, FALSE);
  1848. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s2c, tvb, offset, 1, FALSE);
  1849. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s5, tvb, offset, 1, FALSE);
  1850. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s6c, tvb, offset, 1, FALSE);
  1851. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_gx, tvb, offset, 1, FALSE);
  1852. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_s8b, tvb, offset, 1, FALSE);
  1853. proto_tree_add_item(lpdn_gw_tree, hf_gtpv2_tra_info_lpdn_gw_sgi, tvb, offset, 1, FALSE);
  1854. offset += 1;
  1855. /* eNB - 1 octet */
  1856. proto_tree_add_item(lenb_tree, hf_gtpv2_tra_info_lenb_s1_mme, tvb, offset, 1, FALSE);
  1857. proto_tree_add_item(lenb_tree, hf_gtpv2_tra_info_lenb_x2, tvb, offset, 1, FALSE);
  1858. proto_tree_add_item(lenb_tree, hf_gtpv2_tra_info_lenb_uu, tvb, offset, 1, FALSE);
  1859. bit_offset = offset<<3;
  1860. proto_tree_add_bits_item(lenb_tree, hf_gtpv2_spare_bits, tvb, bit_offset, 5, FALSE);
  1861. /*--------------------------------------------------
  1862. * offset += 1;
  1863. *--------------------------------------------------*/
  1864. /* IP Address of Trace Collection Entity */
  1865. while ( (offset + 4) <= length ) {
  1866. offset += 1;
  1867. proto_tree_add_item(tree, hf_gtpv2_ipv4_addr, tvb, offset, 4, FALSE);
  1868. offset += 3;
  1869. }
  1870. }
  1871. /*
  1872. * 8.33 Paging Cause
  1873. * 8.33 Void (TS 129 274 V9.4.0 (2010-10))
  1874. */
  1875. /* 8.35 Procedure Transaction ID (PTI) */
  1876. static void
  1877. 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_)
  1878. {
  1879. proto_tree_add_item(tree, hf_gtpv2_pti, tvb, 0, 1, FALSE);
  1880. }
  1881. /*
  1882. * 8.36 DRX Parameter
  1883. */
  1884. static void
  1885. 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_)
  1886. {
  1887. int offset = 0;
  1888. /* 36.413 : 9.2.1.17 Paging Cause, void */
  1889. proto_tree_add_text(tree, tvb, offset, length, "DRX parameter: %s", tvb_bytes_to_str(tvb, offset, (length )));
  1890. }
  1891. /*
  1892. * 8.37 UE Network Capability
  1893. * UE Network Capability is coded as depicted in Figure 8.37-1. Actual coding of the UE Network Capability field is
  1894. * defined in 3GPP TS 24.301
  1895. */
  1896. static void
  1897. dissect_gtpv2_ue_net_capability(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_)
  1898. {
  1899. de_emm_ue_net_cap(tvb, tree, pinfo, 0, length, NULL, 0);
  1900. }
  1901. /*
  1902. * 8.38 MM Context
  1903. */
  1904. static const value_string gtpv2_mm_context_security_mode[] = {
  1905. {0, "GSM Key and Triplets"},
  1906. {1, "UMTS Key, Used Cipher and Quintuplets"},
  1907. {2, "GSM Key, Used Cipher and Quintuplets"},
  1908. {3, "UMTS Key and Quintuplets"},
  1909. {4, "EPS Security Context, Quadruplets and Quintuplets" },
  1910. {5, "UMTS Key, Quadruplets and Quintuplets"},
  1911. {0, NULL }
  1912. };
  1913. static const true_false_string gtpv2_nhi_vals = {
  1914. "NH (Next Hop) and NCC (Next Hop Chaining Count) are both present",
  1915. "NH (Next Hop) and NCC (Next Hop Chaining Count) not present",
  1916. };
  1917. /* Table 8.38-2: Used NAS Cipher Values */
  1918. static const value_string gtpv2_mm_context_unc_vals[] = {
  1919. {0, "No ciphering"},
  1920. {1, "GEA/1"},
  1921. {2, "GEA/2"},
  1922. {3, "GEA/3"},
  1923. {4, "GEA/4" },
  1924. {5, "GEA/5"},
  1925. {6, "GEA/6"},
  1926. {7, "GEA/7"},
  1927. {0, NULL }
  1928. };
  1929. /* Table 8.38-4: Used NAS integrity protection algorithm Values */
  1930. static const value_string gtpv2_mm_context_unipa_vals[] = {
  1931. {0, "No ciphering"},
  1932. {1, "128-EEA1"},
  1933. {2, "128-EEA2"},
  1934. {3, "EEA3"},
  1935. {4, "EEA4" },
  1936. {5, "EEA5"},
  1937. {6, "EEA6"},
  1938. {7, "EEA7"},
  1939. {0, NULL }
  1940. };
  1941. static void
  1942. dissect_gtpv2_mm_context_gsm_t(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  1943. {
  1944. proto_item *flag;
  1945. proto_tree *flag_tree;
  1946. int offset;
  1947. offset = 0;
  1948. flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
  1949. flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
  1950. /* Security Mode | Spare | DRXI | CKSN */
  1951. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, FALSE);
  1952. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset<<3, 1, FALSE);
  1953. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, FALSE);
  1954. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_cksn, tvb, offset, 1, FALSE);
  1955. offset += 1;
  1956. /* Number of Triplet | Spare | UAMB RI | SAMB RI */
  1957. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_tri, tvb, offset, 1, FALSE);
  1958. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, FALSE);
  1959. offset += 1;
  1960. proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
  1961. }
  1962. static void
  1963. 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_)
  1964. {
  1965. proto_item *flag;
  1966. proto_tree *flag_tree;
  1967. int offset;
  1968. offset = 0;
  1969. flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
  1970. flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
  1971. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, FALSE);
  1972. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset<<3)+3), 1, FALSE);
  1973. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, FALSE);
  1974. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_cksn_ksi, tvb, offset, 1, FALSE);
  1975. offset += 1;
  1976. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, FALSE);
  1977. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, FALSE);
  1978. offset += 1;
  1979. proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
  1980. }
  1981. static void
  1982. 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_)
  1983. {
  1984. proto_item *flag;
  1985. proto_tree *flag_tree;
  1986. int offset;
  1987. offset = 0;
  1988. flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
  1989. flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
  1990. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, FALSE);
  1991. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset<<3)+3), 1, FALSE);
  1992. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, FALSE);
  1993. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_cksn_ksi, tvb, offset, 1, FALSE);
  1994. offset += 1;
  1995. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, FALSE);
  1996. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, FALSE);
  1997. offset += 1;
  1998. proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
  1999. }
  2000. static void
  2001. dissect_gtpv2_mm_context_utms_q(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2002. {
  2003. proto_item *flag;
  2004. proto_tree *flag_tree;
  2005. int offset;
  2006. offset = 0;
  2007. flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
  2008. flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
  2009. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, FALSE);
  2010. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset<<3)+3), 1, FALSE);
  2011. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, FALSE);
  2012. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_ksi, tvb, offset, 1, FALSE);
  2013. offset += 1;
  2014. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, FALSE);
  2015. proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, FALSE);
  2016. offset += 1;
  2017. proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
  2018. }
  2019. /* EPS Security Context and Quadruplets */
  2020. static void
  2021. dissect_gtpv2_mm_context_eps_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_)
  2022. {
  2023. proto_item *flag/*, *auth_qua, *net_cap*/;
  2024. proto_tree *flag_tree/*, *auth_qua_tree, *net_cap_tree*/;
  2025. guint32 offset/*, nas_dc, nas_uc, i*/;
  2026. /*guint8 nhi, drxi, nr_qui, nr_qua, tmp;*/
  2027. offset = 0;
  2028. /*nhi = (tvb_get_guint8(tvb, offset) & 0x10);*/
  2029. /*drxi = (tvb_get_guint8(tvb, offset) & 0x08);*/
  2030. flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
  2031. flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
  2032. /* Octet 5
  2033. * Bits
  2034. * 8 7 6 5 4 3 2 1
  2035. * Security Mode | NHI | DRXI | KSIASME
  2036. */
  2037. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, FALSE);
  2038. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nhi, tvb, offset, 1, FALSE);
  2039. /* If NHI (Next Hop Indicator), bit 5 of octet 5, is set to "1",
  2040. * then the optional parameters NH (Next Hop) and NCC (Next
  2041. * Hop Chaining Count) are both present, otherwise their octets are not present.
  2042. */
  2043. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, FALSE);
  2044. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_ksi_a, tvb, offset, 1, FALSE);
  2045. offset += 1;
  2046. /* Octet 6
  2047. * Bits
  2048. * 8 7 6 5 4 3 2 1
  2049. * Number of | Number of | UAMB | OSCI
  2050. * Quintuplets | Quadruplet | RI |
  2051. */
  2052. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, FALSE);
  2053. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qua, tvb, offset, 1, FALSE);
  2054. /* Octet 7 */
  2055. /* Used NAS integrity protection algorithm */
  2056. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_unipa, tvb, offset, 1, FALSE);
  2057. /* Used NAS Cipher */
  2058. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_unc, tvb, offset, 1, FALSE);
  2059. offset += 1;
  2060. /* Octet 8-10 NAS Downlink Count*/
  2061. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nas_dl_cnt, tvb, offset, 1, FALSE);
  2062. offset += 3;
  2063. /* Octet 11-13 NAS Uplink Count */
  2064. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nas_ul_cnt, tvb, offset, 1, FALSE);
  2065. offset += 3;
  2066. proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet");
  2067. }
  2068. static void
  2069. 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_)
  2070. {
  2071. proto_item *flag;
  2072. proto_tree *flag_tree;
  2073. guint32 offset;
  2074. offset = 0;
  2075. flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags");
  2076. flag_tree = proto_item_add_subtree(flag, ett_gtpv2_mm_context_flag);
  2077. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, FALSE);
  2078. proto_tree_add_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset<<3)+3), 1, FALSE);
  2079. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, FALSE);
  2080. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_ksi_a, tvb, offset, 1, FALSE);
  2081. offset += 1;
  2082. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, FALSE);
  2083. proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qua, tvb, offset, 1, FALSE);
  2084. proto_tree_add_item(flag_tree, hf_gtpv2_spare_bits, tvb, offset<<3, 2, FALSE);
  2085. }
  2086. /*
  2087. * 8.39 PDN Connection (grouped IE)
  2088. */
  2089. static void
  2090. dissect_gtpv2_PDN_conn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2091. {
  2092. int offset= 0;
  2093. proto_tree *grouped_tree;
  2094. tvbuff_t *new_tvb;
  2095. proto_item_append_text(item, "[Grouped IE]");
  2096. grouped_tree = proto_item_add_subtree(item, ett_gtpv2_PDN_conn);
  2097. new_tvb = tvb_new_subset(tvb, offset, length, length );
  2098. dissect_gtpv2_ie_common(tvb, pinfo, grouped_tree, offset, message_type);
  2099. }
  2100. /*
  2101. * 8.40 PDU Numbers
  2102. */
  2103. static void
  2104. dissect_gtpv2_pdn_numbers(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2105. {
  2106. proto_item *nsapi_ti;
  2107. proto_tree *nsapi_tree;
  2108. guint8 nsapi;
  2109. guint16 dlgtpu_seq, ulgtpu_seq, send_npdu_nr, rec_npdu_nr;
  2110. int offset = 0;
  2111. nsapi = (tvb_get_guint8(tvb, offset) & 0x08);
  2112. nsapi_ti = proto_tree_add_text(tree, tvb, offset, 1, "NSAPI: %d", nsapi);
  2113. nsapi_tree = proto_item_add_subtree(nsapi_ti, ett_gtpv2_pdn_numbers_nsapi);
  2114. proto_tree_add_item(nsapi_tree, hf_gtpv2_spare_bits, tvb, offset<<3, 4, FALSE);
  2115. proto_tree_add_item(nsapi_tree, hf_gtpv2_pdn_numbers_nsapi, tvb, offset, 1, FALSE);
  2116. proto_item_append_text(tree, "NSAPI: %u", nsapi);
  2117. offset++;
  2118. dlgtpu_seq = tvb_get_ntohs(tvb, offset);
  2119. proto_tree_add_text(tree, tvb, offset, 2, "DL GTP-U Sequence Number: %d", dlgtpu_seq);
  2120. offset += 2;
  2121. ulgtpu_seq = tvb_get_ntohs(tvb, offset);
  2122. proto_tree_add_text(tree, tvb, offset, 2, "UL GTP-U Sequence Number: %d", ulgtpu_seq);
  2123. offset += 2;
  2124. send_npdu_nr = tvb_get_ntohs(tvb, offset);
  2125. proto_tree_add_text(tree, tvb, offset, 2, "Send N-PDU Number: %d", send_npdu_nr);
  2126. offset += 2;
  2127. rec_npdu_nr = tvb_get_ntohs(tvb, offset);
  2128. proto_tree_add_text(tree, tvb, offset, 2, "Receive N-PDU Number: %d", rec_npdu_nr);
  2129. }
  2130. /*
  2131. * 8.41 Packet TMSI (P-TMSI)
  2132. */
  2133. static void
  2134. dissect_gtpv2_p_tmsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2135. {
  2136. int offset = 0;
  2137. /* The TMSI consists of 4 octets. It can be coded using a full hexadecimal representation. */
  2138. proto_tree_add_item(tree, hf_gtpv2_p_tmsi, tvb, offset, 4, FALSE);
  2139. proto_item_append_text(tree, "%s", tvb_bytes_to_str(tvb, offset, 4));
  2140. }
  2141. /*
  2142. * 8.42 P-TMSI Signature
  2143. */
  2144. static void
  2145. dissect_gtpv2_p_tmsi_sig(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2146. {
  2147. int offset = 0;
  2148. /* The P-TMSI Signature consists of 3 octets and may be allocated by the SGSN. */
  2149. proto_tree_add_item(tree, hf_gtpv2_p_tmsi_sig, tvb, offset, 3, FALSE);
  2150. proto_item_append_text(tree, "%s", tvb_bytes_to_str(tvb, offset, 3));
  2151. }
  2152. /*
  2153. * 8.43 Hop Counter
  2154. */
  2155. static void
  2156. dissect_gtpv2_hop_counter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2157. {
  2158. int offset = 0;
  2159. guint8 hop_counter;
  2160. hop_counter = tvb_get_guint8(tvb, offset);
  2161. proto_tree_add_text(tree, tvb, offset, 1, "Hop Counter: %d", hop_counter);
  2162. proto_item_append_text(tree, "%d", hop_counter);
  2163. }
  2164. /*
  2165. * 8.44 UE Time Zone
  2166. */
  2167. static const value_string gtpv2_ue_time_zone_dst_vals[] = {
  2168. {0, "No Adjustments for Daylight Saving Time"},
  2169. {1, "+1 Hour Adjustments for Daylight Saving Time"},
  2170. {2, "+2 Hour Adjustments for Daylight Saving Time"},
  2171. {3, "Spare"},
  2172. {0, NULL}
  2173. };
  2174. static void
  2175. dissect_gtpv2_ue_time_zone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2176. {
  2177. int offset = 0;
  2178. /*
  2179. * UE Time Zone is used to indicate the offset between universal time and local time in steps of 15 minutes of where the
  2180. * UE currently resides. The "Time Zone" field uses the same format as the "Time Zone" IE in 3GPP TS 24.008 [5].
  2181. * (packet-gsm_a_dtap.c)
  2182. */
  2183. de_time_zone(tvb, tree, pinfo, offset, 1, NULL, 0);
  2184. offset= offset+ 1;
  2185. proto_tree_add_item(tree, hf_gtpv2_ue_time_zone_dst, tvb, offset, 1, FALSE);
  2186. }
  2187. /*
  2188. * 8.45 Trace Reference
  2189. */
  2190. static void
  2191. dissect_gtpv2_trace_reference(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2192. {
  2193. int offset = 0;
  2194. guint32 trace_id;
  2195. gchar *mcc_mnc_str;
  2196. mcc_mnc_str = dissect_e212_mcc_mnc_ep_str(tvb, pinfo, tree, 0, TRUE);
  2197. offset += 3;
  2198. trace_id = tvb_get_ntohs(tvb, offset);
  2199. proto_tree_add_text(tree, tvb, offset, 3, "Trace ID: %d", trace_id);
  2200. proto_item_append_text(tree,"%s,Trace ID %u", mcc_mnc_str, trace_id);
  2201. }
  2202. /*
  2203. * 8.46 Complete Request Message
  2204. */
  2205. static const value_string gtpv2_complete_req_msg_type_vals[] = {
  2206. {0, "Complete Attach Request Message" },
  2207. {1, "Complete TAU Request Message" },
  2208. {0, NULL }
  2209. };
  2210. static void
  2211. dissect_complete_request_msg(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2212. {
  2213. tvbuff_t *new_tvb;
  2214. int offset;
  2215. offset = 0;
  2216. proto_tree_add_item(tree, hf_gtpv2_complete_req_msg_type, tvb, offset, 1, FALSE);
  2217. offset++;
  2218. /* Add the Complete Request Message */
  2219. new_tvb = tvb_new_subset_remaining(tvb, offset);
  2220. call_dissector(nas_eps_handle, new_tvb, pinfo, tree);
  2221. }
  2222. /*
  2223. * 8.47 GUTI
  2224. */
  2225. static void
  2226. dissect_gtpv2_guti(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2227. {
  2228. int offset = 0;
  2229. offset = 0;
  2230. dissect_e212_mcc_mnc(tvb, pinfo, tree, 0, TRUE);
  2231. offset += 3;
  2232. proto_tree_add_item(tree, hf_gtpv2_mme_grp_id, tvb, offset, 2, FALSE);
  2233. offset += 2;
  2234. proto_tree_add_item(tree, hf_gtpv2_mme_code, tvb, offset, 1, FALSE);
  2235. offset++;
  2236. proto_tree_add_item(tree, hf_gtpv2_m_tmsi, tvb, offset,4, FALSE);
  2237. }
  2238. /*
  2239. * 8.48 Fully Qualified Container (F-Container)
  2240. */
  2241. static const value_string gtpv2_container_type_vals[] = {
  2242. {1, "UTRAN transparent container"},
  2243. {2, "BSS container"},
  2244. {3, "E-UTRAN transparent container"},
  2245. {0, NULL}
  2246. };
  2247. static void
  2248. 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_)
  2249. {
  2250. tvbuff_t *tvb_new;
  2251. int offset = 0;
  2252. guint8 container_type;
  2253. /* Octets 8 7 6 5 4 3 2 1
  2254. * 5 Spare | Container Type
  2255. */
  2256. proto_tree_add_item(tree, hf_gtpv2_container_type, tvb, offset, 1, FALSE);
  2257. container_type = tvb_get_guint8(tvb,offset);
  2258. offset++;
  2259. if(message_type == GTPV2_FORWARD_CTX_NOTIFICATION) {
  2260. switch(container_type){
  2261. case 3:
  2262. /* E-UTRAN transparent container */
  2263. tvb_new = tvb_new_subset_remaining(tvb, offset);
  2264. dissect_s1ap_ENB_StatusTransfer_TransparentContainer_PDU(tvb_new, pinfo, tree);
  2265. return;
  2266. default:
  2267. break;
  2268. }
  2269. }
  2270. /* 7.3.2 Forward Relocation Response
  2271. * E-UTRAN Transparent Container
  2272. * This IE is conditionally included only during a handover to
  2273. * E-UTRAN and contains the radio-related and core network
  2274. * information. If the Cause IE contains the value "Request
  2275. * accepted", this IE shall be included.
  2276. */
  2277. proto_tree_add_text(tree, tvb, offset, length-offset, "Not dissected yet");
  2278. }
  2279. /*
  2280. * 8.49 Fully Qualified Cause (F-Cause)
  2281. */
  2282. static const value_string gtpv2_cause_type_vals[] = {
  2283. {0, "Radio Network Layer"},
  2284. {1, "Transport Layer"},
  2285. {2, "NAS"},
  2286. {3, "Protocol"},
  2287. {4, "Miscellaneous"},
  2288. {5, "<spare>"},
  2289. {6, "<spare>"},
  2290. {7, "<spare>"},
  2291. {8, "<spare>"},
  2292. {9, "<spare>"},
  2293. {10, "<spare>"},
  2294. {11, "<spare>"},
  2295. {12, "<spare>"},
  2296. {13, "<spare>"},
  2297. {14, "<spare>"},
  2298. {15, "<spare>"},
  2299. {0, NULL}
  2300. };
  2301. static value_string_ext gtpv2_cause_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_cause_type_vals);
  2302. static void
  2303. dissect_gtpv2_F_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2304. {
  2305. int offset = 0;
  2306. guint8 cause_type;
  2307. /* The value of Instance field of the F-Cause IE in a GTPv2 message shall indicate
  2308. * whether the F-Cause field contains RANAP Cause, BSSGP Cause or RAN Cause.
  2309. * If the F-Cause field contains RAN Cause, the Cause Type field shall contain
  2310. * the RAN cause subcategory as specified in 3GPP TS 36.413 [10] and it shall be
  2311. * encoded as in Table 8.49-1.
  2312. * If the F-Cause field contains BSSGP Cause or RANAP Cause,
  2313. * the Cause Type field shall be ignored by the receiver.
  2314. */
  2315. if(message_type == GTPV2_FORWARD_RELOCATION_REQ) {
  2316. switch(instance) {
  2317. case 0:
  2318. proto_item_append_text(item, "[RAN Cause]");
  2319. proto_tree_add_item(tree, hf_gtpv2_cause_type, tvb, offset, 1, FALSE);
  2320. cause_type = tvb_get_guint8(tvb,offset);
  2321. offset++;
  2322. switch(cause_type){
  2323. case 0:
  2324. /* CauseRadioNetwork */
  2325. proto_tree_add_item(tree, hf_gtpv2_CauseRadioNetwork, tvb, offset, 1, FALSE);
  2326. break;
  2327. case 1:
  2328. /* CauseTransport */
  2329. proto_tree_add_item(tree, hf_gtpv2_CauseTransport, tvb, offset, 1, FALSE);
  2330. break;
  2331. case 2:
  2332. /* CauseNas */
  2333. proto_tree_add_item(tree, hf_gtpv2_CauseNas, tvb, offset, 1, FALSE);
  2334. break;
  2335. case 3:
  2336. /* CauseProtocol */
  2337. proto_tree_add_item(tree, hf_gtpv2_CauseProtocol, tvb, offset, 1, FALSE);
  2338. break;
  2339. case 4:
  2340. /* CauseMisc */
  2341. proto_tree_add_item(tree, hf_gtpv2_CauseMisc, tvb, offset, 1, FALSE);
  2342. break;
  2343. default:
  2344. break;
  2345. }
  2346. return;
  2347. break;
  2348. case 1:
  2349. proto_item_append_text(item, "[RANAP Cause]");
  2350. break;
  2351. case 2:
  2352. proto_item_append_text(item, "[BSSGP Cause]");
  2353. break;
  2354. default:
  2355. break;
  2356. }
  2357. }
  2358. proto_tree_add_text(tree, tvb, offset, length-offset, "Not dissected yet");
  2359. }
  2360. /*
  2361. * 8.50 Selected PLMN ID
  2362. */
  2363. /*
  2364. * The Selected PLMN ID IE contains the core network operator selected for tne UE
  2365. * in a shared network. Octets 5-7 shall be encoded as the content part of the
  2366. * "Selected PLMN Identity" parameter in 3GPP TS 36.413 [10].
  2367. * -The Selected PLMN identity consists of 3 digits from MCC followed by
  2368. * either -a filler digit plus 2 digits from MNC (in case of 2 digit MNC) or
  2369. * -3 digits from MNC (in case of a 3 digit MNC).
  2370. */
  2371. static void
  2372. dissect_gtpv2_sel_plmn_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_)
  2373. {
  2374. gchar *mcc_mnc_str;
  2375. mcc_mnc_str = dissect_e212_mcc_mnc_ep_str(tvb, pinfo, tree, 0, TRUE);
  2376. proto_item_append_text(tree,"%s", mcc_mnc_str);
  2377. }
  2378. /*
  2379. * 8.51 Target Identification
  2380. */
  2381. static const value_string gtpv2_target_type_vals[] = {
  2382. {0, "RNC ID"},
  2383. {1, "Macro eNodeB ID"},
  2384. {2, "Cell Identifier"},
  2385. {3, "Home eNodeB ID"},
  2386. {0, NULL}
  2387. };
  2388. static value_string_ext gtpv2_target_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_target_type_vals);
  2389. static void
  2390. dissect_gtpv2_target_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_)
  2391. {
  2392. tvbuff_t *tvb_new;
  2393. int offset = 0;
  2394. guint8 target_type;
  2395. proto_tree_add_item(tree, hf_gtpv2_target_type, tvb, 0, 1, FALSE);
  2396. target_type = tvb_get_guint8(tvb,offset);
  2397. offset++;
  2398. switch(target_type) {
  2399. case 0:
  2400. /* RNC ID
  2401. * In this case the Target ID field shall be encoded as the Target
  2402. * RNC-ID part of the "Target ID" parameter in 3GPP TS 25.413 [33]. Therefore, the "Choice Target ID" that indicates
  2403. * "Target RNC-ID" (numerical value of 0x20) shall not be included (value in octet 5 specifies the target type).
  2404. */
  2405. tvb_new = tvb_new_subset_remaining(tvb, offset);
  2406. dissect_ranap_TargetRNC_ID_PDU(tvb_new, pinfo, tree);
  2407. return;
  2408. break;
  2409. case 1:
  2410. /* Macro eNodeB ID*/
  2411. tvb_new = tvb_new_subset_remaining(tvb, offset);
  2412. dissect_e212_mcc_mnc(tvb_new, pinfo, tree, 0, TRUE);
  2413. offset+=3;
  2414. /* The Macro eNodeB ID consists of 20 bits.
  2415. * Bit 4 of Octet 4 is the most significant bit and bit 1 of Octet 6 is the least significant bit.
  2416. */
  2417. proto_tree_add_item(tree, hf_gtpv2_macro_enodeb_id, tvb, offset, 3, FALSE);
  2418. offset+=3;
  2419. /* Tracking Area Code (TAC) */
  2420. proto_tree_add_item(tree, hf_gtpv2_uli_tai_tac, tvb, offset, 2, FALSE);
  2421. return;
  2422. case 2:
  2423. /* Cell Identifier */
  2424. /* Target ID field shall be same as the Octets 3 to 10 of the Cell Identifier IEI
  2425. * in 3GPP TS 48.018 [34].
  2426. */
  2427. case 3:
  2428. /* Home eNodeB ID */
  2429. /* Octet 10 to 12 Home eNodeB ID */
  2430. /* Octet 13 to 14 Tracking Area Code (TAC) */
  2431. default:
  2432. break;
  2433. }
  2434. proto_tree_add_text(tree, tvb, offset, length-offset, "Not dissected yet");
  2435. }
  2436. /*
  2437. * 8.52 Void
  2438. */
  2439. /*
  2440. * 8.53 Packet Flow ID
  2441. */
  2442. static void
  2443. dissect_gtpv2_pkt_flow_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_)
  2444. {
  2445. int offset = 0;
  2446. /* Octet 5 Spare EBI */
  2447. proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 4, FALSE);
  2448. proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 2, FALSE);
  2449. offset++;
  2450. /* Packet Flow ID */
  2451. proto_tree_add_text(tree, tvb, offset, length, "Packet Flow ID: %s", tvb_bytes_to_str(tvb, offset, length-1));
  2452. }
  2453. /*
  2454. * 8.54 RAB Context
  2455. */
  2456. static void
  2457. 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_)
  2458. {
  2459. int offset = 0;
  2460. guint16 dlgtpu_seq, ulgtpu_seq, dl_pdcp_seq, ul_pdcp_seq;
  2461. /* 5 Spare NSAPI */
  2462. proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 4, FALSE);
  2463. proto_tree_add_item(tree, hf_gtpv2_nsapi, tvb, offset, 1, FALSE);
  2464. /* 6 to 7 DL GTP-U Sequence Number */
  2465. dlgtpu_seq = tvb_get_ntohs(tvb, offset);
  2466. proto_tree_add_text(tree, tvb, offset, 2, "DL GTP-U Sequence Number: %d", dlgtpu_seq);
  2467. offset += 2;
  2468. /* 8 to 9 UL GTP-U Sequence Number */
  2469. ulgtpu_seq = tvb_get_ntohs(tvb, offset);
  2470. proto_tree_add_text(tree, tvb, offset, 2, "UL GTP-U Sequence Number: %d", ulgtpu_seq);
  2471. offset += 2;
  2472. /* 10 to 11 DL PDCP Sequence Number */
  2473. dl_pdcp_seq = tvb_get_ntohs(tvb, offset);
  2474. proto_tree_add_text(tree, tvb, offset, 2, "DL PDCP Sequence Number: %d", dl_pdcp_seq);
  2475. offset += 2;
  2476. /* 12 to 13 UL PDCP Sequence Number */
  2477. ul_pdcp_seq = tvb_get_ntohs(tvb, offset);
  2478. proto_tree_add_text(tree, tvb, offset, 2, "UL PDCP Sequence Number: %d", ul_pdcp_seq);
  2479. }
  2480. /*
  2481. * 8.55 Source RNC PDCP context info
  2482. */
  2483. static void
  2484. 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_)
  2485. {
  2486. proto_tree_add_text(tree, tvb, 0, length, "RRC Container");
  2487. }
  2488. /*
  2489. * 8.56 UDP Source Port Number
  2490. */
  2491. static void
  2492. dissect_udp_s_port_nr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2493. {
  2494. proto_tree_add_text(tree, tvb, 0, 2, "UPD Source Port Number: %u", tvb_get_ntohs(tvb, 0));
  2495. proto_item_append_text(tree, "%u", tvb_get_ntohs(tvb, 0));
  2496. }
  2497. /*
  2498. * 8.57 APN Restriction
  2499. */
  2500. static void
  2501. 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_)
  2502. {
  2503. guint8 type_value;
  2504. type_value = tvb_get_guint8(tvb, 0);
  2505. proto_tree_add_item(tree, hf_gtpv2_apn_rest, tvb, 0, 1, FALSE);
  2506. proto_item_append_text(item, "value %u", type_value);
  2507. }
  2508. /*
  2509. * 8.58 Selection Mode
  2510. */
  2511. static const value_string gtpv2_selec_mode_vals[] = {
  2512. {0, "MS or network provided APN, subscribed verified"},
  2513. {1, "MS provided APN, subscription not verified"},
  2514. {2, "Network provided APN, subscription not verified"},
  2515. {3, "Network provided APN, subscription not verified (Basically for Future use"},
  2516. {0, NULL}
  2517. };
  2518. static void
  2519. dissect_gtpv2_selec_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2520. {
  2521. int offset=0;
  2522. guint8 ss_mode;
  2523. ss_mode = tvb_get_guint8(tvb, offset) & 0x03;
  2524. proto_tree_add_item(tree, hf_gtpv2_selec_mode, tvb, offset, 1, FALSE);
  2525. proto_item_append_text(item, "%s", val_to_str(ss_mode, gtpv2_selec_mode_vals, "Unknown"));
  2526. }
  2527. /*
  2528. * 8.59 Source Identification
  2529. */
  2530. static const value_string gtpv2_source_ident_types[] = {
  2531. {0, "Cell ID"},
  2532. {1, "RNC ID"},
  2533. {2, "eNodeB ID(Reserved, used in erlier v of proto.)"},
  2534. {0, NULL}
  2535. };
  2536. static void
  2537. 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_)
  2538. {
  2539. proto_item *expert_item;
  2540. int offset=0;
  2541. guint8 source_type;
  2542. /* Octet 5 to 12 Target Cell ID */
  2543. de_cell_id(tvb, tree, pinfo, offset, 8, NULL, 0);
  2544. offset+=8;
  2545. /* Octet 13 Source Type */
  2546. source_type = tvb_get_guint8(tvb, offset);
  2547. proto_tree_add_item(tree, hf_gtpv2_source_type, tvb, offset, 1, FALSE);
  2548. offset++;
  2549. /* Octet 14 to (n+4) Source ID */
  2550. switch(source_type){
  2551. case 0:
  2552. /* The Source Type is Cell ID for PS handover from GERAN A/Gb mode. In this case the coding of the Source ID field
  2553. * shall be same as the Octets 3 to 10 of the Cell Identifier IEI in 3GPP TS 48.018 [34].
  2554. */
  2555. de_cell_id(tvb, tree, pinfo, offset, 8, NULL, 0);
  2556. offset+=8;
  2557. break;
  2558. case 1:
  2559. /* The Source Type is RNC ID for PS handover from GERAN Iu mode or for inter-RAT handover from UTRAN. In this
  2560. * case the Source ID field shall be encoded as as the Source RNC-ID part of the "Source ID" parameter in 3GPP TS
  2561. * 25.413 [33].
  2562. */
  2563. /* RNC-ID M INTEGER (0..4095) */
  2564. break;
  2565. case 2:
  2566. break;
  2567. default:
  2568. expert_item = proto_tree_add_text(tree, tvb, offset-1, 1, "Unknown source type");
  2569. expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_ERROR, "Unknown source type");
  2570. PROTO_ITEM_SET_GENERATED(expert_item);
  2571. break;
  2572. }
  2573. }
  2574. /*
  2575. * 8.60 Bearer Control Mode
  2576. */
  2577. static const value_string gtpv2_bearer_control_mode_vals[] = {
  2578. {0, "Selected Bearer Control Mode-'MS_only'"},
  2579. {1, "Selected Bearer Control Mode-'Network_only'"},
  2580. {2, "Selected Bearer Control Mode-'MS/NW'"},
  2581. {0, NULL}
  2582. };
  2583. static const value_string gtpv2_bearer_control_mode_short_vals[] = {
  2584. {0, "MS_only"},
  2585. {1, "Network_only"},
  2586. {2, "MS/NW"},
  2587. {0, NULL}
  2588. };
  2589. static void
  2590. dissect_gtpv2_bearer_control_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2591. {
  2592. guint8 bcm;
  2593. proto_tree_add_item(tree, hf_gtpv2_bearer_control_mode, tvb, 0, 1, FALSE);
  2594. /* Add Bearer Control Mode to tree */
  2595. bcm = tvb_get_guint8(tvb, 0);
  2596. proto_item_append_text(tree, "%s", val_to_str(bcm, gtpv2_bearer_control_mode_short_vals, "Unknown"));
  2597. }
  2598. /*
  2599. * 8.61 Change Reporting Action
  2600. */
  2601. static const value_string gtpv2_cng_rep_act_vals[] = {
  2602. {0, "Stop Reporting"},
  2603. {1, "Start Reporting CGI/SAI"},
  2604. {2, "Start Reporting RAI"},
  2605. {3, "Start Reporting TAI"},
  2606. {4, "Start Reporting ECGI"},
  2607. {5, "Start Reporting CGI/SAI and RAI"},
  2608. {6, "Start Reporting TAI and ECGI"},
  2609. {0, NULL}
  2610. };
  2611. static void
  2612. dissect_gtpv2_cng_rep_act(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2613. {
  2614. guint8 action;
  2615. /* Add Action to tree */
  2616. action = tvb_get_guint8(tvb, 0);
  2617. proto_tree_add_item(tree, hf_gtpv2_cng_rep_act, tvb, 0, 1, FALSE);
  2618. proto_item_append_text(tree, "%s", val_to_str(action, gtpv2_cng_rep_act_vals, "Unknown"));
  2619. }
  2620. /*
  2621. * 8.62 Fully qualified PDN Connection Set Identifier (FQ-CSID)
  2622. */
  2623. static const value_string gtpv2_fq_csid_type_vals[] = {
  2624. {0, "Global unicast IPv4 address"},
  2625. {1, "Global unicast IPv6 address"},
  2626. {2, "4 octets long field"},
  2627. {0, NULL}
  2628. };
  2629. static void
  2630. dissect_gtpv2_fq_csid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_)
  2631. {
  2632. proto_item *expert_item;
  2633. int offset = 0;
  2634. guint8 octet,node_id_type, csids;
  2635. guint32 node_id, node_id_mcc_mnc;
  2636. /* Octet 5 Node-ID Type Number of CSIDs= m */
  2637. octet = tvb_get_guint8(tvb, offset);
  2638. node_id_type = octet >> 4;
  2639. csids = octet & 0x0f;
  2640. proto_tree_add_item(tree, hf_gtpv2_fq_csid_type, tvb, offset, 1, FALSE);
  2641. proto_tree_add_item(tree, hf_gtpv2_fq_csid_nr, tvb, offset, 1, FALSE);
  2642. offset++;
  2643. switch(node_id_type){
  2644. case 0:
  2645. /* Indicates that Node-ID is a global unicast IPv4 address and p = 9 */
  2646. proto_tree_add_item(tree, hf_gtpv2_fq_csid_ipv4, tvb, offset, 4, FALSE);
  2647. offset += 4;
  2648. break;
  2649. case 1:
  2650. /* Indicates that Node-ID is a global unicast IPv6 address and p = 21 */
  2651. proto_tree_add_item(tree, hf_gtpv2_fq_csid_ipv6, tvb, offset, 16, FALSE);
  2652. offset += 16;
  2653. break;
  2654. case 2:
  2655. /* Node-ID is a 4 octets long field with a 32 bit value stored in network order, and p= 9. The coding
  2656. * of the field is specified below:
  2657. * - Most significant 20 bits are the binary encoded value of (MCC * 1000 + MNC).
  2658. * - Least significant 12 bits is a 12 bit integer assigned by an operator to an MME, SGW or PGW. Other values of
  2659. * Node-ID Type are reserved.
  2660. */
  2661. node_id = tvb_get_ntohl(tvb, offset);
  2662. node_id_mcc_mnc = node_id >> 12;
  2663. node_id = node_id & 0xfff;
  2664. proto_tree_add_text(tree, tvb, offset, 4, "Node-ID: MCC+MNC %u, Id: %u",node_id_mcc_mnc, node_id);
  2665. offset+=4;
  2666. break;
  2667. default:
  2668. expert_item = proto_tree_add_text(tree, tvb, offset-1, 1, "Wrong Node-ID Type %u, should be 0-2(Or tis is a newer spec)",node_id_type);
  2669. expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_ERROR, "Wrong Node-ID Type %u, should be 0-2(Or tis is a newer spec)",node_id_type);
  2670. PROTO_ITEM_SET_GENERATED(expert_item);
  2671. return;
  2672. }
  2673. /* First PDN Connection Set Identifier (CSID)
  2674. * Second PDN Connection Set Identifier (CSID)
  2675. * :
  2676. * m-th PDN Connection Set Identifier (CSID)
  2677. */
  2678. while ( csids-- ) {
  2679. proto_tree_add_item(tree, hf_gtpv2_fq_csid_id, tvb, offset, 2, FALSE);
  2680. offset += 2;
  2681. }
  2682. }
  2683. /*
  2684. * 8.63 Channel needed
  2685. */
  2686. static void
  2687. 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_)
  2688. {
  2689. /* The Channel needed shall be coded as depicted in Figure 8.63-1. Channel needed is coded as the IEI part and the value
  2690. * part of the Channel Needed IE defined in 3GPP TS 44.018[28]
  2691. */
  2692. de_rr_chnl_needed(tvb, tree, pinfo, 0, length, NULL, 0);
  2693. }
  2694. /*
  2695. * 8.64 eMLPP Priority
  2696. * The eMLPP-Priority shall be coded as depicted in Figure 8.64-1. The eMLPP Priority is coded as the value part of the
  2697. * eMLPP-Priority IE defined in 3GPP TS 48.008 [29] (not including 3GPP TS 48.008 IEI and 3GPP TS 48.008 [29]
  2698. * length indicator).
  2699. */
  2700. static void
  2701. 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_)
  2702. {
  2703. be_emlpp_prio(tvb, tree, pinfo, 0, length, NULL, 0);
  2704. }
  2705. /*
  2706. * 8.65 Node Type
  2707. */
  2708. static const value_string gtpv2_node_type_vals[] = {
  2709. {0, "MME"},
  2710. {1, "SGSN"},
  2711. {0, NULL}
  2712. };
  2713. static void
  2714. dissect_gtpv2_node_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2715. {
  2716. guint8 node_type;
  2717. proto_tree_add_item(tree, hf_gtpv2_node_type, tvb, 0, 1, FALSE);
  2718. /* Append Node Type to tree */
  2719. node_type = tvb_get_guint8(tvb, 0);
  2720. proto_item_append_text(tree, "%s", val_to_str(node_type, gtpv2_node_type_vals, "Unknown"));
  2721. }
  2722. /*
  2723. * 8.66 Fully Qualified Domain Name (FQDN)
  2724. */
  2725. static void
  2726. dissect_gtpv2_fqdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2727. {
  2728. int offset = 0, name_len, tmp;
  2729. guint8 *fqdn = NULL;
  2730. /* The FQDN field encoding shall be identical to the encoding of
  2731. * a FQDN within a DNS message of section 3.1 of IETF
  2732. * RFC 1035 [31] but excluding the trailing zero byte.
  2733. */
  2734. if (length > 0) {
  2735. name_len = tvb_get_guint8(tvb, offset);
  2736. if (name_len < 0x20) {
  2737. fqdn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
  2738. for (;;) {
  2739. if (name_len >= length - 1)
  2740. break;
  2741. tmp = name_len;
  2742. name_len = name_len + fqdn[tmp] + 1;
  2743. fqdn[tmp] = '.';
  2744. }
  2745. } else {
  2746. fqdn = tvb_get_ephemeral_string(tvb, offset, length);
  2747. }
  2748. proto_tree_add_string(tree, hf_gtpv2_fqdn, tvb, offset, length, fqdn);
  2749. proto_item_append_text(item, "%s", fqdn);
  2750. }
  2751. }
  2752. /*
  2753. * 8.67 Private Extension
  2754. */
  2755. static void
  2756. dissect_gtpv2_private_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
  2757. {
  2758. int offset = 0;
  2759. /* oct 5 -7 Enterprise ID */
  2760. proto_tree_add_item(tree, hf_gtpv2_enterprise_id, tvb, offset, 2, FALSE);
  2761. offset+=2;
  2762. proto_tree_add_text(tree, tvb, offset, length-2, "Proprietary value");
  2763. }
  2764. /*
  2765. * 8.68 Transaction Identifier (TI)
  2766. */
  2767. static void
  2768. 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_)
  2769. {
  2770. /* 5 to (n+4) Transaction Identifier */
  2771. proto_tree_add_item(tree, hf_gtpv2_ti, tvb, 0, length, FALSE);
  2772. }
  2773. typedef struct _gtpv2_ie {
  2774. int ie_type;
  2775. void (*decode) (tvbuff_t *, packet_info *, proto_tree *, proto_item *, guint16, guint8, guint8);
  2776. } gtpv2_ie_t;
  2777. static const gtpv2_ie_t gtpv2_ies[] = {
  2778. {GTPV2_IE_IMSI, dissect_gtpv2_imsi},
  2779. {GTPV2_IE_CAUSE, dissect_gtpv2_cause}, /* 2, Cause (without embedded offending IE) 8.4 */
  2780. {GTPV2_REC_REST_CNT, dissect_gtpv2_recovery}, /* 3, Recovery (Restart Counter) 8.5 */
  2781. /* 4-50 Reserved for S101 interface Extendable / See 3GPP TS 29.276 [14] */
  2782. /* 51-70 Reserved for Sv interface Extendable / See 3GPP TS 29.280 [15] */
  2783. {GTPV2_APN, dissect_gtpv2_apn}, /* 71, Access Point Name (APN) 8.6 */
  2784. {GTPV2_AMBR, dissect_gtpv2_ambr}, /* 72, Aggregate Maximum Bit Rate (AMBR) */
  2785. {GTPV2_EBI, dissect_gtpv2_ebi}, /* 73, EPS Bearer ID (EBI) 8.8 */
  2786. {GTPV2_IP_ADDRESS, dissect_gtpv2_ip_address}, /* 74, IP Address */
  2787. {GTPV2_MEI, dissect_gtpv2_mei}, /* 74, Mobile Equipment Identity */
  2788. {GTPV2_IE_MSISDN, dissect_gtpv2_msisdn}, /* 76, MSISDN 8.11 */
  2789. {GTPV2_INDICATION, dissect_gtpv2_ind}, /* 77 Indication 8.12 */
  2790. {GTPV2_PCO, dissect_gtpv2_pco}, /* 78 Protocol Configuration Options (PCO) 8.13 */
  2791. {GTPV2_PAA, dissect_gtpv2_paa}, /* 79 PDN Address Allocation (PAA) 8.14 */
  2792. {GTPV2_BEARER_QOS,dissect_gtpv2_bearer_qos}, /* 80 Bearer Level Quality of Service (Bearer QoS) 8.15 */
  2793. {GTPV2_IE_FLOW_QOS, dissect_gtpv2_flow_qos}, /* 81 Flow Quality of Service (Flow QoS) 8.16 */
  2794. {GTPV2_IE_RAT_TYPE, dissect_gtpv2_rat_type}, /* 82, RAT Type 8.17 */
  2795. {GTPV2_IE_SERV_NET, dissect_gtpv2_serv_net}, /* 83, Serving Network 8.18 */
  2796. {GTPV2_IE_BEARER_TFT, dissect_gtpv2_bearer_tft}, /* 84, Bearer TFT 8.19 */
  2797. {GTPV2_IE_TAD, dissect_gtpv2_tad}, /* 85, Traffic Aggregate Description 8.20 */
  2798. {GTPV2_IE_ULI, dissect_gtpv2_uli}, /* 86, User Location Info (ULI) 8.22 */
  2799. {GTPV2_IE_F_TEID, dissect_gtpv2_f_teid}, /* 87, Fully Qualified Tunnel Endpoint Identifier (F-TEID) 8.23 */
  2800. {GTPV2_IE_TMSI, dissect_gtpv2_tmsi}, /* 88, TMSI 8.23 */
  2801. {GTPV2_IE_GLOBAL_CNID, dissect_gtpv2_g_cn_id}, /* 89, Global CN-Id 8.25 */
  2802. {GTPV2_IE_S103PDF, dissect_gtpv2_s103pdf}, /* 90, S103 PDN Data Forwarding Info (S103PDF) 8.25 */
  2803. {GTPV2_IE_S1UDF, dissect_gtpv2_s1udf}, /* 91, S1-U Data Forwarding (S1UDF) 8.26 */
  2804. {GTPV2_IE_DEL_VAL, dissect_gtpv2_delay_value}, /* 92, Delay Value 8.29 */
  2805. {GTPV2_IE_BEARER_CTX,dissect_gtpv2_bearer_ctx}, /* 93, Bearer Context 8.31 */
  2806. {GTPV2_IE_CHAR_ID, dissect_gtpv2_charging_id}, /* 94, Charging Id */
  2807. {GTPV2_IE_CHAR_CHAR, dissect_gtpv2_char_char}, /* 95 Charging Characteristic */
  2808. {GTPV2_IE_TRA_INFO, dissect_gtpv2_tra_info}, /* 96, Trace Information 8.31 */
  2809. {GTPV2_BEARER_FLAG, dissect_gtpv2_bearer_flag}, /* 97, Bearer Flag */
  2810. /* 98, Void 8.33 */
  2811. {GTPV2_IE_PDN_TYPE, dissect_gtpv2_pdn_type}, /* 99, PDN Type */
  2812. {GTPV2_IE_PTI, dissect_gtpv2_pti}, /* 100, Procedure Transaction Id */
  2813. {GTPV2_IE_DRX_PARAM, dissect_gtpv2_drx_param}, /* 101, DRX Parameter 8.36 */
  2814. {GTPV2_IE_UE_NET_CAPABILITY, dissect_gtpv2_ue_net_capability}, /* 102, UE network capability 8.37 */
  2815. {GTPV2_IE_MM_CONTEXT_GSM_T, dissect_gtpv2_mm_context_gsm_t}, /* 103, MM Context 8.38 GSM Key and Triplets */
  2816. {GTPV2_IE_MM_CONTEXT_UTMS_CQ, dissect_gtpv2_mm_context_utms_cq}, /* 104, MM Context 8.38 */
  2817. {GTPV2_IE_MM_CONTEXT_GSM_CQ, dissect_gtpv2_mm_context_gsm_cq}, /* 105, MM Context 8.38 */
  2818. {GTPV2_IE_MM_CONTEXT_UTMS_Q, dissect_gtpv2_mm_context_utms_q}, /* 106, MM Context 8.38 */
  2819. {GTPV2_IE_MM_CONTEXT_EPS_QQ, dissect_gtpv2_mm_context_eps_qq}, /* 107, MM Context 8.38 */
  2820. {GTPV2_IE_MM_CONTEXT_UTMS_QQ, dissect_gtpv2_mm_context_utms_qq}, /* 108, MM Context 8.38 */
  2821. {GTPV2_IE_PDN_CONNECTION, dissect_gtpv2_PDN_conn}, /* 109, PDN Connection */
  2822. {GTPV2_IE_PDN_NUMBERS, dissect_gtpv2_pdn_numbers}, /* 110, PDN Numbers 8.40 */
  2823. {GTPV2_IE_P_TMSI, dissect_gtpv2_p_tmsi}, /* 111, P-TMSI 8.41 */
  2824. {GTPV2_IE_P_TMSI_SIG, dissect_gtpv2_p_tmsi_sig}, /* 112, P-TMSI Signature 8.42 */
  2825. {GTPV2_IE_HOP_COUNTER, dissect_gtpv2_hop_counter}, /* 113, Hop Counter 8.43 */
  2826. {GTPV2_IE_UE_TIME_ZONE, dissect_gtpv2_ue_time_zone}, /* 114, UE Time Zone */
  2827. {GTPV2_IE_TRACE_REFERENCE, dissect_gtpv2_trace_reference}, /* 115, Trace Reference 8.45 */
  2828. {GTPV2_IE_COMPLETE_REQUEST_MSG, dissect_complete_request_msg}, /* 116, Complete Request message 8.46 */
  2829. {GTPV2_IE_GUTI, dissect_gtpv2_guti}, /* 117, GUTI 8.47 */
  2830. {GTPV2_IE_F_CONTAINER, dissect_gtpv2_F_container}, /* 118, Fully Qualified Container (F-Container) */
  2831. {GTPV2_IE_F_CAUSE, dissect_gtpv2_F_cause}, /* 119, Fully Qualified Cause (F-Cause) */
  2832. {GTPV2_IE_SEL_PLMN_ID, dissect_gtpv2_sel_plmn_id}, /* 120, Selected PLMN ID 8.50 */
  2833. {GTPV2_IE_TARGET_ID, dissect_gtpv2_target_id}, /* 121, Target Identification */
  2834. /* 122, Void 8.52 */
  2835. {GTPV2_IE_PKT_FLOW_ID, dissect_gtpv2_pkt_flow_id}, /* 123, Packet Flow ID 8.53 */
  2836. {GTPV2_IE_RAB_CONTEXT, dissect_gtpv2_rab_context}, /* 124, RAB Context 8.54 */
  2837. {GTPV2_IE_S_RNC_PDCP_CTX_INFO, dissect_gtpv2_s_rnc_pdcp_ctx_info}, /* 125, Source RNC PDCP context info 8.55 */
  2838. {GTPV2_IE_UDP_S_PORT_NR, dissect_udp_s_port_nr}, /* 126, UDP Source Port Number 8.56 */
  2839. {GTPV2_IE_APN_RESTRICTION, dissect_gtpv2_apn_rest}, /* 127, APN Restriction */
  2840. {GTPV2_IE_SEL_MODE,dissect_gtpv2_selec_mode}, /* 128 Selection Mode */
  2841. {GTPV2_IE_SOURCE_IDENT, dissect_gtpv2_source_ident}, /* 129, Source Identification 8.59 */
  2842. {GTPV2_IE_BEARER_CONTROL_MODE,dissect_gtpv2_bearer_control_mode}, /* 130 Bearer Control Mode*/
  2843. {GTPV2_IE_CNG_REP_ACT ,dissect_gtpv2_cng_rep_act}, /* 131 Change Reporting Action 8.61 */
  2844. {GTPV2_IE_FQ_CSID, dissect_gtpv2_fq_csid}, /* 132, Fully Qualified PDN Connection Set Identifier (FQ-CSID) 8.62 */
  2845. {GTPV2_IE_CHANNEL_NEEDED, dissect_gtpv2_channel_needed}, /* 133, Channel Needed 8.63 */
  2846. {GTPV2_IE_EMLPP_PRI, dissect_gtpv2_emlpp_pri}, /* 134, eMLPP Priority 8.64 */
  2847. {GTPV2_IE_NODE_TYPE ,dissect_gtpv2_node_type}, /* 135 Node Type 8.65 */
  2848. {GTPV2_IE_FQDN, dissect_gtpv2_fqdn}, /* 136 8.66 Fully Qualified Domain Name (FQDN) */
  2849. {GTPV2_IE_TI, dissect_gtpv2_ti}, /* 137 8.68 Transaction Identifier (TI) */
  2850. /* 137-254 Spare. For future use. FFS */
  2851. {GTPV2_IE_PRIVATE_EXT,dissect_gtpv2_private_ext},
  2852. {0, dissect_gtpv2_unknown}
  2853. };
  2854. static void
  2855. dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, gint offset, guint8 message_type)
  2856. {
  2857. proto_tree *ie_tree;
  2858. proto_item *ti;
  2859. tvbuff_t *ie_tvb;
  2860. guint8 type, instance;
  2861. guint16 length;
  2862. int i;
  2863. /*
  2864. * Octets 8 7 6 5 4 3 2 1
  2865. * 1 Type
  2866. * 2-3 Length = n
  2867. * 4 CR Spare Instance
  2868. * 5-(n+4) IE specific data
  2869. */
  2870. while(offset < (gint)tvb_reported_length(tvb)){
  2871. /* Get the type and length */
  2872. type = tvb_get_guint8(tvb,offset);
  2873. length = tvb_get_ntohs(tvb, offset+1);
  2874. ti = proto_tree_add_text(tree, tvb, offset, 4 + length, "%s : ", val_to_str(type, gtpv2_element_type_vals, "Unknown"));
  2875. ie_tree = proto_item_add_subtree(ti, ett_gtpv2_ie);
  2876. /* Octet 1 */
  2877. proto_tree_add_item(ie_tree, hf_gtpv2_ie, tvb, offset, 1, FALSE);
  2878. offset++;
  2879. /*Octet 2 - 3 */
  2880. proto_tree_add_item(ie_tree, hf_gtpv2_ie_len, tvb, offset, 2, FALSE);
  2881. offset+=2;
  2882. /* CR Spare Instance Octet 4*/
  2883. proto_tree_add_item(ie_tree, hf_gtpv2_cr, tvb, offset, 1, FALSE);
  2884. instance = tvb_get_guint8(tvb,offset)& 0x0f;
  2885. proto_tree_add_item(ie_tree, hf_gtpv2_instance, tvb, offset, 1, FALSE);
  2886. offset++;
  2887. /* TODO: call IE dissector here */
  2888. if(type==GTPV2_IE_RESERVED){
  2889. /* Treat IE type zero specal as type zero is used to end the loop in the else branch */
  2890. proto_tree_add_text(ie_tree, tvb, offset, length, "IE type Zero is Reserved and should not be used");
  2891. }else{
  2892. i = -1;
  2893. /* Loop over the IE dissector list to se if we find an entry, the last entry will have ie_type=0 breaking the loop */
  2894. while (gtpv2_ies[++i].ie_type){
  2895. if (gtpv2_ies[i].ie_type == type)
  2896. break;
  2897. }
  2898. /* Just give the IE dissector the IE */
  2899. ie_tvb = tvb_new_subset_remaining(tvb, offset);
  2900. (*gtpv2_ies[i].decode) (ie_tvb, pinfo , ie_tree, ti, length, message_type, instance);
  2901. }
  2902. offset = offset + length;
  2903. }
  2904. }
  2905. static void
  2906. dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
  2907. {
  2908. proto_tree *gtpv2_tree, *flags_tree;
  2909. proto_item *ti, *tf;
  2910. guint8 message_type, t_flag;
  2911. int offset = 0;
  2912. /* Currently we get called from the GTP dissector no need to check the version */
  2913. col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv2");
  2914. col_clear(pinfo->cinfo, COL_INFO);
  2915. /* message type is in octet 2 */
  2916. message_type = tvb_get_guint8(tvb,1);
  2917. col_add_str(pinfo->cinfo, COL_INFO, val_to_str(message_type, gtpv2_message_type_vals, "Unknown"));
  2918. proto_tree_add_item(tree, proto_gtpv2, tvb, offset, -1, FALSE);
  2919. if (tree) {
  2920. ti = proto_tree_add_text(tree, tvb, offset, -1, "%s", val_to_str(message_type, gtpv2_message_type_vals, "Unknown"));
  2921. gtpv2_tree = proto_item_add_subtree(ti, ett_gtpv2);
  2922. /* Control Plane GTP uses a variable length header. Control Plane GTP header
  2923. * length shall be a multiple of 4 octets.
  2924. * Figure 5.1-1 illustrates the format of the GTPv2-C Header.
  2925. * Bits 8 7 6 5 4 3 2 1
  2926. * Octets 1 Version P T Spare Spare Spare
  2927. * 2 Message Type
  2928. * 3 Message Length (1st Octet)
  2929. * 4 Message Length (2nd Octet)
  2930. * m-k(m+3) If T flag is set to 1, then TEID shall be placed into octets 5-8.
  2931. * Otherwise, TEID field is not present at all.
  2932. * n-(n+2) Sequence Number
  2933. * (n+3) Spare
  2934. * Figure 5.1-1: General format of GTPv2 Header for Control Plane
  2935. */
  2936. tf = proto_tree_add_item(gtpv2_tree, hf_gtpv2_flags, tvb, offset, 1, FALSE);
  2937. flags_tree = proto_item_add_subtree(tf, ett_gtpv2_flags);
  2938. /* Octet 1 */
  2939. t_flag = (tvb_get_guint8(tvb,offset) & 0x08)>>3;
  2940. proto_tree_add_item(flags_tree, hf_gtpv2_version, tvb, offset, 1, FALSE);
  2941. proto_tree_add_item(flags_tree, hf_gtpv2_p, tvb, offset, 1, FALSE);
  2942. proto_tree_add_item(flags_tree, hf_gtpv2_t, tvb, offset, 1, FALSE);
  2943. offset++;
  2944. /* Octet 2 */
  2945. proto_tree_add_item(gtpv2_tree, hf_gtpv2_message_type, tvb, offset, 1, FALSE);
  2946. offset++;
  2947. /* Octet 3 - 4 */
  2948. proto_tree_add_item(gtpv2_tree, hf_gtpv2_msg_length, tvb, offset, 2, FALSE);
  2949. offset+=2;
  2950. if(t_flag){
  2951. /* Tunnel Endpoint Identifier 4 octets */
  2952. proto_tree_add_item(gtpv2_tree, hf_gtpv2_teid, tvb, offset, 4, FALSE);
  2953. offset+=4;
  2954. }
  2955. /* Sequence Number 3 octets */
  2956. proto_tree_add_item(gtpv2_tree, hf_gtpv2_seq, tvb, offset, 3, FALSE);
  2957. offset+=3;
  2958. /* Spare 1 octet */
  2959. proto_tree_add_item(gtpv2_tree, hf_gtpv2_spare, tvb, offset, 1, FALSE);
  2960. offset+=1;
  2961. dissect_gtpv2_ie_common(tvb, pinfo, gtpv2_tree, offset, message_type);
  2962. }
  2963. }
  2964. void proto_register_gtpv2(void)
  2965. {
  2966. static hf_register_info hf_gtpv2[] = {
  2967. { &hf_gtpv2_reserved,
  2968. {"Reserved bit(s)", "gtpv2.reserved",
  2969. FT_UINT8, BASE_DEC, NULL, 0x0,
  2970. "Reserved", HFILL }
  2971. },
  2972. { &hf_gtpv2_spare_half_octet,
  2973. {"Spare half octet", "gtpv2.spare_half_octet",
  2974. FT_UINT8, BASE_DEC, NULL, 0x0,
  2975. NULL, HFILL }
  2976. },
  2977. { &hf_gtpv2_spare_bits,
  2978. {"Spare bit(s)", "gtpv2.spare_bits",
  2979. FT_UINT8, BASE_DEC, NULL, 0x0,
  2980. NULL, HFILL }
  2981. },
  2982. {&hf_gtpv2_flags,
  2983. {"Flags", "gtpv2.flags",
  2984. FT_UINT8, BASE_DEC, NULL, 0x0,
  2985. NULL, HFILL}
  2986. },
  2987. {&hf_gtpv2_version,
  2988. {"Version", "gtpv2.version",
  2989. FT_UINT8, BASE_DEC, NULL, 0xe0,
  2990. NULL, HFILL}
  2991. },
  2992. {&hf_gtpv2_p,
  2993. {"P", "gtpv2.p",
  2994. FT_UINT8, BASE_DEC, NULL, 0x10,
  2995. "If Piggybacked message is present or not", HFILL}
  2996. },
  2997. { &hf_gtpv2_t,
  2998. {"T", "gtpv2.t",
  2999. FT_UINT8, BASE_DEC, NULL, 0x08,
  3000. "If TEID field is present or not", HFILL}
  3001. },
  3002. { &hf_gtpv2_message_type,
  3003. {"Message Type", "gtpv2.message_type",
  3004. FT_UINT8, BASE_DEC, VALS(gtpv2_message_type_vals), 0x0,
  3005. NULL, HFILL}
  3006. },
  3007. { &hf_gtpv2_msg_length,
  3008. {"Message Length", "gtpv2.msg_lengt",
  3009. FT_UINT16, BASE_DEC, NULL, 0x0,
  3010. NULL, HFILL}
  3011. },
  3012. { &hf_gtpv2_teid,
  3013. {"Tunnel Endpoint Identifier", "gtpv2.teid",
  3014. FT_UINT32, BASE_DEC, NULL, 0x0,
  3015. "TEID", HFILL}
  3016. },
  3017. { &hf_gtpv2_seq,
  3018. {"Sequence Number", "gtpv2.seq",
  3019. FT_UINT32, BASE_DEC, NULL, 0x0,
  3020. "SEQ", HFILL}
  3021. },
  3022. { &hf_gtpv2_spare,
  3023. {"Spare", "gtpv2.spare",
  3024. FT_UINT16, BASE_DEC, NULL, 0x0,
  3025. NULL, HFILL}
  3026. },
  3027. { &hf_gtpv2_ie,
  3028. {"IE Type", "gtpv2.ie_type",
  3029. FT_UINT8, BASE_DEC, VALS(gtpv2_element_type_vals), 0x0,
  3030. NULL, HFILL}
  3031. },
  3032. { &hf_gtpv2_ie_len,
  3033. {"IE Length", "gtpv2.ie_len",
  3034. FT_UINT16, BASE_DEC, NULL, 0x0,
  3035. "length of the information element excluding the first four octets", HFILL}
  3036. },
  3037. { &hf_gtpv2_cr,
  3038. {"CR flag", "gtpv2.cr",
  3039. FT_UINT8, BASE_DEC, NULL, 0xe0,
  3040. NULL, HFILL}
  3041. },
  3042. { &hf_gtpv2_instance,
  3043. {"Instance", "gtpv2.instance",
  3044. FT_UINT8, BASE_DEC, NULL, 0x0f,
  3045. NULL, HFILL}
  3046. },
  3047. {&hf_gtpv2_imsi,
  3048. {"IMSI(International Mobile Subscriber Identity number)", "gtpv2.imsi",
  3049. FT_STRING, BASE_NONE, NULL, 0,
  3050. NULL, HFILL}
  3051. },
  3052. { &hf_gtpv2_ipv4_addr,
  3053. {"IPv4 Address", "gtpv2.ipv4_addr",
  3054. FT_IPv4, BASE_NONE, NULL, 0x0,
  3055. NULL, HFILL}
  3056. },
  3057. { &hf_gtpv2_cause,
  3058. {"Cause", "gtpv2.cause",
  3059. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_vals_ext, 0x0,
  3060. NULL, HFILL}
  3061. },
  3062. {&hf_gtpv2_cause_cs,
  3063. {"CS (Cause Source)","gtpv2.cs",
  3064. FT_BOOLEAN, 8, TFS(&gtpv2_cause_cs), 0x01,
  3065. NULL, HFILL}
  3066. },
  3067. { &hf_gtpv2_cause_bce,
  3068. {"BCE (Bearer Context IE Error)","gtpv2.bce",
  3069. FT_BOOLEAN, 8, NULL, 0x02,
  3070. NULL, HFILL}
  3071. },
  3072. { &hf_gtpv2_cause_pce,
  3073. {"PCE (PDN Connection IE Error)","gtpv2.pce",
  3074. FT_BOOLEAN, 8, NULL, 0x04,
  3075. NULL, HFILL}
  3076. },
  3077. { &hf_gtpv2_cause_off_ie_t,
  3078. {"Type of the offending IE", "gtpv2.cause_off_ie_t",
  3079. FT_UINT8, BASE_DEC, VALS(gtpv2_element_type_vals), 0x0,
  3080. NULL, HFILL}
  3081. },
  3082. { &hf_gtpv2_rec,
  3083. {"Restart Counter", "gtpv2.rec",
  3084. FT_UINT8, BASE_DEC, NULL, 0x0,
  3085. NULL, HFILL}
  3086. },
  3087. {&hf_gtpv2_apn,
  3088. {"APN (Access Point Name)", "gtpv2.apn",
  3089. FT_STRING, BASE_NONE, NULL, 0x0,
  3090. NULL, HFILL}
  3091. },
  3092. {&hf_gtpv2_ambr_up,
  3093. {"AMBR Uplink (Aggregate Maximum Bit Rate for Uplink)", "gtpv2.ambr_up",
  3094. FT_UINT32, BASE_DEC, NULL, 0x0,
  3095. NULL, HFILL}
  3096. },
  3097. {&hf_gtpv2_ambr_down,
  3098. {"AMBR Downlink(Aggregate Maximum Bit Rate for Downlink)", "gtpv2.ambr_down",
  3099. FT_UINT32, BASE_DEC, NULL, 0x0,
  3100. NULL, HFILL}
  3101. },
  3102. {&hf_gtpv2_ebi,
  3103. {"EPS Bearer ID (EBI)", "gtpv2.ebi",
  3104. FT_UINT8, BASE_DEC, NULL, 0x0f,
  3105. NULL, HFILL}
  3106. },
  3107. { &hf_gtpv2_ip_address_ipv4,
  3108. {"IP address IPv4", "gtpv2.ip_address_ipv4",
  3109. FT_IPv4, BASE_NONE, NULL, 0x0,
  3110. NULL, HFILL}
  3111. },
  3112. { &hf_gtpv2_ip_address_ipv6,
  3113. {"IP address IPv6", "gtpv2.ip_address_ipv6",
  3114. FT_IPv6, BASE_NONE, NULL, 0x0,
  3115. NULL, HFILL}
  3116. },
  3117. {&hf_gtpv2_mei,
  3118. {"MEI(Mobile Equipment Identity)", "gtpv2.mei",
  3119. FT_STRING, BASE_NONE, NULL, 0,
  3120. NULL, HFILL}
  3121. },
  3122. { &hf_gtpv2_pdn_numbers_nsapi,
  3123. {"NSAPI", "gtpv2.pdn_numbers_nsapi",
  3124. FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL}
  3125. },
  3126. { &hf_gtpv2_p_tmsi,
  3127. {"Packet TMSI (P-TMSI)", "gtpv2.p_tmsi",
  3128. FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
  3129. },
  3130. { &hf_gtpv2_p_tmsi_sig,
  3131. {"P-TMSI Signature", "gtpv2.p_tmsi_sig",
  3132. FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}
  3133. },
  3134. {&hf_gtpv2_daf,
  3135. {"DAF (Dual Address Bearer Flag)", "gtpv2.daf",
  3136. FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
  3137. },
  3138. {&hf_gtpv2_dtf,
  3139. {"DTF (Direct Tunnel Flag)","gtpv2.dtf",
  3140. FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}
  3141. },
  3142. {&hf_gtpv2_hi,
  3143. {"HI (Handover Indication)", "gtpv2.hi",
  3144. FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}
  3145. },
  3146. {&hf_gtpv2_dfi,
  3147. {"DFI (Direct Forwarding Indication)", "gtpv2.dfi",
  3148. FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}
  3149. },
  3150. {&hf_gtpv2_oi,
  3151. {"OI (Operation Indication)","gtpv2.oi",
  3152. FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL}
  3153. },
  3154. {&hf_gtpv2_isrsi,
  3155. {"ISRSI (Idle mode Signalling Reduction Supported Indication)", "gtpv2.isrsi",
  3156. FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL}
  3157. },
  3158. {&hf_gtpv2_israi,
  3159. {"ISRAI (Idle mode Signalling Reduction Activation Indication)", "gtpv2.israi",
  3160. FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL}
  3161. },
  3162. {&hf_gtpv2_sgwci,
  3163. {"SGWCI (SGW Change Indication)", "gtpv2.sgwci",
  3164. FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}
  3165. },
  3166. {&hf_gtpv2_sqci,
  3167. {"SQCI (Subscribed QoS Change Indication", "gtpv2.sqci",
  3168. FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}
  3169. },
  3170. {&hf_gtpv2_uimsi,
  3171. {"UIMSI (Unauthenticated IMSI)", "gtpv2.uimsi",
  3172. FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}
  3173. },
  3174. {&hf_gtpv2_cfsi,
  3175. {"CFSI (Change F-TEID support indication)", "gtpv2.cfsi",
  3176. FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}
  3177. },
  3178. {&hf_gtpv2_crsi,
  3179. {"CRSI (Change Reporting support indication):", "gtpv2.crsi",
  3180. FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}
  3181. },
  3182. {&hf_gtpv2_ps,
  3183. {"PS (Piggybacking Supported).)", "gtpv2.ps",
  3184. FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL}
  3185. },
  3186. {&hf_gtpv2_pt,
  3187. {"PT (Protocol Type)", "gtpv2.pt",
  3188. FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL}
  3189. },
  3190. {&hf_gtpv2_si,
  3191. {"SI (Scope Indication)", "gtpv2.si",
  3192. FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL}
  3193. },
  3194. {&hf_gtpv2_msv,
  3195. {"MSV (MS Validated)", "gtpv2.msv",
  3196. FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}
  3197. },
  3198. {&hf_gtpv2_ccrsi,
  3199. {"CCRSI (CSG Change Reporting support indication)", "gtpv2.ccrsi",
  3200. FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}
  3201. },
  3202. { &hf_gtpv2_pdn_type,
  3203. {"PDN Type", "gtpv2.pdn_type",
  3204. FT_UINT8, BASE_DEC, VALS(gtpv2_pdn_type_vals), 0x07,
  3205. NULL, HFILL}
  3206. },
  3207. { &hf_gtpv2_tra_info,
  3208. {"Trace ID","gtpv2.tra_info",
  3209. FT_STRING, BASE_NONE, NULL, 0x0,
  3210. NULL, HFILL}
  3211. },
  3212. { &hf_gtpv2_tra_info_msc_momt_calls,
  3213. {"MO and MT calls","gtpv2.tra_info_msc_momt_calls",
  3214. FT_UINT8, BASE_DEC, NULL, 0x01,
  3215. "MSC Server", HFILL}
  3216. },
  3217. { &hf_gtpv2_tra_info_msc_momt_sms,
  3218. {"MO and MT SMS","gtpv2.tra_info_msc_momt_sms",
  3219. FT_UINT8, BASE_DEC, NULL, 0x02,
  3220. "MSC Server", HFILL}
  3221. },
  3222. { &hf_gtpv2_tra_info_msc_lu_imsi_ad,
  3223. {"LU, IMSI attach, IMSI detach","gtpv2.tra_info_msc_lu_imsi_ad",
  3224. FT_UINT8, BASE_DEC, NULL, 0x04,
  3225. "MSC Server", HFILL}
  3226. },
  3227. { &hf_gtpv2_tra_info_msc_handovers,
  3228. {"Handovers","gtpv2.tra_info_msc_handovers",
  3229. FT_UINT8, BASE_DEC, NULL, 0x08,
  3230. "MSC Server", HFILL}
  3231. },
  3232. { &hf_gtpv2_tra_info_msc_ss,
  3233. {"SS","gtpv2.tra_info_msc_ss",
  3234. FT_UINT8, BASE_DEC, NULL, 0x10,
  3235. "MSC Server", HFILL}
  3236. },
  3237. { &hf_gtpv2_tra_info_mgw_context,
  3238. {"Context","gtpv2.tra_info_mgw_context",
  3239. FT_UINT8, BASE_DEC, NULL, 0x01,
  3240. "MGW", HFILL}
  3241. },
  3242. { &hf_gtpv2_tra_info_sgsn_pdp_context,
  3243. {"PDP context","gtpv2.tra_info_sgsn_pdp_context",
  3244. FT_UINT8, BASE_DEC, NULL, 0x01,
  3245. "SGSN", HFILL}
  3246. },
  3247. { &hf_gtpv2_tra_info_sgsn_momt_sms,
  3248. {"MO and MT SMS","gtpv2.tra_info_sgsn_momt_sms",
  3249. FT_UINT8, BASE_DEC, NULL, 0x02,
  3250. "SGSN", HFILL}
  3251. },
  3252. { &hf_gtpv2_tra_info_sgsn_rau_gprs_ad,
  3253. {"RAU, GPRS attach, GPRS detach","gtpv2.tra_info_sgsn_rau_gprs_ad",
  3254. FT_UINT8, BASE_DEC, NULL, 0x04,
  3255. "SGSN", HFILL}
  3256. },
  3257. { &hf_gtpv2_tra_info_sgsn_mbms,
  3258. {"MBMS Context","gtpv2.tra_into_sgsn_mbms",
  3259. FT_UINT8, BASE_DEC, NULL, 0x08,
  3260. "SGSN", HFILL}
  3261. },
  3262. { &hf_gtpv2_tra_info_sgsn_reserved,
  3263. {"Reserved","gtpv2.",
  3264. FT_UINT8, BASE_DEC, NULL, 0x0,
  3265. "SGSN", HFILL}
  3266. },
  3267. { &hf_gtpv2_tra_info_ggsn_pdp,
  3268. {"PDP Cpntext","gtpv2.tra_info_ggsn_pdp",
  3269. FT_UINT8, BASE_DEC, NULL, 0x01,
  3270. "GGSN", HFILL}
  3271. },
  3272. { &hf_gtpv2_tra_info_ggsn_mbms,
  3273. {"MBMS Context","gtpv2.tra_info_ggsn_mbms",
  3274. FT_UINT8, BASE_DEC, NULL, 0x02,
  3275. "GGSN", HFILL}
  3276. },
  3277. { &hf_gtpv2_tra_info_bm_sc,
  3278. {"MBMS Multicast service activation","gtpv2.tra_info_bm_sc",
  3279. FT_UINT8, BASE_DEC, NULL, 0x01,
  3280. "BM-SC", HFILL}
  3281. },
  3282. { &hf_gtpv2_tra_info_mme_sgw_ss,
  3283. {"Session setup","gtpv2.tra_info_mme_sgw_ss",
  3284. FT_UINT8, BASE_DEC, NULL, 0x01,
  3285. "MME", HFILL}
  3286. },
  3287. { &hf_gtpv2_tra_info_mme_sgw_sr,
  3288. {"Service Request","gtpv2.tra_info_mme_sgw_sr",
  3289. FT_UINT8, BASE_DEC, NULL, 0x02,
  3290. "MME", HFILL}
  3291. },
  3292. { &hf_gtpv2_tra_info_mme_sgw_iataud,
  3293. {"Initial Attach, Tracking area update, Detach","gtpv2.tra_info_mme_sgw_iataud",
  3294. FT_UINT8, BASE_DEC, NULL, 0x04,
  3295. "MME", HFILL}
  3296. },
  3297. { &hf_gtpv2_tra_info_lne_msc_s,
  3298. {"MSC-S","gtpv2.tra_info_lne_msc_s",
  3299. FT_UINT8, BASE_DEC, NULL, 0x01,
  3300. "List of NE Types", HFILL}
  3301. },
  3302. { &hf_gtpv2_tra_info_lne_mgw,
  3303. {"MGW","gtpv2.tra_info_lne_mgw",
  3304. FT_UINT8, BASE_DEC, NULL, 0x02,
  3305. "List of NE Types", HFILL}
  3306. },
  3307. { &hf_gtpv2_tra_info_lne_sgsn,
  3308. {"SGSN","gtpv2.tra_info_lne_sgsn",
  3309. FT_UINT8, BASE_DEC, NULL, 0x04,
  3310. "List of NE Types", HFILL}
  3311. },
  3312. { &hf_gtpv2_tra_info_lne_ggsn,
  3313. {"GGSN","gtpv2.tra_info_lne_ggsn",
  3314. FT_UINT8, BASE_DEC, NULL, 0x08,
  3315. "List of NE Types", HFILL}
  3316. },
  3317. { &hf_gtpv2_tra_info_lne_rnc,
  3318. {"RNC","gtpv2.tra_info_lne_rnc",
  3319. FT_UINT8, BASE_DEC, NULL, 0x10,
  3320. "List of NE Types", HFILL}
  3321. },
  3322. { &hf_gtpv2_tra_info_lne_bm_sc,
  3323. {"BM-SC","gtpv2.tra_info_lne_bm_sc",
  3324. FT_UINT8, BASE_DEC, NULL, 0x20,
  3325. "List of NE Types", HFILL}
  3326. },
  3327. { &hf_gtpv2_tra_info_lne_mme,
  3328. {"MME","gtpv2.tra_info_lne_mme",
  3329. FT_UINT8, BASE_DEC, NULL, 0x40,
  3330. "List of NE Types", HFILL}
  3331. },
  3332. { &hf_gtpv2_tra_info_lne_sgw,
  3333. {"SGW","gtpv2.tra_info_lne_sgw",
  3334. FT_UINT8, BASE_DEC, NULL, 0x80,
  3335. "List of NE Types", HFILL}
  3336. },
  3337. { &hf_gtpv2_tra_info_lne_pdn_gw,
  3338. {"PDN GW","gtpv2.tra_info_lne_pdn_gw",
  3339. FT_UINT8, BASE_DEC, NULL, 0x01,
  3340. "List of NE Types", HFILL}
  3341. },
  3342. { &hf_gtpv2_tra_info_lne_enb,
  3343. {"eNB","gtpv2.tra_info_lne_enb",
  3344. FT_UINT8, BASE_DEC, NULL, 0x02,
  3345. "List of NE Types", HFILL}
  3346. },
  3347. { &hf_gtpv2_tra_info_tdl,
  3348. {"Trace Depth Length","gtpv2.tra_info_tdl",
  3349. FT_UINT8, BASE_DEC, NULL, 0x0,
  3350. NULL, HFILL}
  3351. },
  3352. { &hf_gtpv2_tra_info_lmsc_a,
  3353. {"A","gtpv2.tra_info_lmsc_a",
  3354. FT_UINT8, BASE_DEC, NULL, 0x01,
  3355. "MSC Server", HFILL}
  3356. },
  3357. { &hf_gtpv2_tra_info_lmsc_lu,
  3358. {"Iu","gtpv2.tra_info_lmsc_lu",
  3359. FT_UINT8, BASE_DEC, NULL, 0x02,
  3360. "MSC Server", HFILL}
  3361. },
  3362. { &hf_gtpv2_tra_info_lmsc_mc,
  3363. {"Mc","gtpv2.tra_info_lmsc_mc",
  3364. FT_UINT8, BASE_DEC, NULL, 0x04,
  3365. "MSC Server", HFILL}
  3366. },
  3367. { &hf_gtpv2_tra_info_lmsc_map_g,
  3368. {"MAP-G","gtpv2.tra_info_lmsc_map_g",
  3369. FT_UINT8, BASE_DEC, NULL, 0x08,
  3370. "MSC Server", HFILL}
  3371. },
  3372. { &hf_gtpv2_tra_info_lmsc_map_b,
  3373. {"MAP-B","gtpv2.tra_info_lmsc_map_b",
  3374. FT_UINT8, BASE_DEC, NULL, 0x10,
  3375. "MSC Server", HFILL}
  3376. },
  3377. { &hf_gtpv2_tra_info_lmsc_map_e,
  3378. {"MAP-E","gtpv2.tra_info_lmsc_map_e",
  3379. FT_UINT8, BASE_DEC, NULL, 0x20,
  3380. "MSC Server", HFILL}
  3381. },
  3382. { &hf_gtpv2_tra_info_lmsc_map_f,
  3383. {"MAP-F","gtpv2.tra_info_lmsc_map_f",
  3384. FT_UINT8, BASE_DEC, NULL, 0x40,
  3385. "MSC Server", HFILL}
  3386. },
  3387. { &hf_gtpv2_tra_info_lmsc_cap,
  3388. {"CAP","gtpv2.tra_info_lmsc_cap",
  3389. FT_UINT8, BASE_DEC, NULL, 0x80,
  3390. "MSC Server", HFILL}
  3391. },
  3392. { &hf_gtpv2_tra_info_lmsc_map_d,
  3393. {"MAP-D","gtpv2.tra_info_lmsc_map_d",
  3394. FT_UINT8, BASE_DEC, NULL, 0x01,
  3395. "MSC Server", HFILL}
  3396. },
  3397. { &hf_gtpv2_tra_info_lmsc_map_c,
  3398. {"MAP-C","gtpv2.tra_info_lmsc_map_c",
  3399. FT_UINT8, BASE_DEC, NULL, 0x02,
  3400. "MSC Server", HFILL}
  3401. },
  3402. { &hf_gtpv2_tra_info_lmgw_mc,
  3403. {"Mc","gtpv2.tra_info_lmgw_mc",
  3404. FT_UINT8, BASE_DEC, NULL, 0x01,
  3405. "MGW", HFILL}
  3406. },
  3407. { &hf_gtpv2_tra_info_lmgw_nb_up,
  3408. {"Nb-UP","gtpv2.tra_info_lmgw_nb_up",
  3409. FT_UINT8, BASE_DEC, NULL, 0x2,
  3410. "MGW", HFILL}
  3411. },
  3412. { &hf_gtpv2_tra_info_lmgw_lu_up,
  3413. {"Iu-UP","gtpv2.tra_info_lmgw_lu_up",
  3414. FT_UINT8, BASE_DEC, NULL, 0x04,
  3415. "MGW", HFILL}
  3416. },
  3417. { &hf_gtpv2_tra_info_lsgsn_gb,
  3418. {"Gb","gtpv2.tra_info_lsgsn_gb",
  3419. FT_UINT8, BASE_DEC, NULL, 0x01,
  3420. "SGSN", HFILL}
  3421. },
  3422. { &hf_gtpv2_tra_info_lsgsn_lu,
  3423. {"Iu","gtpv2.tra_info_lsgsn_lu",
  3424. FT_UINT8, BASE_DEC, NULL, 0x02,
  3425. "SGSN", HFILL}
  3426. },
  3427. { &hf_gtpv2_tra_info_lsgsn_gn,
  3428. {"Gn","gtpv2.tra_info_lsgsn_gn",
  3429. FT_UINT8, BASE_DEC, NULL, 0x04,
  3430. "SGSN", HFILL}
  3431. },
  3432. { &hf_gtpv2_tra_info_lsgsn_map_gr,
  3433. {"MAP-Gr","gtpv2.tra_info_lsgsn_map_gr",
  3434. FT_UINT8, BASE_DEC, NULL, 0x08,
  3435. "SGSN", HFILL}
  3436. },
  3437. { &hf_gtpv2_tra_info_lsgsn_map_gd,
  3438. {"MAP-Gd","gtpv2.tra_info_lsgsn_map_gd",
  3439. FT_UINT8, BASE_DEC, NULL, 0x10,
  3440. "SGSN", HFILL}
  3441. },
  3442. { &hf_gtpv2_tra_info_lsgsn_map_gf,
  3443. {"MAP-Gf","gtpv2.tra_info_lsgsn_map_gf",
  3444. FT_UINT8, BASE_DEC, NULL, 0x20,
  3445. "SGSN", HFILL}
  3446. },
  3447. { &hf_gtpv2_tra_info_lsgsn_gs,
  3448. {"Gs","gtpv2.tra_info_lsgsn_gs",
  3449. FT_UINT8, BASE_DEC, NULL, 0x40,
  3450. "SGSN", HFILL}
  3451. },
  3452. { &hf_gtpv2_tra_info_lsgsn_ge,
  3453. {"Ge","gtpv2.tra_info_lsgsn_ge",
  3454. FT_UINT8, BASE_DEC, NULL, 0x80,
  3455. "SGSN", HFILL}
  3456. },
  3457. { &hf_gtpv2_tra_info_lggsn_gn,
  3458. {"Gn","gtpv2.tra_info_lggsn_gn",
  3459. FT_UINT8, BASE_DEC, NULL, 0x01,
  3460. "GGSN", HFILL}
  3461. },
  3462. { &hf_gtpv2_tra_info_lggsn_gi,
  3463. {"Gi","gtpv2.tra_info_lggsn_gi",
  3464. FT_UINT8, BASE_DEC, NULL, 0x02,
  3465. "GGSN", HFILL}
  3466. },
  3467. { &hf_gtpv2_tra_info_lggsn_gmb,
  3468. {"Gmb","gtpv2.tra_info_lggsn_gmb",
  3469. FT_UINT8, BASE_DEC, NULL, 0x04,
  3470. "GGSN", HFILL}
  3471. },
  3472. { &hf_gtpv2_tra_info_lrnc_lu,
  3473. {"Iu","gtpv2.tra_info_lrnc_lu",
  3474. FT_UINT8, BASE_DEC, NULL, 0x01,
  3475. "RNC", HFILL}
  3476. },
  3477. { &hf_gtpv2_tra_info_lrnc_lur,
  3478. {"Iur","gtpv2.tra_info_lrnc_lur",
  3479. FT_UINT8, BASE_DEC, NULL, 0x02,
  3480. "RNC", HFILL}
  3481. },
  3482. { &hf_gtpv2_tra_info_lrnc_lub,
  3483. {"Iub","gtpv2.tra_info_lrnc_lub",
  3484. FT_UINT8, BASE_DEC, NULL, 0x04,
  3485. "RNC", HFILL}
  3486. },
  3487. { &hf_gtpv2_tra_info_lrnc_uu,
  3488. {"Uu","gtpv2.tra_info_lrnc_uu",
  3489. FT_UINT8, BASE_DEC, NULL, 0x08,
  3490. "RNC", HFILL}
  3491. },
  3492. { &hf_gtpv2_tra_info_lbm_sc_gmb,
  3493. {"Gmb","gtpv2.tra_info_lbm_sc_gmb",
  3494. FT_UINT8, BASE_DEC, NULL, 0x01,
  3495. "BM-SC", HFILL}
  3496. },
  3497. { &hf_gtpv2_tra_info_lmme_s1_mme,
  3498. {"S1-MME","gtpv2.tra_info_lmme_s1_mme",
  3499. FT_UINT8, BASE_DEC, NULL, 0x01,
  3500. "MME", HFILL}
  3501. },
  3502. { &hf_gtpv2_tra_info_lmme_s3,
  3503. {"S3","gtpv2.tra_info_lmme_s3",
  3504. FT_UINT8, BASE_DEC, NULL, 0x02,
  3505. "MME", HFILL}
  3506. },
  3507. { &hf_gtpv2_tra_info_lmme_s6a,
  3508. {"S6a","gtpv2.tra_info_lmme_s6a",
  3509. FT_UINT8, BASE_DEC, NULL, 0x04,
  3510. "MME", HFILL}
  3511. },
  3512. { &hf_gtpv2_tra_info_lmme_s10,
  3513. {"S10","gtpv2.tra_info_lmme_s10",
  3514. FT_UINT8, BASE_DEC, NULL, 0x08,
  3515. "MME", HFILL}
  3516. },
  3517. { &hf_gtpv2_tra_info_lmme_s11,
  3518. {"S11","gtpv2.tra_info_lmme_s11",
  3519. FT_UINT8, BASE_DEC, NULL, 0x10,
  3520. "MME", HFILL}
  3521. },
  3522. { &hf_gtpv2_tra_info_lsgw_s4,
  3523. {"S4","gtpv2.tra_info_lsgw_s4",
  3524. FT_UINT8, BASE_DEC, NULL, 0x01,
  3525. "SGW", HFILL}
  3526. },
  3527. { &hf_gtpv2_tra_info_lsgw_s5,
  3528. {"S5","gtpv2.tra_info_lsgw_s5",
  3529. FT_UINT8, BASE_DEC, NULL, 0x02,
  3530. "SGW", HFILL}
  3531. },
  3532. { &hf_gtpv2_tra_info_lsgw_s8b,
  3533. {"S8b","gtpv2.tra_info_lsgw_s8b",
  3534. FT_UINT8, BASE_DEC, NULL, 0x04,
  3535. "SGW", HFILL}
  3536. },
  3537. { &hf_gtpv2_tra_info_lsgw_s11,
  3538. {"S11","gtpv2.tra_info_lsgw_s11",
  3539. FT_UINT8, BASE_DEC, NULL, 0x08,
  3540. "SGW", HFILL}
  3541. },
  3542. { &hf_gtpv2_tra_info_lpdn_gw_s2a,
  3543. {"S2a","gtpv2.tra_info_lpdn_gw_s2a",
  3544. FT_UINT8, BASE_DEC, NULL, 0x01,
  3545. "PDN GW", HFILL}
  3546. },
  3547. { &hf_gtpv2_tra_info_lpdn_gw_s2b,
  3548. {"S2b","gtpv2.tra_info_lpdn_gw_s2b",
  3549. FT_UINT8, BASE_DEC, NULL, 0x02,
  3550. "PDN GW", HFILL}
  3551. },
  3552. { &hf_gtpv2_tra_info_lpdn_gw_s2c,
  3553. {"S2c","gtpv2.tra_info_lpdn_gw_s2c",
  3554. FT_UINT8, BASE_DEC, NULL, 0x04,
  3555. "PDN GW", HFILL}
  3556. },
  3557. { &hf_gtpv2_tra_info_lpdn_gw_s5,
  3558. {"S5","gtpv2.tra_info_lpdn_gw_s5",
  3559. FT_UINT8, BASE_DEC, NULL, 0x08,
  3560. "PDN GW", HFILL}
  3561. },
  3562. { &hf_gtpv2_tra_info_lpdn_gw_s6c,
  3563. {"S6c","gtpv2.tra_info_lpdn_gw_s6c",
  3564. FT_UINT8, BASE_DEC, NULL, 0x10,
  3565. "PDN GW", HFILL}
  3566. },
  3567. { &hf_gtpv2_tra_info_lpdn_gw_gx,
  3568. {"Gx","gtpv2.tra_info_lpdn_gw_gx",
  3569. FT_UINT8, BASE_DEC, NULL, 0x20,
  3570. "PDN GW", HFILL}
  3571. },
  3572. { &hf_gtpv2_tra_info_lpdn_gw_s8b,
  3573. {"S8b","gtpv2.tra_info_lpdn_gw_s8b",
  3574. FT_UINT8, BASE_DEC, NULL, 0x40,
  3575. "PDN GW", HFILL}
  3576. },
  3577. { &hf_gtpv2_tra_info_lpdn_gw_sgi,
  3578. {"SGi","gtpv2.tra_info_lpdn_gw_sgi",
  3579. FT_UINT8, BASE_DEC, NULL, 0x80,
  3580. "PDN GW", HFILL}
  3581. },
  3582. { &hf_gtpv2_tra_info_lenb_s1_mme,
  3583. {"S1-MME","gtpv2.tra_info_lenb_s1_mme",
  3584. FT_UINT8, BASE_DEC, NULL, 0x01,
  3585. "eNB", HFILL}
  3586. },
  3587. { &hf_gtpv2_tra_info_lenb_x2,
  3588. {"X2","gtpv2.tra_info_lenb_x2",
  3589. FT_UINT8, BASE_DEC, NULL, 0x02,
  3590. "eNB", HFILL}
  3591. },
  3592. { &hf_gtpv2_tra_info_lenb_uu,
  3593. {"Uu","gtpv2.tra_info_lenb_uu",
  3594. FT_UINT8, BASE_DEC, NULL, 0x04,
  3595. "eNB", HFILL}
  3596. },
  3597. { &hf_gtpv2_pdn_ipv4,
  3598. {"PDN Address and Prefix(IPv4)", "gtpv2.pdn_addr_and_prefix.ipv4",
  3599. FT_IPv4, BASE_NONE, NULL, 0x0,
  3600. NULL, HFILL}
  3601. },
  3602. { &hf_gtpv2_pdn_ipv6_len,
  3603. {"IPv6 Prefix Length", "gtpv2.pdn_ipv6_len",
  3604. FT_UINT8, BASE_DEC, NULL, 0x0,
  3605. NULL, HFILL}
  3606. },
  3607. { &hf_gtpv2_pdn_ipv6,
  3608. {"PDN Address and Prefix(IPv6)", "gtpv2.pdn_addr_and_prefix.ipv6",
  3609. FT_BYTES, BASE_NONE, NULL, 0x0,
  3610. NULL, HFILL}
  3611. },
  3612. {&hf_gtpv2_bearer_qos_pvi,
  3613. {"PVI (Pre-emption Vulnerability)", "gtpv2.bearer_qos_pvi",
  3614. FT_BOOLEAN, 8, NULL, 0x01,
  3615. NULL, HFILL}
  3616. },
  3617. {&hf_gtpv2_bearer_qos_pl,
  3618. {"PL (Priority Level)", "gtpv2.bearer_qos_pl",
  3619. FT_UINT8, BASE_DEC, NULL, 0x3c,
  3620. NULL, HFILL}
  3621. },
  3622. {&hf_gtpv2_bearer_qos_pci,
  3623. {"PCI (Pre-emption Capability)", "gtpv2.bearer_qos_pci",
  3624. FT_BOOLEAN, 8, NULL, 0x40,
  3625. NULL, HFILL}
  3626. },
  3627. {&hf_gtpv2_bearer_qos_label_qci,
  3628. {"Label (QCI)", "gtpv2.bearer_qos_label_qci",
  3629. FT_UINT8, BASE_DEC, NULL, 0x0,
  3630. NULL, HFILL}
  3631. },
  3632. {&hf_gtpv2_bearer_qos_mbr_up,
  3633. {"Maximum Bit Rate For Uplink", "gtpv2.bearer_qos_mbr_up",
  3634. FT_UINT64, BASE_DEC, NULL, 0x0,
  3635. NULL, HFILL}
  3636. },
  3637. {&hf_gtpv2_bearer_qos_mbr_down,
  3638. {"Maximum Bit Rate For Downlink", "gtpv2.bearer_qos_mbr_down",
  3639. FT_UINT64, BASE_DEC, NULL, 0x0,
  3640. NULL, HFILL}
  3641. },
  3642. {&hf_gtpv2_bearer_qos_gbr_up,
  3643. {"Guaranteed Bit Rate For Uplink", "gtpv2.bearer_qos_gbr_up",
  3644. FT_UINT64, BASE_DEC, NULL, 0x0,
  3645. NULL, HFILL}
  3646. },
  3647. {&hf_gtpv2_bearer_qos_gbr_down,
  3648. {"Guaranteed Bit Rate For Downlink", "gtpv2.bearer_qos_gbr_down",
  3649. FT_UINT64, BASE_DEC, NULL, 0x0,
  3650. NULL, HFILL}
  3651. },
  3652. {&hf_gtpv2_flow_qos_label_qci,
  3653. {"Label (QCI)", "gtpv2.flow_qos_label_qci",
  3654. FT_UINT8, BASE_DEC, NULL, 0x0,
  3655. NULL, HFILL}
  3656. },
  3657. {&hf_gtpv2_flow_qos_mbr_up,
  3658. {"Maximum Bit Rate For Uplink", "gtpv2.flow_qos_mbr_up",
  3659. FT_UINT64, BASE_DEC, NULL, 0x0,
  3660. NULL, HFILL}
  3661. },
  3662. {&hf_gtpv2_flow_qos_mbr_down,
  3663. {"Maximum Bit Rate For Downlink", "gtpv2.flow_qos_mbr_down",
  3664. FT_UINT64, BASE_DEC, NULL, 0x0,
  3665. NULL, HFILL}
  3666. },
  3667. {&hf_gtpv2_flow_qos_gbr_up,
  3668. {"Guaranteed Bit Rate For Uplink", "gtpv2.flow_qos_gbr_up",
  3669. FT_UINT64, BASE_DEC, NULL, 0x0,
  3670. NULL, HFILL}
  3671. },
  3672. {&hf_gtpv2_flow_qos_gbr_down,
  3673. {"Guaranteed Bit Rate For Downlink", "gtpv2.flow_qos_gbr_down",
  3674. FT_UINT64, BASE_DEC, NULL, 0x0,
  3675. NULL, HFILL}
  3676. },
  3677. { &hf_gtpv2_rat_type,
  3678. {"RAT Type", "gtpv2.rat_type",
  3679. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_rat_type_vals_ext, 0x0,
  3680. NULL, HFILL}
  3681. },
  3682. { &hf_gtpv2_uli_ecgi_flg,
  3683. {"ECGI Present Flag)", "gtpv2.uli_ecgi_flg",
  3684. FT_BOOLEAN, 8, NULL, GTPv2_ULI_ECGI_MASK,
  3685. NULL, HFILL}
  3686. },
  3687. { &hf_gtpv2_uli_lai_flg,
  3688. {"LAI Present Flag)", "gtpv2.uli_lai_flg",
  3689. FT_BOOLEAN, 8, NULL, GTPv2_ULI_LAI_MASK,
  3690. NULL, HFILL}
  3691. },
  3692. { &hf_gtpv2_uli_tai_flg,
  3693. {"TAI Present Flag)", "gtpv2.uli_tai_flg",
  3694. FT_BOOLEAN, 8, NULL, GTPv2_ULI_TAI_MASK,
  3695. NULL, HFILL}
  3696. },
  3697. { &hf_gtpv2_uli_rai_flg,
  3698. {"RAI Present Flag)", "gtpv2.uli_rai_flg",
  3699. FT_BOOLEAN, 8, NULL, GTPv2_ULI_RAI_MASK,
  3700. NULL, HFILL}
  3701. },
  3702. { &hf_gtpv2_uli_sai_flg,
  3703. {"SAI Present Flag)", "gtpv2.uli_sai_flg",
  3704. FT_BOOLEAN, 8, NULL, GTPv2_ULI_SAI_MASK,
  3705. NULL, HFILL}
  3706. },
  3707. { &hf_gtpv2_uli_cgi_flg,
  3708. {"CGI Present Flag)", "gtpv2.uli_cgi_flg",
  3709. FT_BOOLEAN, 8, NULL, GTPv2_ULI_CGI_MASK,
  3710. NULL, HFILL}
  3711. },
  3712. { &hf_gtpv2_uli_cgi_lac,
  3713. {"Location Area Code", "gtpv2.uli_cgi_lac",
  3714. FT_UINT16, BASE_DEC, NULL, 0x0,
  3715. NULL, HFILL}
  3716. },
  3717. { &hf_gtpv2_uli_cgi_ci,
  3718. {"Cell Identity", "gtpv2.uli_cgi_ci",
  3719. FT_UINT16, BASE_DEC, NULL, 0x0,
  3720. NULL, HFILL}
  3721. },
  3722. { &hf_gtpv2_uli_sai_lac,
  3723. {"Location Area Code", "gtpv2.uli_sai_lac",
  3724. FT_UINT16, BASE_DEC, NULL, 0x0,
  3725. NULL, HFILL}
  3726. },
  3727. { &hf_gtpv2_uli_sai_sac,
  3728. {"Service Area Code", "gtpv2.uli_sai_sac",
  3729. FT_UINT16, BASE_DEC, NULL, 0x0,
  3730. NULL, HFILL}
  3731. },
  3732. { &hf_gtpv2_uli_rai_lac,
  3733. {"Location Area Code", "gtpv2.uli_rai_lac",
  3734. FT_UINT16, BASE_DEC, NULL, 0x0,
  3735. NULL, HFILL}
  3736. },
  3737. { &hf_gtpv2_uli_rai_rac,
  3738. {"Routing Area Code", "gtpv2.uli_rai_rac",
  3739. FT_UINT16, BASE_DEC, NULL, 0x0,
  3740. NULL, HFILL}
  3741. },
  3742. { &hf_gtpv2_uli_tai_tac,
  3743. {"Tracking Area Code", "gtpv2.uli_tai_tac",
  3744. FT_UINT16, BASE_DEC, NULL, 0x0,
  3745. NULL, HFILL}
  3746. },
  3747. {&hf_gtpv2_uli_ecgi_eci,
  3748. {"ECI (E-UTRAN Cell Identifier)", "gtpv2.uli_ecgi_eci",
  3749. FT_UINT32, BASE_HEX, NULL, 0x0,
  3750. NULL, HFILL}
  3751. },
  3752. {&hf_gtpv2_uli_lai_lac,
  3753. {"Location Area Code (LAC)", "gtpv2.uli_lai_lac",
  3754. FT_UINT16, BASE_HEX, NULL, 0x0,
  3755. NULL, HFILL}
  3756. },
  3757. {&hf_gtpv2_uli_ecgi_eci_spare,
  3758. {"Spare", "gtpv2.uli_ecgi_eci_spare",
  3759. FT_UINT8, BASE_DEC, NULL, 0x0,
  3760. NULL, HFILL}
  3761. },
  3762. { &hf_gtpv2_nsapi,
  3763. {"NSAPI", "gtpv2.nsapi",
  3764. FT_UINT8, BASE_DEC, NULL, 0x0f,
  3765. NULL, HFILL}
  3766. },
  3767. {&hf_gtpv2_f_teid_v4,
  3768. {"V4", "gtpv2.f_teid_v4",
  3769. FT_BOOLEAN, 8, TFS(&gtpv2_f_teid_v4_vals), 0x80,
  3770. NULL, HFILL}
  3771. },
  3772. {&hf_gtpv2_f_teid_v6,
  3773. {"V6", "gtpv2.f_teid_v6",
  3774. FT_BOOLEAN, 8, TFS(&gtpv2_f_teid_v6_vals), 0x40,
  3775. NULL, HFILL}
  3776. },
  3777. {&hf_gtpv2_f_teid_interface_type,
  3778. {"Interface Type", "gtpv2.f_teid_interface_type",
  3779. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_f_teid_interface_type_vals_ext, 0x1f,
  3780. NULL , HFILL}
  3781. },
  3782. {&hf_gtpv2_f_teid_gre_key,
  3783. {"TEID/GRE Key", "gtpv2.f_teid_gre_key",
  3784. FT_UINT32, BASE_DEC, NULL, 0x0,
  3785. NULL , HFILL}
  3786. },
  3787. { &hf_gtpv2_f_teid_ipv4,
  3788. {"F-TEID IPv4", "gtpv2.f_teid_ipv4",
  3789. FT_IPv4, BASE_NONE, NULL, 0x0,
  3790. NULL, HFILL}
  3791. },
  3792. { &hf_gtpv2_f_teid_ipv6,
  3793. {"F-TEID IPv6", "gtpv2.f_teid_ipv6",
  3794. FT_IPv6, BASE_NONE, NULL, 0x0,
  3795. NULL, HFILL}
  3796. },
  3797. { &hf_gtpv2_tmsi,
  3798. {"TMSI", "gtpv2.tmsi",
  3799. FT_UINT32, BASE_HEX, NULL, 0x0,
  3800. NULL, HFILL}
  3801. },
  3802. { &hf_gtpv2_hsgw_addr_f_len,
  3803. {"HSGW Address for forwarding Length", "gtpv2.hsgw_addr_f_len",
  3804. FT_UINT8, BASE_DEC, NULL, 0x0,
  3805. NULL, HFILL}
  3806. },
  3807. { &hf_gtpv2_hsgw_addr_ipv4,
  3808. {"HSGW Address for forwarding", "gtpv2.hsgw_addr_ipv4",
  3809. FT_IPv4, BASE_NONE, NULL, 0x0,
  3810. NULL, HFILL}
  3811. },
  3812. { &hf_gtpv2_hsgw_addr_ipv6,
  3813. {"HSGW Address for forwarding", "gtpv2.hsgw_addr_ipv6",
  3814. FT_IPv6, BASE_NONE, NULL, 0x0,
  3815. NULL, HFILL}
  3816. },
  3817. { &hf_gtpv2_gre_key,
  3818. {"GRE Key", "gtpv2.gre_key",
  3819. FT_UINT32, BASE_DEC, NULL, 0x0,
  3820. NULL , HFILL}
  3821. },
  3822. { &hf_gtpv2_sgw_addr_ipv4,
  3823. {"Serving GW Address", "gtpv2.sgw_addr_ipv4",
  3824. FT_IPv4, BASE_NONE, NULL, 0x0,
  3825. NULL, HFILL}
  3826. },
  3827. { &hf_gtpv2_sgw_addr_ipv6,
  3828. {"Serving GW Address", "gtpv2.sgw_addr_ipv6",
  3829. FT_IPv6, BASE_NONE, NULL, 0x0,
  3830. NULL, HFILL}
  3831. },
  3832. { &hf_gtpv2_sgw_s1u_teid,
  3833. {"Serving GW S1-U TEID", "gtpv2.sgw_s1u_teid",
  3834. FT_UINT32, BASE_HEX, NULL, 0x0,
  3835. NULL, HFILL}
  3836. },
  3837. {&hf_gtpv2_delay_value,
  3838. {"Delay Value (In integer multiples of 50 milliseconds or zero)", "gtpv2.delay_value",
  3839. FT_UINT8, BASE_DEC, NULL, 0x0,
  3840. NULL, HFILL}
  3841. },
  3842. {&hf_gtpv2_charging_id,
  3843. {"Charging id", "gtpv2.charging_id",
  3844. FT_UINT32, BASE_DEC, NULL, 0x0,
  3845. NULL, HFILL}
  3846. },
  3847. {&hf_gtpv2_charging_characteristic,
  3848. {"Charging Characteristic", "gtpv2.charging_characteristic",
  3849. FT_UINT16, BASE_HEX, NULL, 0xffff,
  3850. NULL, HFILL}
  3851. },
  3852. {&hf_gtpv2_bearer_flag_ppc,
  3853. {"PPC (Prohibit Payload Compression)", "gtpv2.bearer_flag.ppc",
  3854. FT_BOOLEAN, 8, NULL, 0x01,
  3855. NULL, HFILL}
  3856. },
  3857. {&hf_gtpv2_bearer_flag_vb,
  3858. {"VB (Voice Bearer)", "gtpv2.bearer_flag.vb",
  3859. FT_BOOLEAN, 8, NULL, 0x02,
  3860. NULL, HFILL}
  3861. },
  3862. {&hf_gtpv2_pti,
  3863. {"Procedure Transaction Id", "gtpv2.pti",
  3864. FT_UINT8, BASE_DEC, NULL, 0x0,
  3865. NULL, HFILL}
  3866. },
  3867. /* MM Context */
  3868. { &hf_gtpv2_mm_context_sm,
  3869. {"Security Mode", "gtpv2.mm_context_sm",
  3870. FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_security_mode), 0xe0,
  3871. NULL, HFILL}
  3872. },
  3873. { &hf_gtpv2_mm_context_nhi,
  3874. {"NHI(Next Hop Indicator)", "gtpv2.mm_context_nhi",
  3875. FT_BOOLEAN, 8, TFS(&gtpv2_nhi_vals), 0x10,
  3876. NULL, HFILL}
  3877. },
  3878. { &hf_gtpv2_mm_context_drxi,
  3879. {"DRXI", "gtpv2.mm_context_drxi",
  3880. FT_UINT8, BASE_DEC, NULL, 0x08,
  3881. NULL, HFILL}
  3882. },
  3883. { &hf_gtpv2_mm_context_cksn,
  3884. {"CKSN", "gtpv2.mm_context_cksn",
  3885. FT_UINT8, BASE_DEC, NULL, 0x07,
  3886. NULL, HFILL}
  3887. },
  3888. { &hf_gtpv2_mm_context_cksn_ksi,
  3889. {"CKSN/KSI", "gtpv2.mm_context_cksn_ksi",
  3890. FT_UINT8, BASE_DEC, NULL, 0x07,
  3891. NULL, HFILL}
  3892. },
  3893. { &hf_gtpv2_mm_context_ksi_a,
  3894. {"KSI_asme", "gtpv2.mm_context_ksi_a",
  3895. FT_UINT8, BASE_DEC, NULL, 0x07,
  3896. NULL, HFILL}
  3897. },
  3898. { &hf_gtpv2_mm_context_nr_tri,
  3899. {"Number of Triplet", "gtpv2.mm_context_nr_tri",
  3900. FT_UINT8, BASE_DEC, NULL, 0xe0,
  3901. NULL, HFILL}
  3902. },
  3903. { &hf_gtpv2_mm_context_unipa,
  3904. {"Used NAS integrity protection algorithm", "gtpv2.mm_context_unipa",
  3905. FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_unipa_vals), 0x70,
  3906. NULL, HFILL}
  3907. },
  3908. { &hf_gtpv2_mm_context_unc,
  3909. {"Used NAS Cipher", "gtpv2.mm_context_unc",
  3910. FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_unc_vals), 0x0f,
  3911. NULL, HFILL}
  3912. },
  3913. { &hf_gtpv2_mm_context_nas_dl_cnt,
  3914. {"NAS Downlink Count", "gtpv2.mm_context_nas_dl_cnt",
  3915. FT_UINT24, BASE_DEC, NULL, 0x0,
  3916. NULL, HFILL}
  3917. },
  3918. { &hf_gtpv2_mm_context_nas_ul_cnt,
  3919. {"NAS Uplink Count", "gtpv2.mm_context_nas_ul_cnt",
  3920. FT_UINT24, BASE_DEC, NULL, 0x0,
  3921. NULL, HFILL}
  3922. },
  3923. { &hf_gtpv2_mm_context_ksi,
  3924. {"KSI", "gtpv2.mm_context_ksi",
  3925. FT_UINT8, BASE_DEC, NULL, 0x07,
  3926. NULL, HFILL}
  3927. },
  3928. { &hf_gtpv2_mm_context_nr_qui,
  3929. {"Number of Quintuplets", "gtpv2.mm_context_nr_qui",
  3930. FT_UINT8, BASE_DEC, NULL, 0xe0,
  3931. NULL, HFILL}
  3932. },
  3933. { &hf_gtpv2_mm_context_nr_qua,
  3934. {"Number of Quadruplet", "gtpv2.mm_context_nr_qua",
  3935. FT_UINT8, BASE_DEC, NULL, 0x1c,
  3936. NULL, HFILL}
  3937. },
  3938. {&hf_gtpv2_ue_time_zone_dst,
  3939. {"Daylight Saving Time","gtpv2.ue_time_zone_dst",
  3940. FT_UINT8, BASE_DEC, VALS(gtpv2_ue_time_zone_dst_vals),0x03,
  3941. NULL, HFILL}
  3942. },
  3943. { &hf_gtpv2_fq_csid_type,
  3944. {"Node-ID Type", "gtpv2.fq_csid_type",
  3945. FT_UINT8, BASE_DEC, NULL, 0xf0,
  3946. NULL, HFILL}
  3947. },
  3948. { &hf_gtpv2_fq_csid_nr,
  3949. {"Number of CSIDs", "gtpv2.fq_csid_nr",
  3950. FT_UINT8, BASE_DEC, NULL, 0x0f,
  3951. NULL, HFILL}
  3952. },
  3953. { &hf_gtpv2_fq_csid_ipv4,
  3954. {"Node-ID (IPv4)", "gtpv2.fq_csid_ipv4",
  3955. FT_IPv4, BASE_NONE, NULL, 0x0,
  3956. NULL, HFILL}
  3957. },
  3958. { &hf_gtpv2_fq_csid_ipv6,
  3959. {"Node-ID (IPv6)", "gtpv2.fq_csid_ipv6",
  3960. FT_IPv6, BASE_NONE, NULL, 0x0,
  3961. NULL, HFILL}
  3962. },
  3963. { &hf_gtpv2_fq_csid_id,
  3964. {"CSID", "gtpv2.fq_csid_id",
  3965. FT_UINT16, BASE_DEC, NULL, 0x0,
  3966. NULL, HFILL}
  3967. },
  3968. { &hf_gtpv2_complete_req_msg_type,
  3969. {"Complete Request Message Type","gtpv2.complete_req_msg_type",
  3970. FT_UINT8, BASE_DEC, VALS(gtpv2_complete_req_msg_type_vals),0x0,
  3971. NULL, HFILL}
  3972. },
  3973. {&hf_gtpv2_mme_grp_id,
  3974. {"MME Group ID","gtpv2.mme_grp_id",
  3975. FT_UINT16, BASE_DEC, NULL,0x0,
  3976. NULL, HFILL}
  3977. },
  3978. { &hf_gtpv2_mme_code,
  3979. {"MME Code","gtpv2.mme_code",
  3980. FT_UINT8, BASE_DEC, NULL,0x0,
  3981. NULL, HFILL}
  3982. },
  3983. { &hf_gtpv2_m_tmsi,
  3984. {"M-TMSI","gtpv2.m_tmsi",
  3985. FT_BYTES, BASE_NONE, NULL,0x0,
  3986. NULL, HFILL}
  3987. },
  3988. { &hf_gtpv2_container_type,
  3989. {"Container Type","gtpv2.container_type",
  3990. FT_UINT8, BASE_DEC, VALS(gtpv2_container_type_vals),0x0f,
  3991. NULL, HFILL}
  3992. },
  3993. { &hf_gtpv2_cause_type,
  3994. {"Cause Type","gtpv2.cause_type",
  3995. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_cause_type_vals_ext,0x0f,
  3996. NULL, HFILL}
  3997. },
  3998. { &hf_gtpv2_CauseRadioNetwork,
  3999. {"Radio Network Layer Cause","gtpv2.CauseRadioNetwork",
  4000. FT_UINT8, BASE_DEC, VALS(s1ap_CauseRadioNetwork_vals),0x0,
  4001. NULL, HFILL}
  4002. },
  4003. { &hf_gtpv2_CauseTransport,
  4004. {"Transport Layer Cause","gtpv2.CauseTransport",
  4005. FT_UINT8, BASE_DEC, VALS(s1ap_CauseTransport_vals),0x0,
  4006. NULL, HFILL}
  4007. },
  4008. { &hf_gtpv2_CauseNas,
  4009. {"NAS Cause","gtpv2.CauseNas",
  4010. FT_UINT8, BASE_DEC, VALS(s1ap_CauseNas_vals),0x0,
  4011. NULL, HFILL}
  4012. },
  4013. { &hf_gtpv2_CauseMisc,
  4014. {"Miscellaneous Cause","gtpv2.CauseMisc",
  4015. FT_UINT8, BASE_DEC, VALS(s1ap_CauseMisc_vals),0x0,
  4016. NULL, HFILL}
  4017. },
  4018. { &hf_gtpv2_target_type,
  4019. {"Target Type","gtpv2.target_type",
  4020. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtpv2_target_type_vals_ext,0x0,
  4021. NULL, HFILL}
  4022. },
  4023. {&hf_gtpv2_macro_enodeb_id,
  4024. {"Macro eNodeB ID","gtpv2.macro_enodeb_id",
  4025. FT_UINT24, BASE_HEX, NULL,0x0fffff,
  4026. NULL, HFILL}
  4027. },
  4028. { &hf_gtpv2_CauseProtocol,
  4029. {"Protocol Cause","gtpv2.CauseProtocol",
  4030. FT_UINT8, BASE_DEC, VALS(s1ap_CauseProtocol_vals),0x0,
  4031. NULL, HFILL}
  4032. },
  4033. {&hf_gtpv2_apn_rest,
  4034. {"APN Restriction", "gtpv2.apn_rest",
  4035. FT_UINT8, BASE_DEC, NULL, 0x0,
  4036. NULL, HFILL}
  4037. },
  4038. {&hf_gtpv2_selec_mode,
  4039. {"Selection Mode","gtpv2.selec_mode",
  4040. FT_UINT8, BASE_DEC, VALS(gtpv2_selec_mode_vals),0x03,
  4041. NULL, HFILL}
  4042. },
  4043. { &hf_gtpv2_source_type,
  4044. {"Source Type", "gtpv2.source_type",
  4045. FT_UINT8, BASE_DEC, NULL, 0x0,
  4046. NULL, HFILL}
  4047. },
  4048. {&hf_gtpv2_bearer_control_mode,
  4049. {"Bearer Control Mode","gtpv2.bearer_control_mode",
  4050. FT_UINT8, BASE_DEC, VALS(gtpv2_bearer_control_mode_vals),0x0,
  4051. NULL, HFILL}
  4052. },
  4053. { &hf_gtpv2_cng_rep_act,
  4054. {"Change Reporting Action", "gtpv2.cng_rep_act",
  4055. FT_UINT8, BASE_DEC, VALS(gtpv2_cng_rep_act_vals), 0x0,
  4056. NULL, HFILL}
  4057. },
  4058. { &hf_gtpv2_node_type,
  4059. {"Node Type", "gtpv2.node_type",
  4060. FT_UINT8, BASE_DEC, VALS(gtpv2_node_type_vals), 0x0,
  4061. NULL, HFILL}
  4062. },
  4063. {&hf_gtpv2_fqdn,
  4064. {"FQDN", "gtpv2.fqdn",
  4065. FT_STRING, BASE_NONE, NULL, 0x0,
  4066. NULL, HFILL}
  4067. },
  4068. { &hf_gtpv2_enterprise_id,
  4069. {"Enterprise ID", "gtpv2.enterprise_id",
  4070. FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0x0,
  4071. NULL, HFILL}
  4072. },
  4073. { &hf_gtpv2_address_digits,
  4074. { "Address digits", "gtpv2.address_digits",
  4075. FT_STRING, BASE_NONE, NULL, 0,
  4076. NULL, HFILL }
  4077. },
  4078. { &hf_gtpv2_ti,
  4079. {"Transaction Identifier", "gtpv2.ti",
  4080. FT_BYTES, BASE_NONE, NULL, 0x0,
  4081. NULL, HFILL}
  4082. },
  4083. };
  4084. static gint *ett_gtpv2_array[] = {
  4085. &ett_gtpv2,
  4086. &ett_gtpv2_flags,
  4087. &ett_gtpv2_ie,
  4088. &ett_gtpv2_uli_flags,
  4089. &ett_gtpv2_uli_field,
  4090. &ett_gtpv2_bearer_ctx,
  4091. &ett_gtpv2_PDN_conn,
  4092. &ett_gtpv2_mm_context_flag,
  4093. &ett_gtpv2_pdn_numbers_nsapi,
  4094. &ett_gtpv2_tra_info_trigg,
  4095. &ett_gtpv2_tra_info_trigg_msc_server,
  4096. &ett_gtpv2_tra_info_trigg_mgw,
  4097. &ett_gtpv2_tra_info_trigg_sgsn,
  4098. &ett_gtpv2_tra_info_trigg_ggsn,
  4099. &ett_gtpv2_tra_info_trigg_bm_sc,
  4100. &ett_gtpv2_tra_info_trigg_sgw_mme,
  4101. &ett_gtpv2_tra_info_interfaces,
  4102. &ett_gtpv2_tra_info_interfaces_imsc_server,
  4103. &ett_gtpv2_tra_info_interfaces_lmgw,
  4104. &ett_gtpv2_tra_info_interfaces_lsgsn,
  4105. &ett_gtpv2_tra_info_interfaces_lggsn,
  4106. &ett_gtpv2_tra_info_interfaces_lrnc,
  4107. &ett_gtpv2_tra_info_interfaces_lbm_sc,
  4108. &ett_gtpv2_tra_info_interfaces_lmme,
  4109. &ett_gtpv2_tra_info_interfaces_lsgw,
  4110. &ett_gtpv2_tra_info_interfaces_lpdn_gw,
  4111. &ett_gtpv2_tra_info_interfaces_lpdn_lenb,
  4112. &ett_gtpv2_tra_info_ne_types
  4113. };
  4114. proto_gtpv2 = proto_register_protocol("GPRS Tunneling Protocol V2", "GTPv2", "gtpv2");
  4115. proto_register_field_array(proto_gtpv2, hf_gtpv2, array_length(hf_gtpv2));
  4116. proto_register_subtree_array(ett_gtpv2_array, array_length(ett_gtpv2_array));
  4117. /* AVP Code: 22 3GPP-User-Location-Info */
  4118. dissector_add_uint("diameter.3gpp", 22, new_create_dissector_handle(dissect_diameter_3gpp_uli, proto_gtpv2));
  4119. register_dissector("gtpv2", dissect_gtpv2, proto_gtpv2);
  4120. }
  4121. void
  4122. proto_reg_handoff_gtpv2(void)
  4123. {
  4124. nas_eps_handle = find_dissector("nas-eps");
  4125. }