From f30de770bd75ae633fcfe5351c4bc859524133ab Mon Sep 17 00:00:00 2001 From: Gloria Pozuelo Date: Tue, 3 Nov 2015 16:49:32 +0100 Subject: GTP sequence number fix for allowing to have sequence number equal to 0 Change-Id: Id8aad52198905eb33ecccf5ace01287954f31d2e Reviewed-on: https://code.wireshark.org/review/11526 Petri-Dish: Pascal Quantin Reviewed-by: Pascal Quantin (cherry picked from commit 0b3091fa359492a0fe7af50a42a2f70d85377a35) Reviewed-on: https://code.wireshark.org/review/11642 --- epan/dissectors/packet-gtp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index e8dbde0152..448448a03c 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -7953,7 +7953,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree *gtp_tree = NULL, *ext_tree; proto_item *ti = NULL, *tf, *ext_hdr_len_item; int i, offset = 0, checked_field, mandatory; - gboolean gtp_prime; + gboolean gtp_prime, has_SN; int seq_no = 0; int flow_label = 0; guint8 pdu_no, next_hdr = 0; @@ -8111,8 +8111,11 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) } offset += 2; + /* We initialize the sequence number*/ + has_SN = FALSE; if (gtp_prime) { seq_no = tvb_get_ntohs(tvb, offset); + has_SN = TRUE; proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no); offset += 2; /* If GTP' version is 0 and bit 1 is 0 20 bytes header is used, dissect it */ @@ -8136,6 +8139,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) switch (gtp_version) { case 0: seq_no = tvb_get_ntohs(tvb, offset); + has_SN = TRUE; proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no); offset += 2; @@ -8171,6 +8175,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) particular flag for the field is set. */ if (gtp_hdr->flags & GTP_S_MASK) { seq_no = tvb_get_ntohs(tvb, offset); + has_SN = TRUE; proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no); } offset += 2; @@ -8307,7 +8312,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) } /*Use sequence number to track Req/Resp pairs*/ - if (seq_no) { + if (has_SN) { gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr->message, gtp_info); /*pass packet to tap for response time reporting*/ if (gcrp) { -- cgit v1.2.1