aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-07-29 07:14:32 +0000
committerGuy Harris <guy@alum.mit.edu>2005-07-29 07:14:32 +0000
commit0c5af0dde6744082ebbdfa9bd8b80f28b4e16cc3 (patch)
tree2ca4eb3be0ffb5a5970c7fee60e6ddd77878929f
parent70fb0178665e945fe77d233ca8e59133a310a8d4 (diff)
If we do reassembly and hand the packet to the dissector, and the
dissector says "sorry, I need even more data in this packet", don't flag that packet as being reassembled in that frame. Indicate that we should perhaps do all the "partial reassembly" stuff in "fragment_set_partial_assembly()", which would obviate the need for the hack in the TCP dissector. Clean up indentation. svn path=/trunk/; revision=15139
-rw-r--r--epan/dissectors/packet-tcp.c20
-rw-r--r--epan/reassemble.c12
2 files changed, 24 insertions, 8 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 0a68caaf47..57e254fc89 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -1941,12 +1941,15 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
*/
show_fragment_tree(ipfd_head, &tcp_segment_items,
tree, pinfo, next_tvb, &frag_tree_item);
- /* the toplevel fragment subtree is now behind all desegmented data,
- * move it right behind the TCP tree */
- tcp_tree_item = proto_tree_get_parent(tcp_tree);
- if(frag_tree_item && tcp_tree_item) {
- proto_tree_move_item(tree, tcp_tree_item, frag_tree_item);
- }
+ /*
+ * The toplevel fragment subtree is now
+ * behind all desegmented data; move it
+ * right behind the TCP tree.
+ */
+ tcp_tree_item = proto_tree_get_parent(tcp_tree);
+ if(frag_tree_item && tcp_tree_item) {
+ proto_tree_move_item(tree, tcp_tree_item, frag_tree_item);
+ }
/* Did the subdissector ask us to desegment
some more data? This means that the data
@@ -2066,14 +2069,15 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
}
if (!called_dissector || pinfo->desegment_len != 0) {
- if (ipfd_head != NULL && ipfd_head->reassembled_in != 0) {
+ if (ipfd_head != NULL && ipfd_head->reassembled_in != 0 &&
+ !(ipfd_head->flags & FD_PARTIAL_REASSEMBLY)) {
/*
* We know what frame this PDU is reassembled in;
* let the user know.
*/
item=proto_tree_add_uint(tcp_tree, hf_tcp_reassembled_in,
tvb, 0, 0, ipfd_head->reassembled_in);
- PROTO_ITEM_SET_GENERATED(item);
+ PROTO_ITEM_SET_GENERATED(item);
}
/*
diff --git a/epan/reassemble.c b/epan/reassemble.c
index 659554507c..e3c6bc86f2 100644
--- a/epan/reassemble.c
+++ b/epan/reassemble.c
@@ -476,6 +476,17 @@ fragment_set_partial_reassembly(packet_info *pinfo, guint32 id, GHashTable *frag
fd_head = g_hash_table_lookup(fragment_table, &key);
+ /*
+ * XXX - why not do all the stuff done early in "fragment_add_work()",
+ * turning off FD_DEFRAGMENTED and pointing the fragments' data
+ * pointers to the appropriate part of the already-reassembled
+ * data, and clearing the data length and "reassembled in" frame
+ * number, here? We currently have a hack in the TCP dissector
+ * not to set the "reassembled in" value if the "partial reassembly"
+ * flag is set, so that in the first pass through the packets
+ * we don't falsely set a packet as reassembled in that packet
+ * if the dissector decided that even more reassembly was needed.
+ */
if(fd_head){
fd_head->flags |= FD_PARTIAL_REASSEMBLY;
}
@@ -600,6 +611,7 @@ fragment_add_work(fragment_data *fd_head, tvbuff_t *tvb, int offset,
fd_head->flags ^= FD_DEFRAGMENTED|FD_PARTIAL_REASSEMBLY;
fd_head->flags &= (~FD_TOOLONGFRAGMENT) & (~FD_MULTIPLETAILS);
fd_head->datalen=0;
+ fd_head->reassembled_in=0;
}
if (!more_frags) {