aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tcp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-02-18 23:51:55 +0000
committerGuy Harris <guy@alum.mit.edu>2002-02-18 23:51:55 +0000
commitb5058439201fcfdba86c6f7a6105ecb0cb6d6fdb (patch)
tree7b55a5cf8df1e890f729f2bf2a75756883f1c6a9 /packet-tcp.c
parent8166da40d5ce25fcf056eff41e8f43424fdc243d (diff)
Add support for reassembling RPC-over-TCP fragments, and do that in both
RPC and NDMP. Show the RPC-over-TCP fragment header as a tree with bitfields below it. Add a routine to show a reported bounds error as an "Unreassembled Packet" or a "Malformed Packet" depending on whether "pinfo->fragmented" is set, and have NBNS and RPC use that. Add "ett_ndmp_file_stats" to the list of ett_ values to be initialized (it wasn't in that list, and wasn't getting initialized). When freeing up various hash tables and memory chunks in the RPC dissector, zero out the pointers to them, just to make sure we don't try to free them again. Always destroy the TCP segment key and address memory chunks in "tcp_desegment_init()", regardless of whether TCP desegmentation is enabled - we don't *allocate* them if TCP desegmentation isn't enabled, but we should free them even if it's not enabled. Also, when we free them, set the pointers to them to null, so we don't double-free them. Supply to subdissectors called from the TCP dissector the sequence number of the first byte handed to the sub dissector. svn path=/trunk/; revision=4753
Diffstat (limited to 'packet-tcp.c')
-rw-r--r--packet-tcp.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/packet-tcp.c b/packet-tcp.c
index cd46b08388..2f7383bf9a 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.131 2002/02/18 01:08:37 guy Exp $
+ * $Id: packet-tcp.c,v 1.132 2002/02/18 23:51:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -222,6 +222,14 @@ tcp_segment_equal(gconstpointer k1, gconstpointer k2)
static void
tcp_desegment_init(void)
{
+ if(tcp_segment_key_chunk){
+ g_mem_chunk_destroy(tcp_segment_key_chunk);
+ tcp_segment_key_chunk = NULL;
+ }
+ if(tcp_segment_address_chunk){
+ g_mem_chunk_destroy(tcp_segment_address_chunk);
+ tcp_segment_address_chunk = NULL;
+ }
/* dont allocate any memory chunks unless the user really
uses this option
@@ -238,17 +246,11 @@ tcp_desegment_init(void)
tcp_segment_equal);
}
- if(tcp_segment_key_chunk){
- g_mem_chunk_destroy(tcp_segment_key_chunk);
- }
tcp_segment_key_chunk = g_mem_chunk_new("tcp_segment_key_chunk",
sizeof(tcp_segment_key),
tcp_segment_init_count*sizeof(tcp_segment_key),
G_ALLOC_ONLY);
- if(tcp_segment_address_chunk){
- g_mem_chunk_destroy(tcp_segment_address_chunk);
- }
tcp_segment_address_chunk = g_mem_chunk_new("tcp_segment_address_chunk",
sizeof(address),
tcp_segment_address_init_count*sizeof(address),
@@ -391,6 +393,12 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
add_new_data_source(pinfo->fd, next_tvb,
"Desegmented");
+ /*
+ * Supply the sequence number of the first of the
+ * reassembled bytes.
+ */
+ tcpinfo->seq = tsk->start_seq;
+
/* indicate that this is reassembled data */
tcpinfo->is_reassembled = TRUE;
@@ -1021,6 +1029,9 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(tcp_tree, hf_tcp_window_size, tvb, offset + 14, 2, th_win);
}
+ /* Supply the sequence number of the first byte. */
+ tcpinfo.seq = th_seq;
+
/* Assume we'll pass un-reassembled data to subdissectors. */
tcpinfo.is_reassembled = FALSE;