diff options
author | Bill Meier <wmeier@newsguy.com> | 2014-06-19 21:35:46 -0400 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2014-06-20 02:58:11 +0000 |
commit | 728e5a1ab3e2614ec83a6af43a52742cf0f5df01 (patch) | |
tree | 7c4906b5f5028545af7131b3104b27bc584ccbd4 /epan/dissectors/packet-vnc.c | |
parent | 0c3e1a243bf3db07ce446f9e5ac2df93573b23f5 (diff) | |
download | wireshark-728e5a1ab3e2614ec83a6af43a52742cf0f5df01.tar.gz |
packet-vnc.c: Improve re-assembly.
Essentially:
When more data is needed to continue dissecting a PDU, use
DESEGMENT_ONE_MORE_SEGMENT instead of repeatedly requesting
additional bytes (for one or a few more fields).
- Improves the efficiency of the dissection;
- Prevents 'one-pass' tshark dissection from redissecting
the PDU repeatedly many, many times with each time dissecting
the PDU with one or a few more additional fields.
This generated *lots* of (repeated) output since a reassembled
VNC PDU can contain many fields (each of short length).
- (A comment in packet-tcp.c states, in effect, that repeatedly
requesting a specific amount of more bytes to dissect a PDU
will "break reassembly" although I note that the reassembly did
seem to work (in-efficiently)).
Note: Although this patch improves the handling of reassembly, the
dissector has significant issues. For example. see Bug #5366.
I expect this fixes the Bug #10134 issue: "Cannot allocate memory";
Before the fix, 'tshark -nVxr' for the input file generated trees with
multiple hundreds of thousands of entries and generated reassembled
PDUs consisting of many, many small fragments.
Change-Id: I970037c346fbaa4bffa5726fd5bee5f69396eabf
Reviewed-on: https://code.wireshark.org/review/2471
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-vnc.c')
-rw-r--r-- | epan/dissectors/packet-vnc.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index c3b5f3f42d..04449309fb 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -1590,7 +1590,7 @@ vnc_server_to_client(tvbuff_t *tvb, packet_info *pinfo, gint *offset, { gint start_offset; guint8 message_type; - gint bytes_needed = 0, length_remaining; + gint bytes_needed = 0; proto_item *ti = NULL; proto_tree *vnc_server_message_type_tree; @@ -1639,13 +1639,9 @@ vnc_server_to_client(tvbuff_t *tvb, packet_info *pinfo, gint *offset, break; } - if(bytes_needed > 0 && vnc_preference_desegment && - pinfo->can_desegment) { - length_remaining = tvb_length_remaining(tvb, *offset); - + if(bytes_needed > 0 && vnc_preference_desegment && pinfo->can_desegment) { pinfo->desegment_offset = start_offset; - pinfo->desegment_len = bytes_needed - length_remaining; - return; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; } } @@ -4625,3 +4621,16 @@ proto_reg_handoff_vnc(void) } } } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ |