GTPv2: fix dissection of 5GS TAC

Fixes #17738
This commit is contained in:
Pascal Quantin 2021-11-18 23:30:59 +01:00 committed by Wireshark GitLab Utility
parent f0b2bb7472
commit 4921183e33
2 changed files with 22 additions and 12 deletions

View File

@ -448,6 +448,7 @@ static int hf_gtpv2_sai_sac= -1;
static int hf_gtpv2_rai_lac= -1;
static int hf_gtpv2_rai_rac= -1;
static int hf_gtpv2_tai_tac= -1;
static int hf_gtpv2_5gs_tai_tac = -1;
static int hf_gtpv2_ecgi_eci= -1;
static int hf_gtpv2_ncgi_nrci= -1;
static int hf_gtpv2_uli_lai_lac = -1;
@ -2790,17 +2791,21 @@ dissect_gtpv2_tad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ite
* to 23.003 in a future version.
*/
gchar*
dissect_gtpv2_tai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset)
dissect_gtpv2_tai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, gboolean is_5gs)
{
gchar *str = NULL;
gchar *mcc_mnc_str;
guint16 tac;
guint32 tac;
mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_TAI, TRUE);
*offset += 3;
tac = tvb_get_ntohs(tvb, *offset);
proto_tree_add_item(tree, hf_gtpv2_tai_tac, tvb, *offset, 2, ENC_BIG_ENDIAN);
*offset += 2;
if (is_5gs) {
proto_tree_add_item_ret_uint(tree, hf_gtpv2_5gs_tai_tac, tvb, *offset, 3, ENC_BIG_ENDIAN, &tac);
*offset += 3;
} else {
proto_tree_add_item_ret_uint(tree, hf_gtpv2_tai_tac, tvb, *offset, 2, ENC_BIG_ENDIAN, &tac);
*offset += 2;
}
str = wmem_strdup_printf(pinfo->pool, "%s, TAC 0x%x",
mcc_mnc_str,
tac);
@ -3020,7 +3025,7 @@ decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item
part_tree = proto_tree_add_subtree(tree, tvb, offset, 5,
ett_gtpv2_uli_field, NULL, "Tracking Area Identity (TAI)");
str = dissect_gtpv2_tai(tvb, pinfo, part_tree, &offset);
str = dissect_gtpv2_tai(tvb, pinfo, part_tree, &offset, FALSE);
if (offset == length)
return str;
@ -3221,9 +3226,9 @@ dissect_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gchar **av
{
proto_tree *subtree;
subtree = proto_tree_add_subtree(tree, tvb, offset, 5, ett_gtpv2_uli_field, NULL,
subtree = proto_tree_add_subtree(tree, tvb, offset, 6, ett_gtpv2_uli_field, NULL,
"Tracking Area Identity (TAI)");
*avp_str = dissect_gtpv2_tai(tvb, pinfo, subtree, &offset);
*avp_str = dissect_gtpv2_tai(tvb, pinfo, subtree, &offset, TRUE);
}
return length;
case 137:
@ -3233,9 +3238,9 @@ dissect_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gchar **av
guint64 nr_cell_id;
proto_tree *subtree;
subtree = proto_tree_add_subtree(tree, tvb, offset, 5, ett_gtpv2_uli_field, NULL,
subtree = proto_tree_add_subtree(tree, tvb, offset, 6, ett_gtpv2_uli_field, NULL,
"Tracking Area Identity (TAI)");
*avp_str = dissect_gtpv2_tai(tvb, pinfo, subtree, &offset);
*avp_str = dissect_gtpv2_tai(tvb, pinfo, subtree, &offset, TRUE);
subtree = proto_tree_add_subtree(tree, tvb, offset, 8, ett_gtpv2_uli_field, NULL,
"NR Cell Global Identifier (NCGI)");
mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, subtree, offset, E212_NRCGI, TRUE);
@ -7157,7 +7162,7 @@ dissect_diameter_3gpp_presence_reporting_area_elements_list(tvbuff_t *tvb, packe
i = 1;
while (no_tai > 0){
sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 5, ett_gtpv2_preaa_tais, &item, "Tracking Area Identity (TAI) Number %u",i);
append_str = dissect_gtpv2_tai(tvb, pinfo, sub_tree, &offset);
append_str = dissect_gtpv2_tai(tvb, pinfo, sub_tree, &offset, FALSE);
proto_item_append_text(item, " %s",append_str);
i++;
no_tai--;
@ -10232,6 +10237,11 @@ void proto_register_gtpv2(void)
FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
NULL, HFILL}
},
{ &hf_gtpv2_5gs_tai_tac,
{"5GS Tracking Area Code", "gtpv2.5gs_tai_tac",
FT_UINT24, BASE_HEX_DEC, NULL, 0x0,
NULL, HFILL}
},
{&hf_gtpv2_ecgi_eci,
{"ECI (E-UTRAN Cell Identifier)", "gtpv2.ecgi_eci",
FT_UINT32, BASE_DEC, NULL, 0x0,

View File

@ -19,7 +19,7 @@ extern void dissect_gtpv2_selec_mode(tvbuff_t *tvb, packet_info *pinfo _U_, prot
extern void dissect_gtpv2_epc_timer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
extern void dissect_gtpv2_twan_identifier(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
/*Used by custom dissector*/
extern gchar* dissect_gtpv2_tai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset);
extern gchar* dissect_gtpv2_tai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, gboolean is_5gs);
extern void dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);
int dissect_diameter_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
extern void dissect_gtpv2_pdn_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t * args _U_);