/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
Large files are truncated click here to view the full file
- /* packet-gtpv2.c
- *
- * Routines for GTPv2 dissection
- * Copyright 2009 - 2011, Anders Broman <anders.broman [at] ericcsson.com>
- *
- * $Id: packet-gtpv2.c 38852 2011-09-01 23:27:28Z gerald $
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * Ref: 3GPP TS 29.274 version 8.1.1 Release 8 ETSI TS 129 274 V8.1.1 (2009-04)
- */
- #ifdef HAVE_CONFIG_H
- # include "config.h"
- #endif
- #include <stdlib.h>
- #include <glib.h>
- #include <epan/packet.h>
- #include <epan/asn1.h>
- #include <epan/expert.h>
- #include <epan/sminmpec.h>
- #include "packet-gsm_a_common.h"
- #include "packet-gsm_map.h"
- #include "packet-e164.h"
- #include "packet-e212.h"
- #include "packet-s1ap.h"
- #include "packet-ranap.h"
- static dissector_handle_t nas_eps_handle;
- /*GTPv2 Message->GTP Header(SB)*/
- static int proto_gtpv2 = -1;
- static int hf_gtpv2_reserved = -1;
- static int hf_gtpv2_spare_half_octet = -1;
- static int hf_gtpv2_spare_bits = -1;
- static int hf_gtpv2_flags = -1;
- static int hf_gtpv2_version = -1;
- static int hf_gtpv2_p = -1;
- static int hf_gtpv2_t = -1;
- static int hf_gtpv2_message_type = -1;
- static int hf_gtpv2_msg_length = -1;
- static int hf_gtpv2_teid = -1;
- static int hf_gtpv2_seq = -1;
- static int hf_gtpv2_spare = -1;
- static int hf_gtpv2_ie = -1;
- static int hf_gtpv2_ie_len = -1;
- static int hf_gtpv2_cr = -1;
- static int hf_gtpv2_instance = -1;
- static int hf_gtpv2_cause = -1;
- static int hf_gtpv2_cause_cs = -1;
- static int hf_gtpv2_cause_bce = -1;
- static int hf_gtpv2_cause_pce = -1;
- static int hf_gtpv2_cause_off_ie_t = -1;
- static int hf_gtpv2_rec = -1;
- static int hf_gtpv2_apn = -1;
- static int hf_gtpv2_ebi = -1;
- static int hf_gtpv2_daf = -1;
- static int hf_gtpv2_dtf = -1;
- static int hf_gtpv2_hi = -1;
- static int hf_gtpv2_dfi = -1;
- static int hf_gtpv2_oi = -1;
- static int hf_gtpv2_isrsi = -1;
- static int hf_gtpv2_israi = -1;
- static int hf_gtpv2_sgwci = -1;
- static int hf_gtpv2_sqci = -1;
- static int hf_gtpv2_uimsi = -1;
- static int hf_gtpv2_cfsi = -1;
- static int hf_gtpv2_crsi = -1;
- static int hf_gtpv2_pt = -1;
- static int hf_gtpv2_ps = -1;
- static int hf_gtpv2_si = -1;
- static int hf_gtpv2_msv = -1;
- static int hf_gtpv2_ccrsi = -1;
- static int hf_gtpv2_pdn_type = -1;
- static int hf_gtpv2_pdn_ipv4 = -1;
- static int hf_gtpv2_pdn_ipv6_len = -1;
- static int hf_gtpv2_pdn_ipv6 = -1;
- static int hf_gtpv2_pdn_numbers_nsapi = -1;
- static int hf_gtpv2_p_tmsi = -1;
- static int hf_gtpv2_p_tmsi_sig = -1;
- static int hf_gtpv2_rat_type = -1;
- static int hf_gtpv2_uli_ecgi_flg = -1;
- static int hf_gtpv2_uli_lai_flg = -1;
- static int hf_gtpv2_uli_tai_flg = -1;
- static int hf_gtpv2_uli_rai_flg = -1;
- static int hf_gtpv2_uli_sai_flg = -1;
- static int hf_gtpv2_uli_cgi_flg = -1;
- static int hf_gtpv2_cng_rep_act = -1;
- static int hf_gtpv2_selec_mode = -1;
- static int hf_gtpv2_source_type = -1;
- static int hf_gtpv2_f_teid_v4 = -1;
- static int hf_gtpv2_f_teid_v6 = -1;
- static int hf_gtpv2_f_teid_interface_type= -1;
- static int hf_gtpv2_f_teid_gre_key= -1;
- static int hf_gtpv2_f_teid_ipv4= -1;
- static int hf_gtpv2_f_teid_ipv6= -1;
- static int hf_gtpv2_tmsi = -1;
- static int hf_gtpv2_hsgw_addr_f_len = -1;
- static int hf_gtpv2_hsgw_addr_ipv4 = -1;
- static int hf_gtpv2_hsgw_addr_ipv6 = -1;
- static int hf_gtpv2_gre_key = -1;
- static int hf_gtpv2_sgw_addr_ipv4 = -1;
- static int hf_gtpv2_sgw_addr_ipv6 = -1;
- static int hf_gtpv2_sgw_s1u_teid = -1;
- static int hf_gtpv2_imsi= -1;
- static int hf_gtpv2_ipv4_addr = -1;
- static int hf_gtpv2_ambr_up= -1;
- static int hf_gtpv2_ambr_down= -1;
- static int hf_gtpv2_ip_address_ipv4= -1;
- static int hf_gtpv2_ip_address_ipv6= -1;
- static int hf_gtpv2_mei= -1;
- /* Trace Information */
- static int hf_gtpv2_tra_info = -1;
- static int hf_gtpv2_tra_info_msc_momt_calls = -1;
- static int hf_gtpv2_tra_info_msc_momt_sms = -1;
- static int hf_gtpv2_tra_info_msc_lu_imsi_ad = -1;
- static int hf_gtpv2_tra_info_msc_handovers = -1;
- static int hf_gtpv2_tra_info_msc_ss = -1;
- static int hf_gtpv2_tra_info_mgw_context = -1;
- static int hf_gtpv2_tra_info_sgsn_pdp_context = -1;
- static int hf_gtpv2_tra_info_sgsn_momt_sms = -1;
- static int hf_gtpv2_tra_info_sgsn_rau_gprs_ad = -1;
- static int hf_gtpv2_tra_info_sgsn_mbms = -1;
- static int hf_gtpv2_tra_info_sgsn_reserved = -1;
- static int hf_gtpv2_tra_info_ggsn_pdp = -1;
- static int hf_gtpv2_tra_info_ggsn_mbms = -1;
- static int hf_gtpv2_tra_info_bm_sc = -1;
- static int hf_gtpv2_tra_info_mme_sgw_ss = -1;
- static int hf_gtpv2_tra_info_mme_sgw_sr = -1;
- static int hf_gtpv2_tra_info_mme_sgw_iataud = -1;
- static int hf_gtpv2_tra_info_lne_msc_s = -1;
- static int hf_gtpv2_tra_info_lne_mgw = -1;
- static int hf_gtpv2_tra_info_lne_sgsn = -1;
- static int hf_gtpv2_tra_info_lne_ggsn = -1;
- static int hf_gtpv2_tra_info_lne_rnc = -1;
- static int hf_gtpv2_tra_info_lne_bm_sc = -1;
- static int hf_gtpv2_tra_info_lne_mme = -1;
- static int hf_gtpv2_tra_info_lne_sgw = -1;
- static int hf_gtpv2_tra_info_lne_pdn_gw = -1;
- static int hf_gtpv2_tra_info_lne_enb = -1;
- static int hf_gtpv2_tra_info_tdl = -1;
- static int hf_gtpv2_tra_info_lmsc_a = -1;
- static int hf_gtpv2_tra_info_lmsc_lu = -1;
- static int hf_gtpv2_tra_info_lmsc_mc = -1;
- static int hf_gtpv2_tra_info_lmsc_map_g = -1;
- static int hf_gtpv2_tra_info_lmsc_map_b = -1;
- static int hf_gtpv2_tra_info_lmsc_map_e = -1;
- static int hf_gtpv2_tra_info_lmsc_map_f = -1;
- static int hf_gtpv2_tra_info_lmsc_cap = -1;
- static int hf_gtpv2_tra_info_lmsc_map_d = -1;
- static int hf_gtpv2_tra_info_lmsc_map_c = -1;
- static int hf_gtpv2_tra_info_lmgw_mc = -1;
- static int hf_gtpv2_tra_info_lmgw_nb_up = -1;
- static int hf_gtpv2_tra_info_lmgw_lu_up = -1;
- static int hf_gtpv2_tra_info_lsgsn_gb = -1;
- static int hf_gtpv2_tra_info_lsgsn_lu = -1;
- static int hf_gtpv2_tra_info_lsgsn_gn = -1;
- static int hf_gtpv2_tra_info_lsgsn_map_gr = -1;
- static int hf_gtpv2_tra_info_lsgsn_map_gd = -1;
- static int hf_gtpv2_tra_info_lsgsn_map_gf = -1;
- static int hf_gtpv2_tra_info_lsgsn_gs = -1;
- static int hf_gtpv2_tra_info_lsgsn_ge = -1;
- static int hf_gtpv2_tra_info_lggsn_gn = -1;
- static int hf_gtpv2_tra_info_lggsn_gi = -1;
- static int hf_gtpv2_tra_info_lggsn_gmb = -1;
- static int hf_gtpv2_tra_info_lrnc_lu = -1;
- static int hf_gtpv2_tra_info_lrnc_lur = -1;
- static int hf_gtpv2_tra_info_lrnc_lub = -1;
- static int hf_gtpv2_tra_info_lrnc_uu = -1;
- static int hf_gtpv2_tra_info_lbm_sc_gmb = -1;
- static int hf_gtpv2_tra_info_lmme_s1_mme = -1;
- static int hf_gtpv2_tra_info_lmme_s3 = -1;
- static int hf_gtpv2_tra_info_lmme_s6a = -1;
- static int hf_gtpv2_tra_info_lmme_s10 = -1;
- static int hf_gtpv2_tra_info_lmme_s11 = -1;
- static int hf_gtpv2_tra_info_lsgw_s4 = -1;
- static int hf_gtpv2_tra_info_lsgw_s5 = -1;
- static int hf_gtpv2_tra_info_lsgw_s8b = -1;
- static int hf_gtpv2_tra_info_lsgw_s11 = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_s2a = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_s2b = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_s2c = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_s5 = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_s6c = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_gx = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_s8b = -1;
- static int hf_gtpv2_tra_info_lpdn_gw_sgi = -1;
- static int hf_gtpv2_tra_info_lenb_s1_mme = -1;
- static int hf_gtpv2_tra_info_lenb_x2 = -1;
- static int hf_gtpv2_tra_info_lenb_uu = -1;
- static int hf_gtpv2_address_digits = -1;
- static int hf_gtpv2_ti = -1;
- static int hf_gtpv2_bearer_qos_pvi= -1;
- static int hf_gtpv2_bearer_qos_pl= -1;
- static int hf_gtpv2_bearer_qos_pci= -1;
- static int hf_gtpv2_bearer_qos_label_qci = -1;
- static int hf_gtpv2_bearer_qos_mbr_up = -1;
- static int hf_gtpv2_bearer_qos_mbr_down = -1;
- static int hf_gtpv2_bearer_qos_gbr_up = -1;
- static int hf_gtpv2_bearer_qos_gbr_down = -1;
- static int hf_gtpv2_flow_qos_label_qci = -1;
- static int hf_gtpv2_flow_qos_mbr_up = -1;
- static int hf_gtpv2_flow_qos_mbr_down = -1;
- static int hf_gtpv2_flow_qos_gbr_up = -1;
- static int hf_gtpv2_flow_qos_gbr_down = -1;
- static int hf_gtpv2_delay_value = -1;
- static int hf_gtpv2_charging_id = -1;
- static int hf_gtpv2_charging_characteristic = -1;
- static int hf_gtpv2_bearer_flag_ppc = -1;
- static int hf_gtpv2_bearer_flag_vb = -1;
- static int hf_gtpv2_ue_time_zone_dst = -1;
- static int hf_gtpv2_fq_csid_type = -1;
- static int hf_gtpv2_fq_csid_nr = -1;
- static int hf_gtpv2_fq_csid_ipv4 = -1;
- static int hf_gtpv2_fq_csid_ipv6 = -1;
- static int hf_gtpv2_fq_csid_id = -1;
- static int hf_gtpv2_complete_req_msg_type = -1;
- static int hf_gtpv2_mme_grp_id = -1;
- static int hf_gtpv2_mme_code = -1;
- static int hf_gtpv2_m_tmsi = -1;
- static int hf_gtpv2_container_type = -1;
- static int hf_gtpv2_cause_type = -1;
- static int hf_gtpv2_CauseRadioNetwork = -1;
- static int hf_gtpv2_CauseTransport = -1;
- static int hf_gtpv2_CauseNas = -1;
- static int hf_gtpv2_CauseProtocol = -1;
- static int hf_gtpv2_CauseMisc = -1;
- static int hf_gtpv2_target_type = -1;
- static int hf_gtpv2_macro_enodeb_id = -1;
- static int hf_gtpv2_node_type= -1;
- static int hf_gtpv2_fqdn = -1;
- static int hf_gtpv2_enterprise_id = -1;
- static int hf_gtpv2_apn_rest= -1;
- static int hf_gtpv2_pti= -1;
- static int hf_gtpv2_mm_context_sm = -1;
- static int hf_gtpv2_mm_context_nhi = -1;
- static int hf_gtpv2_mm_context_drxi = -1;
- static int hf_gtpv2_mm_context_cksn = -1;
- static int hf_gtpv2_mm_context_cksn_ksi = -1;
- static int hf_gtpv2_mm_context_ksi_a= -1;
- static int hf_gtpv2_mm_context_ksi = -1;
- static int hf_gtpv2_mm_context_nr_tri = -1;
- static int hf_gtpv2_mm_context_nr_qui = -1;
- static int hf_gtpv2_mm_context_nr_qua = -1;
- static int hf_gtpv2_mm_context_unipa = -1;
- static int hf_gtpv2_mm_context_unc = -1;
- static int hf_gtpv2_mm_context_nas_dl_cnt = -1;
- static int hf_gtpv2_mm_context_nas_ul_cnt = -1;
- static int hf_gtpv2_uli_cgi_lac= -1;
- static int hf_gtpv2_uli_cgi_ci= -1;
- static int hf_gtpv2_uli_sai_lac= -1;
- static int hf_gtpv2_uli_sai_sac= -1;
- static int hf_gtpv2_uli_rai_lac= -1;
- static int hf_gtpv2_uli_rai_rac= -1;
- static int hf_gtpv2_uli_tai_tac= -1;
- static int hf_gtpv2_uli_ecgi_eci= -1;
- static int hf_gtpv2_uli_lai_lac = -1;
- static int hf_gtpv2_uli_ecgi_eci_spare= -1;
- static int hf_gtpv2_nsapi = -1;
- static int hf_gtpv2_bearer_control_mode= -1;
- static gint ett_gtpv2 = -1;
- static gint ett_gtpv2_flags = -1;
- static gint ett_gtpv2_ie = -1;
- static gint ett_gtpv2_uli_flags = -1;
- static gint ett_gtpv2_uli_field = -1;
- static gint ett_gtpv2_bearer_ctx = -1;
- static gint ett_gtpv2_PDN_conn = -1;
- static gint ett_gtpv2_mm_context_flag = -1;
- static gint ett_gtpv2_pdn_numbers_nsapi = -1;
- static gint ett_gtpv2_tra_info_trigg = -1;
- static gint ett_gtpv2_tra_info_trigg_msc_server = -1;
- static gint ett_gtpv2_tra_info_trigg_mgw = -1;
- static gint ett_gtpv2_tra_info_trigg_sgsn = -1;
- static gint ett_gtpv2_tra_info_trigg_ggsn = -1;
- static gint ett_gtpv2_tra_info_trigg_bm_sc = -1;
- static gint ett_gtpv2_tra_info_trigg_sgw_mme = -1;
- static gint ett_gtpv2_tra_info_interfaces = -1;
- static gint ett_gtpv2_tra_info_interfaces_imsc_server = -1;
- static gint ett_gtpv2_tra_info_interfaces_lmgw = -1;
- static gint ett_gtpv2_tra_info_interfaces_lsgsn = -1;
- static gint ett_gtpv2_tra_info_interfaces_lggsn = -1;
- static gint ett_gtpv2_tra_info_interfaces_lrnc = -1;
- static gint ett_gtpv2_tra_info_interfaces_lbm_sc = -1;
- static gint ett_gtpv2_tra_info_interfaces_lmme = -1;
- static gint ett_gtpv2_tra_info_interfaces_lsgw = -1;
- static gint ett_gtpv2_tra_info_interfaces_lpdn_gw = -1;
- static gint ett_gtpv2_tra_info_interfaces_lpdn_lenb = -1;
- static gint ett_gtpv2_tra_info_ne_types = -1;
- /* Definition of User Location Info (AVP 22) masks */
- #define GTPv2_ULI_CGI_MASK 0x01
- #define GTPv2_ULI_SAI_MASK 0x02
- #define GTPv2_ULI_RAI_MASK 0x04
- #define GTPv2_ULI_TAI_MASK 0x08
- #define GTPv2_ULI_ECGI_MASK 0x10
- #define GTPv2_ULI_LAI_MASK 0x20
- #define GTPV2_CREATE_SESSION_REQUEST 32
- #define GTPV2_CREATE_SESSION_RESPONSE 33
- #define GTPV2_FORWARD_RELOCATION_REQ 133
- #define GTPV2_FORWARD_CTX_NOTIFICATION 137
- static void dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, gint offset, guint8 message_type);
- /*Message Types for GTPv2 (Refer Pg19 29.274) (SB)*/
- static const value_string gtpv2_message_type_vals[] = {
- {0, "Reserved"},
- {1, "Echo Request"},
- {2, "Echo Response"},
- {3, "Version Not Supported Indication"},
- /* 4-24 Reserved for S101 interface TS 29.276 */
- /* 25-31 Reserved for Sv interface TS 29.280 */
- /* SGSN/MME to PGW (S4/S11, S5/S8) */
- {32, "Create Session Request"},
- {33, "Create Session Response"},
- {34, "Modify Bearer Request"},
- {35, "Modify Bearer Response"},
- {36, "Delete Session Request"},
- {37, "Delete Session Response"},
- /* SGSN to PGW (S4, S5/S8) */
- {38, "Change Notification Request"},
- {39, "Change Notification Response"},
- /* 40-63 For future use */
- /* Messages without explicit response */
- {64, "Modify Bearer Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */
- {65, "Modify Bearer Failure Indication"}, /*(PGW to MME/SGSN -S5/S8, S11/S4) */
- {66, "Delete Bearer Command"}, /* (MME to PGW -S11, S5/S8) */
- {67, "Delete Bearer Failure Indication"}, /* (PGW to MME -S5/S8, S11) */
- {68, "Bearer Resource Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */
- {69, "Bearer Resource Failure Indication"}, /* (PGW to MME/SGSN -S5/S8, S11/S4) */
- {70, "Downlink Data Notification Failure Indication"}, /*(SGSN/MME to SGW -S4/S11) */
- {71, "Trace Session Activation"},
- {72, "Trace Session Deactivation"},
- {73, "Stop Paging Indication"},
- /* 74-94 For future use */
- /* PDN-GW to SGSN/MME (S5/S8, S4/S11) */
- {95, "Create Bearer Request"},
- {96, "Create Bearer Response"},
- {97, "Update Bearer Request"},
- {98, "Update Bearer Response"},
- {99, "Delete Bearer Request"},
- {100, "Delete Bearer Response"},
- /* PGW to MME, MME to PGW, SGW to PGW, SGW to MME (S5/S8, S11) */
- {101, "Delete PDN Connection Set Request"},
- {102, "Delete PDN Connection Set Response"},
- /* 103-127 For future use */
- /* MME to MME, SGSN to MME, MME to SGSN, SGSN to SGSN (S3/10/S16) */
- {128, "Identification Request"},
- {129, "Identification Response"},
- {130, "Context Request"},
- {131, "Context Response"},
- {132, "Context Acknowledge"},
- {133, "Forward Relocation Request"},
- {134, "Forward Relocation Response"},
- {135, "Forward Relocation Complete Notification"},
- {136, "Forward Relocation Complete Acknowledge"},
- {137, "Forward Access Context Notification"},
- {138, "Forward Access Context Acknowledge"},
- {139, "Relocation Cancel Request"},
- {140, "Relocation Cancel Response"},
- {141, "Configuration Transfer Tunnel"},
- /* 142-148 For future use */
- /* SGSN to MME, MME to SGSN (S3)*/
- {149, "Detach Notification"},
- {150, "Detach Acknowledge"},
- {151, "CS Paging Indication"},
- {152, "RAN Information Relay"},
- {153, "Alert MME Notification"},
- {154, "Alert MME Acknowledge"},
- {155, "UE Activity Notification"},
- {156, "UE Activity Acknowledge"},
- /* 157 to 159 For future use */
- /* MME to SGW (S11) */
- {160, "Create Forwarding Tunnel Request"},
- {161, "Create Forwarding Tunnel Response"},
- {162, "Suspend Notification"},
- {163, "Suspend Acknowledge"},
- {164, "Resume Notification"},
- {165, "Resume Acknowledge"},
- {166, "Create Indirect Data Forwarding Tunnel Request"},
- {167, "Create Indirect Data Forwarding Tunnel Response"},
- {168, "Delete Indirect Data Forwarding Tunnel Request"},
- {169, "Delete Indirect Data Forwarding Tunnel Response"},
- {170, "Release Access Bearers Request"},
- {171, "Release Access Bearers Response"},
- /* 172-175 For future use */
- /* SGW to SGSN/MME (S4/S11) */
- {176, "Downlink Data Notification"},
- {177, "Downlink Data Notification Acknowledgement"},
- /* SGW to SGSN (S4) */
- {178, "Update Bearer Complete"},
- /* 179-191 For future use */
- /* Other */
- {200, "Update PDN Connection Set Request"},
- {201, "Update PDN Connection Set Response"},
- /* 202 to 230 For future use */
- /* MBMS GW to MME/SGSN (Sm/Sn) */
- {231, "MBMS Session Start Request"},
- {323, "MBMS Session Start Response"},
- {233, "MBMS Session Update Request"},
- {234, "MBMS Session Update Response"},
- {235, "MBMS Session Stop Request"},
- {236, "MBMS Session Stop Response"},
- /* 237 to 239 For future use */
- /* 240-255 Reserved for GTP-U TS 29.281 [13] */
- {0, NULL}
- };
- #define GTPV2_IE_RESERVED 0
- #define GTPV2_IE_IMSI 1
- #define GTPV2_IE_CAUSE 2
- #define GTPV2_REC_REST_CNT 3
- #define GTPV2_APN 71
- #define GTPV2_AMBR 72
- #define GTPV2_EBI 73
- #define GTPV2_IP_ADDRESS 74
- #define GTPV2_MEI 75
- #define GTPV2_IE_MSISDN 76
- #define GTPV2_INDICATION 77
- #define GTPV2_PCO 78
- #define GTPV2_PAA 79
- #define GTPV2_BEARER_QOS 80
- #define GTPV2_IE_FLOW_QOS 81
- #define GTPV2_IE_RAT_TYPE 82
- #define GTPV2_IE_SERV_NET 83
- #define GTPV2_IE_BEARER_TFT 84
- #define GTPV2_IE_TAD 85
- #define GTPV2_IE_ULI 86
- #define GTPV2_IE_F_TEID 87
- #define GTPV2_IE_TMSI 88
- #define GTPV2_IE_GLOBAL_CNID 89
- #define GTPV2_IE_S103PDF 90
- #define GTPV2_IE_S1UDF 91
- #define GTPV2_IE_DEL_VAL 92
- #define GTPV2_IE_BEARER_CTX 93
- #define GTPV2_IE_CHAR_ID 94
- #define GTPV2_IE_CHAR_CHAR 95
- #define GTPV2_IE_TRA_INFO 96
- #define GTPV2_BEARER_FLAG 97
- /* define GTPV2_IE_PAGING_CAUSE 98 (void) */
- #define GTPV2_IE_PDN_TYPE 99
- #define GTPV2_IE_PTI 100
- #define GTPV2_IE_DRX_PARAM 101
- #define GTPV2_IE_UE_NET_CAPABILITY 102
- #define GTPV2_IE_MM_CONTEXT_GSM_T 103
- #define GTPV2_IE_MM_CONTEXT_UTMS_CQ 104
- #define GTPV2_IE_MM_CONTEXT_GSM_CQ 105
- #define GTPV2_IE_MM_CONTEXT_UTMS_Q 106
- #define GTPV2_IE_MM_CONTEXT_EPS_QQ 107
- #define GTPV2_IE_MM_CONTEXT_UTMS_QQ 108
- #define GTPV2_IE_PDN_CONNECTION 109
- #define GTPV2_IE_PDN_NUMBERS 110
- #define GTPV2_IE_P_TMSI 111
- #define GTPV2_IE_P_TMSI_SIG 112
- #define GTPV2_IE_HOP_COUNTER 113
- #define GTPV2_IE_UE_TIME_ZONE 114
- #define GTPV2_IE_TRACE_REFERENCE 115
- #define GTPV2_IE_COMPLETE_REQUEST_MSG 116
- #define GTPV2_IE_GUTI 117
- #define GTPV2_IE_F_CONTAINER 118
- #define GTPV2_IE_F_CAUSE 119
- #define GTPV2_IE_SEL_PLMN_ID 120
- #define GTPV2_IE_TARGET_ID 121
- /* GTPV2_IE_NSAPI 122 */
- #define GTPV2_IE_PKT_FLOW_ID 123
- #define GTPV2_IE_RAB_CONTEXT 124
- #define GTPV2_IE_S_RNC_PDCP_CTX_INFO 125
- #define GTPV2_IE_UDP_S_PORT_NR 126
- #define GTPV2_IE_APN_RESTRICTION 127
- #define GTPV2_IE_SEL_MODE 128
- #define GTPV2_IE_SOURCE_IDENT 129
- #define GTPV2_IE_BEARER_CONTROL_MODE 130
- #define GTPV2_IE_CNG_REP_ACT 131
- #define GTPV2_IE_FQ_CSID 132
- #define GTPV2_IE_CHANNEL_NEEDED 133
- #define GTPV2_IE_EMLPP_PRI 134
- #define GTPV2_IE_NODE_TYPE 135
- #define GTPV2_IE_FQDN 136
- #define GTPV2_IE_TI 137
- #define GTPV2_IE_PRIVATE_EXT 255
- #define SPARE 0X0
- #define CREATE_NEW_TFT 0X20
- #define DELETE_TFT 0X40
- #define ADD_PACKET_FILTERS_TFT 0X60
- #define REPLACE_PACKET_FILTERS_TFT 0X80
- #define DELETE_PACKET_FILTERS_TFT 0XA0
- #define NO_TFT_OPERATION 0XC0
- #define RESERVED 0XE0
- /* Table 8.1-1: Information Element types for GTPv2 */
- static const value_string gtpv2_element_type_vals[] = {
- {0, "Reserved"},
- {1, "International Mobile Subscriber Identity (IMSI)"}, /* Variable Length / 8.3 */
- {2, "Cause"}, /* Variable Length / 8.4 */
- {3, "Recovery (Restart Counter)"}, /* Variable Length / 8.5 */
- /* 4-50 Reserved for S101 interface Extendable / See 3GPP TS 29.276 [14] */
- /* 51-70 Reserved for Sv interface Extendable / See 3GPP TS 29.280 [15] */
- {71, "Access Point Name (APN)"}, /* Variable Length / 8.6 */
- {72, "Aggregate Maximum Bit Rate (AMBR)"}, /* Fixed Length / 8.7 */
- {73, "EPS Bearer ID (EBI)"}, /* Extendable / 8.8 */
- {74, "IP Address"}, /* Extendable / 8.9 */
- {75, "Mobile Equipment Identity (MEI)"}, /* Variable Length / 8.10 */
- {76, "MSISDN"}, /* Variable Length / 8.11 */
- {77, "Indication"}, /* Extendable / 8.12 */
- {78, "Protocol Configuration Options (PCO)"}, /* Variable Length / 8.13 */
- {79, "PDN Address Allocation (PAA)"}, /* Variable Length / 8.14 */
- {80, "Bearer Level Quality of Service (Bearer QoS)"}, /* Variable Length / 8.15 */
- {81, "Flow Quality of Service (Flow QoS)"}, /* Extendable / 8.16 */
- {82, "RAT Type"}, /* Extendable / 8.17 */
- {83, "Serving Network"}, /* Extendable / 8.18 */
- {84, "EPS Bearer Level Traffic Flow Template (Bearer TFT)"}, /* Variable Length / 8.19 */
- {85, "Traffic Aggregation Description (TAD)"}, /* Variable Length / 8.20 */
- {86, "User Location Info (ULI)"}, /* Variable Length / 8.21 */
- {87, "Fully Qualified Tunnel Endpoint Identifier (F-TEID)"}, /* Extendable / 8.22 */
- {88, "TMSI"}, /* Variable Length / 8.23 */
- {89, "Global CN-Id"}, /* Variable Length / 8.24 */
- {90, "S103 PDN Data Forwarding Info (S103PDF)"}, /* Variable Length / 8.25 */
- {91, "S1-U Data Forwarding Info (S1UDF)"}, /* Variable Length/ 8.26 */
- {92, "Delay Value"}, /* Extendable / 8.27 */
- {93, "Bearer Context"}, /* Extendable / 8.28 */
- {94, "Charging ID"}, /* Extendable / 8.29 */
- {95, "Charging Characteristics"}, /* Extendable / 8.30 */
- {96, "Trace Information"}, /* Extendable / 8.31 */
- {97, "Bearer Flags"}, /* Extendable / 8.32 */
- {98, "Paging Cause"}, /* Variable Length / 8.33 */
- {99, "PDN Type"}, /* Extendable / 8.34 */
- {100, "Procedure Transaction ID"}, /* Extendable / 8.35 */
- {101, "DRX Parameter"}, /* Variable Length/ 8.36 */
- {102, "UE Network Capability"}, /* Variable Length / 8.37 */
- {103, "MM Context (GSM Key and Triplets)"}, /* Variable Length / 8.38 */
- {104, "MM Context (UMTS Key, Used Cipher and Quintuplets)"}, /* Variable Length / 8.38 */
- {105, "MM Context (GSM Key, Used Cipher and Quintuplets)"}, /* Variable Length / 8.38 */
- {106, "MM Context (UMTS Key and Quintuplets)"}, /* Variable Length / 8.38 */
- {107, "MM Context (EPS Security Context, Quadruplets and Quintuplets)"}, /* Variable Length / 8.38 */
- {108, "MM Context (UMTS Key, Quadruplets and Quintuplets)"}, /* Variable Length / 8.38 */
- {109, "PDN Connection"}, /* Extendable / 8.39 */
- {110, "PDU Numbers"}, /* Extendable / 8.40 */
- {111, "P-TMSI"}, /* Variable Length / 8.41 */
- {112, "P-TMSI Signature"}, /* Variable Length / 8.42 */
- {113, "Hop Counter"}, /* Extendable / 8.43 */
- {114, "UE Time Zone"}, /* Variable Length / 8.44 */
- {115, "Trace Reference"}, /* Fixed Length / 8.45 */
- {116, "Complete Request Message"}, /* Variable Length / 8.46 */
- {117, "GUTI"}, /* Variable Length / 8.47 */
- {118, "F-Container"}, /* Variable Length / 8.48 */
- {119, "F-Cause"}, /* Variable Length / 8.49 */
- {120, "Selected PLMN ID"}, /* Variable Length / 8.50 */
- {121, "Target Identification"}, /* Variable Length / 8.51 */
- {122, "NSAPI"}, /* Extendable / 8.52 */
- {123, "Packet Flow ID"}, /* Variable Length / 8.53 */
- {124, "RAB Context"}, /* Fixed Length / 8.54 */
- {125, "Source RNC PDCP Context Info"}, /* Variable Length / 8.55 */
- {126, "UDP Source Port Number"}, /* Extendable / 8.56 */
- {127, "APN Restriction"}, /* Extendable / 8.57 */
- {128, "Selection Mode"}, /* Extendable / 8.58 */
- {129, "Source Identification"}, /* Variable Length / 8.50 */
- {130, "Bearer Control Mode"}, /* Extendable / 8.60 */
- {131, "Change Reporting Action"}, /* Variable Length / 8.61 */
- {132, "Fully Qualified PDN Connection Set Identifier (FQ-CSID)"}, /* Variable Length / 8.62 */
- {133, "Channel needed"}, /* Extendable / 8.63 */
- {134, "eMLPP Priority"}, /* Extendable / 8.64 */
- {135, "Node Type"}, /* Extendable / 8.65 */
- {136, "Fully Qualified Domain Name (FQDN)"}, /* Variable Length / 8.66 */
- {137, "Transaction Identifier (TI)"}, /* Variable Length / 8.68 */
- {138, "MBMS Session"}, /* Duration Extendable / 8.69 */
- {139, "MBMS Service Area"}, /* Extendable / 8.70 */
- {140, "MBMS Session Identifier"}, /* Extendable / 8.71 */
- {141, "MBMS Flow Identifier"}, /* Extendable / 8.72 */
- {142, "MBMS IP Multicast Distribution"}, /* Extendable / 8.73 */
- {143, "MBMS Distribution Acknowledge"}, /* Extendable / 8.74 */
- {144, "RFSP Index"}, /* Fixed Length / 8.77 */
- {145, "User CSG Information (UCI)"}, /* Extendable / 8.75 */
- {146, "CSG Information Reporting Action"}, /* Extendable / 8.76 */
- {147, "CSG ID"}, /* Extendable / 8.78 */
- {148, "CSG Membership Indication (CMI)"}, /* Extendable / 8.79 */
- {149, "Service indicator"}, /* Fixed Length / 8.80 */
- {150, "Detach Type"}, /* Fixed Length / 8.81 */
- {151, "Local Distiguished Name (LDN)"}, /* Variable / 8.82 */
- {152, "Node Features"}, /* Extendable / 8.83 */
- {153, "MBMS Time to Data Transfer"}, /* Extendable / 8.84 */
- {154, "Throttling"}, /* Extendable / 8.85 */
- {155, "Allocation/Retention Priority (ARP)"}, /* Extendable / 8.86 */
- /* 156 to 254 Spare. For future use. */ /* For future use. FFS */
- {255, "Private"}, /* Extension Extendable / 8.67 */
- {0, NULL}
- };
- /* Code to dissect IE's */
- static void
- 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_)
- {
- proto_item *expert_item;
- expert_item = proto_tree_add_text(tree, tvb, 0, length, "IE data not dissected yet");
- expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_NOTE, "IE data not dissected yet");
- PROTO_ITEM_SET_GENERATED(expert_item);
- }
- /*
- * 8.3 International Mobile Subscriber Identity (IMSI)
- *
- * IMSI is defined in 3GPP TS 23.003
- * Editor's note: IMSI coding will be defined in 3GPP TS 24.301
- * Editor's note: In the first release of GTPv2 spec (TS 29.274v8.0.0) n = 8.
- * That is, the overall length of the IE is 11 octets.
- */
- static void
- 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_)
- {
- int offset= 0;
- const gchar *imsi_str;
- /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
- * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
- * allocated string will be returned.
- */
- imsi_str = tvb_bcd_dig_to_ep_str( tvb, offset, length, NULL, FALSE);
- proto_tree_add_string(tree, hf_gtpv2_imsi, tvb, offset, length, imsi_str);
- proto_item_append_text(item, "%s", imsi_str);
- }
- /*
- * 8.4 Cause
- */
- /* Table 8.4-1: Cause values */
- static const value_string gtpv2_cause_vals[] = {
- {0, "Reserved"},
- /* Request */
- {1, "Paging Cause"},
- {2, "Local Detach"},
- {3, "Complete Detach"},
- {4, "RAT changed from 3GPP to Non-3GPP"},
- {5, "ISR is activated"},
- {6, "Error Indication received from RNC/eNodeB"},
- {7, "IMSI Detach Only"},
- {8, "Reactivation Requested"},
- {9, "PDN reconnection to this APN disallowed"},
- {10, "Access changed from Non-3GPP to 3GPP"},
- /* 11-15 Spare. This value range is reserved for Cause values in a request message */
- {11, "Spare"},
- {12, "Spare"},
- {13, "Spare"},
- {14, "Spare"},
- {15, "Spare"},
- /* Acceptance Response */
- {16, "Request accepted"},
- {17, "Request accepted partially"},
- {18, "New PDN type due to network preference"},
- {19, "New PDN type due to single address bearer only"},
- /* 20-63 Spare. This value range is reserved for Cause values in acceptance response message */
- /* Rejection Response */
- {20, "Spare"},
- {21, "Spare"},
- {22, "Spare"},
- {23, "Spare"},
- {24, "Spare"},
- {25, "Spare"},
- {26, "Spare"},
- {27, "Spare"},
- {28, "Spare"},
- {29, "Spare"},
- {30, "Spare"},
- {31, "Spare"},
- {32, "Spare"},
- {33, "Spare"},
- {34, "Spare"},
- {35, "Spare"},
- {36, "Spare"},
- {37, "Spare"},
- {38, "Spare"},
- {39, "Spare"},
- {40, "Spare"},
- {41, "Spare"},
- {42, "Spare"},
- {43, "Spare"},
- {44, "Spare"},
- {45, "Spare"},
- {46, "Spare"},
- {47, "Spare"},
- {48, "Spare"},
- {49, "Spare"},
- {50, "Spare"},
- {51, "Spare"},
- {52, "Spare"},
- {53, "Spare"},
- {54, "Spare"},
- {55, "Spare"},
- {56, "Spare"},
- {57, "Spare"},
- {58, "Spare"},
- {59, "Spare"},
- {60, "Spare"},
- {61, "Spare"},
- {62, "Spare"},
- {63, "Spare"},
- {64, "Context Not Found"},
- {65, "Invalid Message Format"},
- {66, "Version not supported by next peer"},
- {67, "Invalid length"},
- {68, "Service not supported"},
- {69, "Mandatory IE incorrect"},
- {70, "Mandatory IE missing"},
- {71, "Optional IE incorrect"},
- {72, "System failure"},
- {73, "No resources available"},
- {74, "Semantic error in the TFT operation"},
- {75, "Syntactic error in the TFT operation"},
- {76, "Semantic errors in packet filter(s)"},
- {77, "Syntactic errors in packet filter(s)"},
- {78, "Missing or unknown APN"},
- {79, "Unexpected repeated IE"},
- {80, "GRE key not found"},
- {81, "Reallocation failure"},
- {82, "Denied in RAT"},
- {83, "Preferred PDN type not supported"},
- {84, "All dynamic addresses are occupied"},
- {85, "UE context without TFT already activated"},
- {86, "Protocol type not supported"},
- {87, "UE not responding"},
- {88, "UE refuses"},
- {89, "Service denied"},
- {90, "Unable to page UE"},
- {91, "No memory available"},
- {92, "User authentication failed"},
- {93, "APN access denied - no subscription"},
- {94, "Request rejected"},
- {95, "P-TMSI Signature mismatch"},
- {96, "IMSI not known"},
- {97, "Semantic error in the TAD operation"},
- {98, "Syntactic error in the TAD operation"},
- {99, "Reserved Message Value Received"},
- {100, "PGW not responding"},
- {101, "Collision with network initiated request"},
- {102, "Unable to page UE due to Suspension"},
- {103, "Conditional IE missing"},
- {104, "APN Restriction type Incompatible with currently active PDN connection"},
- {105, "Invalid overall length of the triggered response message and a piggybacked initial message"},
- {106, "Data forwarding not supported"},
- {107, "Invalid reply from remote peer"},
- {108, "Fallback to GTPv1"},
- {109, "Invalid peer"},
- {110, "Temporarily rejected due to handover procedure in progress"},
- {111, "Modifications not limited to S1-U bearers"},
- {112, "Request rejected for a PMIPv6 reason "},
- /* 113-239 Spare. For future use in a triggered/response message */
- /* 240-255 Spare. For future use in an initial/request message */
- {0, NULL}
- };
- static value_string_ext gtpv2_cause_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_cause_vals);
- /* Table 8.4-1: CS (Cause Source) */
- static const true_false_string gtpv2_cause_cs = {
- "Originated by remote node",
- "Originated by node sending the message",
- };
- static void
- 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_)
- {
- int offset = 0;
- guint8 tmp;
- /* Cause value octet 5 */
- tmp = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(tree, hf_gtpv2_cause, tvb, offset, 1, FALSE);
- /* Add Cause to ie_tree */
- proto_item_append_text(item, "%s (%u)", val_to_str_ext_const(tmp, >pv2_cause_vals_ext, "Unknown"),tmp);
- offset++;
- /* Octet 6 Spare PCE BCE CS */
- proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_cause_pce, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_cause_bce, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_cause_cs, tvb, offset, 1, FALSE);
- offset++;
- /* If n = 2, a = 0 and the Cause IE shall be 6 octets long.
- * Therefore, octets "a(n+1) to a(n+4)" will not be present.
- * If n = 6, a = 1 and the Cause IE will be 10 octets long.
- */
- if ( length == 2 ) {
- return;
- }
- /*
- * If the rejection is due to a mandatory IE or a verifiable conditional IE is faulty
- * or missing, the offending IE shall be included within an additional field "a(n+1)
- * to a(n+4)". Only Type and Instance fields of the offending IE that caused the
- * rejection have a meaning. The length in the Octet 8-9 and spare bits in the Octet 10
- * shall be set to "0". In this case, the value of "n" shall be "6".
- * Otherwise, the value of "n" is equal to "2".
- */
- /* Type of the offending IE */
- proto_tree_add_item(tree, hf_gtpv2_cause_off_ie_t, tvb, offset, 1, FALSE);
- offset++;
- /* Length */
- proto_tree_add_item(tree, hf_gtpv2_ie_len, tvb, offset, 2, FALSE);
- offset+=2;
- /* a(n+4) Spare Instance */
- proto_tree_add_bits_item(tree, hf_gtpv2_spare_half_octet, tvb, offset>>3, 4, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_instance, tvb, offset, 1, FALSE);
- offset++;
- }
- /*
- * 8.5 Recovery (Restart Counter)
- */
- static void
- 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_)
- {
- int offset = 0;
- guint8 recovery;
- recovery = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(tree, hf_gtpv2_rec, tvb, offset, 1, FALSE);
- proto_item_append_text(item, "%u", recovery);
- }
- /*
- * 8.6 Access Point Name (APN)
- * The encoding the APN field follows 3GPP TS 23.003 [2] subclause 9.1.
- * The content of the APN field shall be the full APN with both the APN Network Identifier
- * and APN Operator Identifier being present as specified in 3GPP TS 23.003 [2]
- * 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.
- */
- static void
- 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_)
- {
- int offset = 0;
- guint8 *apn = NULL;
- int name_len, tmp;
- if (length > 0) {
- name_len = tvb_get_guint8(tvb, offset);
- if (name_len < 0x20) {
- apn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
- for (;;) {
- if (name_len >= length - 1)
- break;
- tmp = name_len;
- name_len = name_len + apn[tmp] + 1;
- apn[tmp] = '.';
- }
- } else{
- apn = tvb_get_ephemeral_string(tvb, offset, length);
- }
- proto_tree_add_string(tree, hf_gtpv2_apn, tvb, offset, length, apn);
- }
- if (apn)
- proto_item_append_text(item, "%s", apn);
- }
- /*
- * 8.7 Aggregate Maximum Bit Rate (AMBR)
- */
- static void
- 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_)
- {
- int offset = 0;
- proto_tree_add_item(tree, hf_gtpv2_ambr_up, tvb, offset, 4, FALSE);
- offset= offset + 4;
- proto_tree_add_item(tree, hf_gtpv2_ambr_down, tvb, offset, 4, FALSE);
- }
- /*
- * 8.8 EPS Bearer ID (EBI)
- */
- static void
- 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_)
- {
- int offset = 0;
- guint8 ebi;
- /* Spare (all bits set to 0) B8 - B5*/
- proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset, 4, FALSE);
- /* EPS Bearer ID (EBI) B4 - B1 */
- ebi = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(tree, hf_gtpv2_ebi, tvb, offset, 1, FALSE);
- proto_item_append_text(item, "%u", ebi);
- }
- /*
- * 8.9 IP Address
- */
- static void
- 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_)
- {
- int offset = 0;
- struct e_in6_addr ipv6_addr;
- if (length==4)
- {
- proto_tree_add_item(tree, hf_gtpv2_ip_address_ipv4, tvb, offset, length, FALSE);
- proto_item_append_text(item, "IPv4 %s", tvb_ip_to_str(tvb, offset));
- }
- else if (length==16)
- {
- proto_tree_add_item(tree, hf_gtpv2_ip_address_ipv6, tvb, offset, length, FALSE);
- tvb_get_ipv6(tvb, offset, &ipv6_addr);
- proto_item_append_text(item, "IPv6 %s", ip6_to_str(&ipv6_addr));
- }
- }
- /*
- * 8.10 Mobile Equipment Identity (MEI)
- * The ME Identity field contains either the IMEI or the IMEISV
- * as defined in clause 6.2 of 3GPP TS 23.003 [2]. It is encoded
- * as specified in clause 7.7.53 of 3GPP TS 29.060 [4], beginning
- * with octet 4 of Figure 7.7.53.1. The IMEI(SV) digits are encoded
- * using BCD coding where IMEI is 15 BCD digits and IMEISV is 16 BCD
- * digits. For IMEI, bits 5 to 8 of the last octet shall be filled
- * with an end mark coded as '1111'.
- */
- static void
- 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_)
- {
- int offset= 0;
- const gchar *mei_str;
- /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
- * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
- * allocated string will be returned.
- */
- mei_str = tvb_bcd_dig_to_ep_str( tvb, 0, length, NULL, FALSE);
- proto_tree_add_string(tree, hf_gtpv2_mei, tvb, offset, length, mei_str);
- proto_item_append_text(item, "%s", mei_str);
- }
- /*
- * 8.11 MSISDN
- *
- * MSISDN is defined in 3GPP TS 23.003
- * Editor's note: MSISDN coding will be defined in TS 24.301.
- */
- static void
- 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_)
- {
- const char *digit_str;
- /* Octets 5 to (n+4) represent the MSISDN value is in international number format
- * as described in ITU-T Rec E.164 [25] and 3GPP TS 29.002 [41].
- * MSISDN value contains only the actual MSISDN number (does not contain the "nature of
- * address indicator" octet, which indicates "international number"
- * as in 3GPP TS 29.002 [41]) and is encoded as TBCD digits, i.e.
- * digits from 0 through 9 are encoded "0000" to "1001".
- * When there is an odd number of digits, bits 8 to 5 of the last octet are encoded with
- * the filler "1111".
- */
- dissect_e164_cc(tvb, tree, 0, TRUE);
- /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to
- * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the EP
- * allocated string will be returned.
- */
- digit_str = tvb_bcd_dig_to_ep_str( tvb, 0, length, NULL, FALSE);
- proto_tree_add_string(tree, hf_gtpv2_address_digits, tvb, 0, length, digit_str);
- proto_item_append_text(item, "%s", digit_str);
- }
- /*
- * 8.12 Indication
- */
- static void
- 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_)
- {
- int offset = 0;
- /* Octet 5 DAF DTF HI DFI OI ISRSI ISRAI SGWCI */
- proto_tree_add_item(tree, hf_gtpv2_daf, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_dtf, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_hi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_dfi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_oi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_isrsi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_israi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_sgwci, tvb, offset, 1, FALSE);
- if(length==1) {
- proto_tree_add_text(tree, tvb, 0, length, "Older version?, should be 2 octets in 8.0.0");
- return;
- }
- offset++;
- /* Octet 6 SQCI UIMSI CFSI CRSI P PT SI MSV
- * 3GPP TS 29.274 version 9.4.0 Release 9
- */
- proto_tree_add_item(tree, hf_gtpv2_sqci, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_uimsi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_cfsi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_crsi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_ps, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_pt, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_si, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_msv, tvb, offset, 1, FALSE);
- offset++;
- if(length==2){
- return;
- }
- /* Only present in version 9 and higher */
- /* Octet 7 Spare Spare Spare Spare Spare Spare Spare CCRSI */
- proto_tree_add_item(tree, hf_gtpv2_ccrsi, tvb, offset, 1, FALSE);
- }
- /*
- * 8.13 Protocol Configuration Options (PCO)
- * Protocol Configuration Options (PCO) is transferred via GTP tunnels. The sending entity copies the value part of the
- * 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
- * as per clause 10.5.6.3 of 3GPP TS 24.008 [5], starting with octet 3.
- * Dissected in packet-gsm_a_gm.c
- */
- static void
- 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_)
- {
- switch(message_type){
- case GTPV2_CREATE_SESSION_REQUEST:
- /* PCO options as MS to network direction */
- pinfo->link_dir = P2P_DIR_UL;
- break;
- case GTPV2_CREATE_SESSION_RESPONSE:
- /* PCO options as Network to MS direction: */
- pinfo->link_dir = P2P_DIR_DL;
- break;
- default:
- break;
- }
- de_sm_pco(tvb, tree, pinfo, 0, length, NULL, 0);
- }
- /*
- * 8.14 PDN Address Allocation (PAA)
- */
- static const value_string gtpv2_pdn_type_vals[] = {
- {1, "IPv4"},
- {2, "IPv6"},
- {3, "IPv4/IPv6"},
- {0, NULL}
- };
- static void
- 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_)
- {
- int offset = 0;
- guint8 pdn_type;
- pdn_type = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(tree, hf_gtpv2_pdn_type, tvb, offset, 1, FALSE);
- offset++;
- switch(pdn_type)
- {
- case 1:
- /* IPv4 */
- proto_tree_add_item(tree, hf_gtpv2_pdn_ipv4, tvb, offset, 4, FALSE);
- offset+=4;
- break;
- case 2:
- /* IPv6*/
- /* If PDN type value indicates IPv6, octet 6 contains the IPv6 Prefix Length.
- * Octets 7 through 22 contain an IPv6 Prefix and Interface Identifier.
- * Bit 8 of octet 7 represents the most significant bit of the IPv6 Prefix
- * and Interface Identifier and bit 1 of octet 22 the least significant bit.
- */
- proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6_len, tvb, offset, 1, FALSE);
- offset++;
- proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6, tvb, offset, 16, FALSE);
- offset+=16;
- break;
- case 3:
- /* IPv4/IPv6 */
- /* If PDN type value indicates IPv4v6, octet 6 contains the IPv6 Prefix Length.
- * Octets 7 through 22 contain an IPv6 Prefix and Interface Identifier.
- * Bit 8 of octet 7 represents the most significant bit of the IPv6 Prefix
- * and Interface Identifier and bit 1 of octet 22 the least significant bit.
- * Octets 23 through 26 contain an IPv4 address. Bit 8 of octet 23 represents
- * the most significant bit of the IPv4 address and bit 1 of octet 26 the least
- * significant bit.
- */
- proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6_len, tvb, offset, 1, FALSE);
- offset++;
- proto_tree_add_item(tree, hf_gtpv2_pdn_ipv6, tvb, offset, 16, FALSE);
- offset+=16;
- proto_tree_add_item(tree, hf_gtpv2_pdn_ipv4, tvb, offset, 4, FALSE);
- offset+=4;
- break;
- default:
- break;
- }
- }
- /*
- * 8.15 Bearer Quality of Service (Bearer QoS)
- */
- static void
- 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_)
- {
- int offset = 0;
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pvi, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pl, tvb, offset, 1, FALSE);
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_pci, tvb, offset, 1, FALSE);
- offset++;
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_label_qci, tvb, offset, 1, FALSE);
- offset++;
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_mbr_up, tvb, offset, 5, FALSE);
- offset= offset+5;
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_mbr_down, tvb, offset, 5, FALSE);
- offset= offset+5;
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_gbr_up, tvb, offset, 5, FALSE);
- offset= offset+5;
- proto_tree_add_item(tree, hf_gtpv2_bearer_qos_gbr_down, tvb, offset, 5, FALSE);
- offset= offset+5;
- }
- /*
- * 8.16 Flow Quality of Service (Flow QoS)
- */
- static void
- 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_)
- {
- int offset = 0;
- proto_tree_add_item(tree, hf_gtpv2_flow_qos_label_qci, tvb, offset, 1, FALSE);
- offset++;
- proto_tree_add_item(tree, hf_gtpv2_flow_qos_mbr_up, tvb, o…