summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-epl.c
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-06-25 14:25:42 +0200
committerAnders Broman <a.broman58@gmail.com>2015-06-26 08:49:00 +0000
commita7a7c689bcffd4dcf3e49e7095235b0a9c158731 (patch)
treea4dfabdc35d54c63797633c6db8f1e39d9c6b02d /epan/dissectors/packet-epl.c
parentfe679bfa5d32b0202845c57f45f18a218ff9b64f (diff)
downloadwireshark-a7a7c689bcffd4dcf3e49e7095235b0a9c158731.tar.gz
epl: Set Payload to remaining bytes
The payload dissection now only includes the remaining bytes, even if the actual number of payload bytes should be bigger. An expert Info is added, to inform the user, that the trace was truncated, but the payload is still given to a sub-dissector, as it may contain valid information Change-Id: Iefef78e7c7aed7f87e40875f345ff5debf364f3a Reviewed-on: https://code.wireshark.org/review/9124 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-epl.c')
-rw-r--r--epan/dissectors/packet-epl.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c
index a7ac1ecf5a..7d2c772090 100644
--- a/epan/dissectors/packet-epl.c
+++ b/epan/dissectors/packet-epl.c
@@ -1240,6 +1240,7 @@ static gint hf_epl_mtyp = -1;
static gint hf_epl_node = -1;
static gint hf_epl_dest = -1;
static gint hf_epl_src = -1;
+static gint hf_epl_payload_real = -1;
static gint hf_epl_soc = -1;
static gint hf_epl_soc_mc = -1;
@@ -1502,6 +1503,7 @@ static expert_field ei_recvseq_value = EI_INIT;
static expert_field ei_sendseq_value = EI_INIT;
static expert_field ei_recvcon_value = EI_INIT;
static expert_field ei_sendcon_value = EI_INIT;
+static expert_field ei_real_length_differs = EI_INIT;
static dissector_handle_t epl_handle;
@@ -1880,15 +1882,24 @@ decode_epl_address (guchar adr)
static gint
dissect_epl_payload ( proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint offset, gint len, guint8 msgType )
{
- gint off = 0;
+ gint off = 0, rem_len = 0;
tvbuff_t * payload_tvb = NULL;
heur_dtbl_entry_t *hdtbl_entry = NULL;
+ proto_item * item = NULL;
off = offset;
if (len > 0)
{
- payload_tvb = tvb_new_subset(tvb, off, len, tvb_reported_length_remaining(tvb, offset) );
+ payload_tvb = tvb_new_subset_remaining(tvb, off);
+ rem_len = tvb_captured_length_remaining(payload_tvb, 0);
+ if ( rem_len < len )
+ {
+ item = proto_tree_add_uint(epl_tree, hf_epl_payload_real, tvb, off, rem_len, rem_len);
+ PROTO_ITEM_SET_GENERATED(item);
+ expert_add_info(pinfo, item, &ei_real_length_differs );
+ }
+
if ( ! dissector_try_heuristic(heur_epl_data_subdissector_list, payload_tvb, pinfo, epl_tree, &hdtbl_entry, &msgType))
call_dissector(data_dissector, payload_tvb, pinfo, epl_tree);
@@ -3468,6 +3479,10 @@ proto_register_epl(void)
{ "Source", "epl.src",
FT_UINT8, BASE_DEC_HEX, NULL, 0x00, NULL, HFILL }
},
+ { &hf_epl_payload_real,
+ { "Captured Size", "epl.payload.capture_size",
+ FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }
+ },
/* SoC data fields*/
{ &hf_epl_soc,
@@ -4247,6 +4262,10 @@ proto_register_epl(void)
{ "epl.error.send.connection", PI_PROTOCOL, PI_ERROR,
"Invalid Value for SendCon", EXPFILL }
},
+ { &ei_real_length_differs,
+ { "epl.error.payload.length.differs", PI_PROTOCOL, PI_ERROR,
+ "Captured length differs from header information", EXPFILL }
+ }
};
module_t *epl_module;