diff options
author | Roland Knall <roland.knall@br-automation.com> | 2014-02-12 16:04:18 +0100 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-02-14 16:12:22 +0000 |
commit | 627069c20c01cffcd81fa38d7f0c05e95e2f7061 (patch) | |
tree | afecebb686436de1a24714e7e6c4e1e55a663f9b /epan/dissectors/packet-epl.c | |
parent | 5c1a348a8d8031b5c53a7a0b731138b74561abed (diff) |
openSAFETY: Reduce overload and display gap data
Up until now, openSAFETY hooked into a heuristic filter for epl
and dissected the whole package, handing back some epl header
information by calling epl again. This was time-consuming and
on a busy network led to an increase in dropped packages and
memory usage, as well as unresponsivness.
This patch only takes the payload data of epl frames, and
therefore greatly reduces the dissection overhead of openSAFETY.
On a second note, intergap data between safety frames is now
being displayed as Data, but only if the option for doing so
is specifically enabled in the openSAFETY preferences, as it
changes the behaviour of the dissector output.
Upd: Because of the gap handling, some frames where marked
as being truncated, although they were not, or did not contain
openSAFETY frames at all. In the course of the fix for this,
the byte copying for the byte swap with MBTCP has been moved
to only occur when needed, and is additionaly guarded.
Upd2: Identation and comment fixes
Upd3: Change memcpy to memdup and move find_dissector ( "data" )
to proto_reg_handoff
PLK: Store data dissector pointer
Move the if-clause to proto_reg_handoff as documented
in comment of Change-id: 191
Change-Id: I3038ed465900a2b5e63b3a0967abd62a4c66f318
Reviewed-on: https://code.wireshark.org/review/191
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-epl.c')
-rw-r--r-- | epan/dissectors/packet-epl.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index f7d94db766..ee765e63b6 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -905,9 +905,6 @@ dissect_epl_payload ( proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, g if (len > 0) { - if ( data_dissector == NULL ) - data_dissector = find_dissector ( "data" ); - payload_tvb = tvb_new_subset(tvb, off, len, tvb_reported_length_remaining(tvb, offset) ); if ( ! dissector_try_heuristic(heur_epl_data_subdissector_list, payload_tvb, pinfo, epl_tree, NULL)) call_dissector(data_dissector, payload_tvb, pinfo, epl_tree); @@ -2361,7 +2358,11 @@ proto_register_epl(void) void proto_reg_handoff_epl(void) { - dissector_handle_t epl_udp_handle = new_create_dissector_handle( dissect_epludp, proto_epl ); + dissector_handle_t epl_udp_handle = new_create_dissector_handle( dissect_epludp, proto_epl ); + + /* Store a pointer to the data_dissector */ + if ( data_dissector == NULL ) + data_dissector = find_dissector ( "data" ); dissector_add_uint("ethertype", ETHERTYPE_EPL_V2, epl_handle); dissector_add_uint("udp.port", UDP_PORT_EPL, epl_udp_handle); |