diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-07-24 19:50:29 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-07-24 19:42:54 +0000 |
commit | d24614c77a3eb5e889dbe4caaf63b065d1bb3c4a (patch) | |
tree | 2fd287d2b1877ec9414ed244db3171ac3cd89bfd | |
parent | bb7e6573608b89c426e1f77befcf37cec57d7d89 (diff) |
MAC LTE: fix dissection when only header is captured but full PDU length is reported
Change-Id: I66ccfc26b3a0e948fdcf8dfe4ec8e87e6ed756da
Reviewed-on: https://code.wireshark.org/review/9778
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r-- | epan/dissectors/packet-mac-lte.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c index ec364b334e..08c77ae4b2 100644 --- a/epan/dissectors/packet-mac-lte.c +++ b/epan/dissectors/packet-mac-lte.c @@ -4019,8 +4019,6 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree for (n=0; n < number_of_headers; n++) { /* Get out of loop once see any data SDU subheaders */ if (lcids[n] <= 10) { - /* Update tap sdu count for this channel */ - tap_info->sdus_for_lcid[lcids[n]]++; break; } @@ -4831,12 +4829,30 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree } /* There might not be any data, if only headers (plus control data) were logged */ - is_truncated = ((tvb_reported_length_remaining(tvb, offset) == 0) && expecting_body_data); + is_truncated = ((tvb_captured_length_remaining(tvb, offset) == 0) && expecting_body_data); truncated_ti = proto_tree_add_uint(tree, hf_mac_lte_sch_header_only, tvb, 0, 0, is_truncated); if (is_truncated) { PROTO_ITEM_SET_GENERATED(truncated_ti); expert_add_info(pinfo, truncated_ti, &ei_mac_lte_sch_header_only_truncated); + /* Update sdu and byte count in stats */ + for (; n < number_of_headers; n++) { + guint16 data_length; + /* Break out if meet padding */ + if (lcids[n] == PADDING_LCID) { + break; + } + data_length = (pdu_lengths[n] == -1) ? + tvb_reported_length_remaining(tvb, offset) : + pdu_lengths[n]; + tap_info->sdus_for_lcid[lcids[n]]++; + tap_info->bytes_for_lcid[lcids[n]] += data_length; + offset += data_length; + } + if (lcids[number_of_headers-1] == PADDING_LCID) { + /* Update padding bytes in stats */ + tap_info->padding_bytes += (p_mac_lte_info->length - offset); + } return; } else { @@ -5001,7 +5017,8 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree offset += data_length; - /* Update tap byte count for this channel */ + /* Update tap sdu and byte count for this channel */ + tap_info->sdus_for_lcid[lcids[n]]++; tap_info->bytes_for_lcid[lcids[n]] += data_length; } @@ -5367,7 +5384,7 @@ static void dissect_mch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pro /* There might not be any data, if only headers (plus control data) were logged */ - is_truncated = ((tvb_reported_length_remaining(tvb, offset) == 0) && expecting_body_data); + is_truncated = ((tvb_captured_length_remaining(tvb, offset) == 0) && expecting_body_data); truncated_ti = proto_tree_add_uint(tree, hf_mac_lte_mch_header_only, tvb, 0, 0, is_truncated); if (is_truncated) { |