diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-03-27 04:27:05 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-03-27 04:27:05 +0000 |
commit | 588c50944de744c40f127a52519e1e5aef8d83a5 (patch) | |
tree | 8924bfb6fae808780d2d8d36ffd53261749ec67b | |
parent | 31cf9563c236737b2edc397f0bd4369e2f30cc05 (diff) |
In the protocol tree entries for lists of fragments/segments, make the
top-level item correspond to the reassembled data, and make the item for
each fragment/segment correspond to the part of that reassembled data
that came from that fragment/segment.
svn path=/trunk/; revision=5025
-rw-r--r-- | packet-clnp.c | 48 | ||||
-rw-r--r-- | packet-ip.c | 48 | ||||
-rw-r--r-- | packet-ipv6.c | 48 | ||||
-rw-r--r-- | packet-rpc.c | 6 | ||||
-rw-r--r-- | packet-smb-pipe.c | 10 | ||||
-rw-r--r-- | packet-smb.c | 36 | ||||
-rw-r--r-- | packet-tcp.c | 9 |
7 files changed, 106 insertions, 99 deletions
diff --git a/packet-clnp.c b/packet-clnp.c index c1ad6ac5d5..025504622a 100644 --- a/packet-clnp.c +++ b/packet-clnp.c @@ -1,7 +1,7 @@ /* packet-clnp.c * Routines for ISO/OSI network and transport protocol packet disassembly * - * $Id: packet-clnp.c,v 1.50 2002/02/27 05:45:48 guy Exp $ + * $Id: packet-clnp.c,v 1.51 2002/03/27 04:27:03 guy Exp $ * Laurent Deniel <deniel@worldnet.fr> * Ralf Schneider <Ralf.Schneider@t-online.de> * @@ -1832,10 +1832,25 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *ft=NULL; proto_item *fi=NULL; - /* OK, we have the complete reassembled payload. */ + /* OK, we have the complete reassembled payload. + Allocate a new tvbuff, referring to the reassembled payload. */ + next_tvb = tvb_new_real_data(fd_head->data, fd_head->datalen, + fd_head->datalen); + + /* Add the tvbuff to the list of tvbuffs to which the tvbuff we + were handed refers, so it'll get cleaned up when that tvbuff + is cleaned up. */ + tvb_set_child_real_data_tvbuff(tvb, next_tvb); + + /* Add the defragmented data to the data source list. */ + add_new_data_source(pinfo->fd, next_tvb, "Reassembled CLNP"); + + /* It's not fragmented. */ + pinfo->fragmented = FALSE; + /* show all segments */ fi = proto_tree_add_item(clnp_tree, hf_clnp_segments, - tvb, 0, 0, FALSE); + next_tvb, 0, -1, FALSE); ft = proto_item_add_subtree(fi, ett_clnp_segments); for (fd = fd_head->next; fd != NULL; fd = fd->next){ if (fd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT @@ -1854,7 +1869,7 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf = hf_clnp_segment; } fei = proto_tree_add_none_format(ft, hf, - tvb, 0, 0, + next_tvb, fd->offset, fd->len, "Frame:%u payload:%u-%u", fd->frame, fd->offset, @@ -1863,28 +1878,28 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fet = proto_item_add_subtree(fei, ett_clnp_segment); if (fd->flags&FD_OVERLAP) { proto_tree_add_boolean(fet, - hf_clnp_segment_overlap, tvb, 0, 0, + hf_clnp_segment_overlap, next_tvb, 0, 0, TRUE); } if (fd->flags&FD_OVERLAPCONFLICT) { proto_tree_add_boolean(fet, - hf_clnp_segment_overlap_conflict, tvb, 0, 0, + hf_clnp_segment_overlap_conflict, next_tvb, 0, 0, TRUE); } if (fd->flags&FD_MULTIPLETAILS) { proto_tree_add_boolean(fet, - hf_clnp_segment_multiple_tails, tvb, 0, 0, + hf_clnp_segment_multiple_tails, next_tvb, 0, 0, TRUE); } if (fd->flags&FD_TOOLONGFRAGMENT) { proto_tree_add_boolean(fet, - hf_clnp_segment_too_long_segment, tvb, 0, 0, + hf_clnp_segment_too_long_segment, next_tvb, 0, 0, TRUE); } } else { /* nothing of interest for this segment */ proto_tree_add_none_format(ft, hf_clnp_segment, - tvb, 0, 0, + next_tvb, fd->offset, fd->len, "Frame:%u payload:%u-%u", fd->frame, fd->offset, @@ -1899,21 +1914,6 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) update_col_info = FALSE; } } - - /* Allocate a new tvbuff, referring to the reassembled payload. */ - next_tvb = tvb_new_real_data(fd_head->data, fd_head->datalen, - fd_head->datalen); - - /* Add the tvbuff to the list of tvbuffs to which the tvbuff we - were handed refers, so it'll get cleaned up when that tvbuff - is cleaned up. */ - tvb_set_child_real_data_tvbuff(tvb, next_tvb); - - /* Add the defragmented data to the data source list. */ - add_new_data_source(pinfo->fd, next_tvb, "Reassembled CLNP"); - - /* It's not fragmented. */ - pinfo->fragmented = FALSE; } else { /* We don't have the complete reassembled payload. */ next_tvb = NULL; diff --git a/packet-ip.c b/packet-ip.c index e8d9f7daaa..c0e5b837be 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.163 2002/02/27 05:45:48 guy Exp $ + * $Id: packet-ip.c,v 1.164 2002/03/27 04:27:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -984,10 +984,25 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *ft=NULL; proto_item *fi=NULL; - /* OK, we have the complete reassembled payload. */ + /* OK, we have the complete reassembled payload. + Allocate a new tvbuff, referring to the reassembled payload. */ + next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen, + ipfd_head->datalen); + + /* Add the tvbuff to the list of tvbuffs to which the tvbuff we + were handed refers, so it'll get cleaned up when that tvbuff + is cleaned up. */ + tvb_set_child_real_data_tvbuff(tvb, next_tvb); + + /* Add the defragmented data to the data source list. */ + add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv4"); + + /* It's not fragmented. */ + pinfo->fragmented = FALSE; + /* show all fragments */ fi = proto_tree_add_item(ip_tree, hf_ip_fragments, - tvb, 0, 0, FALSE); + next_tvb, 0, -1, FALSE); ft = proto_item_add_subtree(fi, ett_ip_fragments); for (ipfd=ipfd_head->next; ipfd; ipfd=ipfd->next){ if (ipfd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT @@ -1006,7 +1021,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf = hf_ip_fragment; } fei = proto_tree_add_none_format(ft, hf, - tvb, 0, 0, + next_tvb, ipfd->offset, ipfd->len, "Frame:%u payload:%u-%u", ipfd->frame, ipfd->offset, @@ -1015,28 +1030,28 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fet = proto_item_add_subtree(fei, ett_ip_fragment); if (ipfd->flags&FD_OVERLAP) { proto_tree_add_boolean(fet, - hf_ip_fragment_overlap, tvb, 0, 0, + hf_ip_fragment_overlap, next_tvb, 0, 0, TRUE); } if (ipfd->flags&FD_OVERLAPCONFLICT) { proto_tree_add_boolean(fet, - hf_ip_fragment_overlap_conflict, tvb, 0, 0, + hf_ip_fragment_overlap_conflict, next_tvb, 0, 0, TRUE); } if (ipfd->flags&FD_MULTIPLETAILS) { proto_tree_add_boolean(fet, - hf_ip_fragment_multiple_tails, tvb, 0, 0, + hf_ip_fragment_multiple_tails, next_tvb, 0, 0, TRUE); } if (ipfd->flags&FD_TOOLONGFRAGMENT) { proto_tree_add_boolean(fet, - hf_ip_fragment_too_long_fragment, tvb, 0, 0, + hf_ip_fragment_too_long_fragment, next_tvb, 0, 0, TRUE); } } else { /* nothing of interest for this fragment */ proto_tree_add_none_format(ft, hf_ip_fragment, - tvb, 0, 0, + next_tvb, ipfd->offset, ipfd->len, "Frame:%u payload:%u-%u", ipfd->frame, ipfd->offset, @@ -1051,21 +1066,6 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) update_col_info = FALSE; } } - - /* Allocate a new tvbuff, referring to the reassembled payload. */ - next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen, - ipfd_head->datalen); - - /* Add the tvbuff to the list of tvbuffs to which the tvbuff we - were handed refers, so it'll get cleaned up when that tvbuff - is cleaned up. */ - tvb_set_child_real_data_tvbuff(tvb, next_tvb); - - /* Add the defragmented data to the data source list. */ - add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv4"); - - /* It's not fragmented. */ - pinfo->fragmented = FALSE; } else { /* We don't have the complete reassembled payload. */ next_tvb = NULL; diff --git a/packet-ipv6.c b/packet-ipv6.c index 2d23f17e69..7bd4c257e7 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -1,7 +1,7 @@ /* packet-ipv6.c * Routines for IPv6 packet disassembly * - * $Id: packet-ipv6.c,v 1.78 2002/02/27 05:45:48 guy Exp $ + * $Id: packet-ipv6.c,v 1.79 2002/03/27 04:27:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -823,10 +823,25 @@ again: proto_tree *ft = NULL; proto_item *fi = NULL; - /* OK, we have the complete reassembled payload. */ + /* OK, we have the complete reassembled payload. + Allocate a new tvbuff, referring to the reassembled payload. */ + next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen, + ipfd_head->datalen); + + /* Add the tvbuff to the list of tvbuffs to which the tvbuff we + were handed refers, so it'll get cleaned up when that tvbuff + is cleaned up. */ + tvb_set_child_real_data_tvbuff(tvb, next_tvb); + + /* Add the defragmented data to the data source list. */ + add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv6"); + + /* It's not fragmented. */ + pinfo->fragmented = FALSE; + /* show all fragments */ fi = proto_tree_add_item(ipv6_tree, hf_ipv6_fragments, - tvb, 0, 0, FALSE); + next_tvb, 0, -1, FALSE); ft = proto_item_add_subtree(fi, ett_ipv6_fragments); for (ipfd = ipfd_head->next; ipfd; ipfd = ipfd->next){ if (ipfd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT @@ -845,7 +860,7 @@ again: hf = hf_ipv6_fragment; } fei = proto_tree_add_none_format(ft, hf, - tvb, 0, 0, + next_tvb, ipfd->offset, ipfd->len, "Frame:%u payload:%u-%u", ipfd->frame, ipfd->offset, @@ -854,28 +869,28 @@ again: fet = proto_item_add_subtree(fei, ett_ipv6_fragment); if (ipfd->flags&FD_OVERLAP) { proto_tree_add_boolean(fet, - hf_ipv6_fragment_overlap, tvb, 0, 0, + hf_ipv6_fragment_overlap, next_tvb, 0, 0, TRUE); } if (ipfd->flags&FD_OVERLAPCONFLICT) { proto_tree_add_boolean(fet, - hf_ipv6_fragment_overlap_conflict, tvb, 0, 0, + hf_ipv6_fragment_overlap_conflict, next_tvb, 0, 0, TRUE); } if (ipfd->flags&FD_MULTIPLETAILS) { proto_tree_add_boolean(fet, - hf_ipv6_fragment_multiple_tails, tvb, 0, 0, + hf_ipv6_fragment_multiple_tails, next_tvb, 0, 0, TRUE); } if (ipfd->flags&FD_TOOLONGFRAGMENT) { proto_tree_add_boolean(fet, - hf_ipv6_fragment_too_long_fragment, tvb, 0, 0, + hf_ipv6_fragment_too_long_fragment, next_tvb, 0, 0, TRUE); } } else { /* nothing of interest for this fragment */ proto_tree_add_none_format(ft, hf_ipv6_fragment, - tvb, 0, 0, + next_tvb, ipfd->offset, ipfd->len, "Frame:%u payload:%u-%u", ipfd->frame, ipfd->offset, @@ -890,21 +905,6 @@ again: update_col_info = FALSE; } } - - /* Allocate a new tvbuff, referring to the reassembled payload. */ - next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen, - ipfd_head->datalen); - - /* Add the tvbuff to the list of tvbuffs to which the tvbuff we - were handed refers, so it'll get cleaned up when that tvbuff - is cleaned up. */ - tvb_set_child_real_data_tvbuff(tvb, next_tvb); - - /* Add the defragmented data to the data source list. */ - add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv6"); - - /* It's not fragmented. */ - pinfo->fragmented = FALSE; } else { /* We don't have the complete reassembled payload. */ next_tvb = NULL; diff --git a/packet-rpc.c b/packet-rpc.c index 108f218cfd..40e3ac6185 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de> * - * $Id: packet-rpc.c,v 1.87 2002/02/18 23:51:55 guy Exp $ + * $Id: packet-rpc.c,v 1.88 2002/03/27 04:27:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -2207,10 +2207,10 @@ show_rpc_fraginfo(tvbuff_t *tvb, tvbuff_t *frag_tvb, proto_tree *tree, /* * Show a tree with information about all fragments. */ - si = proto_tree_add_text(tree, tvb, 0, 0, "Fragments"); + si = proto_tree_add_text(tree, tvb, 0, -1, "Fragments"); st = proto_item_add_subtree(si, ett_rpc_fragments); for (ipfd = ipfd_head->next; ipfd != NULL; ipfd = ipfd->next) { - proto_tree_add_text(st, tvb, 0, 0, + proto_tree_add_text(st, tvb, ipfd->offset, ipfd->len, "Frame:%u [%u-%u]", ipfd->frame, ipfd->offset, diff --git a/packet-smb-pipe.c b/packet-smb-pipe.c index ed88de56be..5cc1020465 100644 --- a/packet-smb-pipe.c +++ b/packet-smb-pipe.c @@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets * significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and * Guy Harris 2001 * - * $Id: packet-smb-pipe.c,v 1.71 2002/03/16 04:39:28 sahlberg Exp $ + * $Id: packet-smb-pipe.c,v 1.72 2002/03/27 04:27:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -3203,11 +3203,13 @@ dissect_pipe_dcerpc(tvbuff_t *d_tvb, packet_info *pinfo, proto_tree *parent_tree d_tvb=new_tvb; /* list what segments we have */ - it = proto_tree_add_text(tree, d_tvb, 0, 0, "Fragments"); + it = proto_tree_add_text(tree, d_tvb, 0, -1, "Fragments"); tr = proto_item_add_subtree(it, ett_smb_pipe_fragments); for(fd=fd_head->next;fd;fd=fd->next){ - proto_tree_add_text(tr, d_tvb, 0, 0, "Frame:%u Data:%u-%u", - fd->frame, fd->offset, fd->offset+fd->len-1); + proto_tree_add_text(tr, d_tvb, fd->offset, fd->len, + "Frame:%u Data:%u-%u", + fd->frame, fd->offset, + fd->offset+fd->len-1); } } } diff --git a/packet-smb.c b/packet-smb.c index b37770c463..3f43861593 100644 --- a/packet-smb.c +++ b/packet-smb.c @@ -3,7 +3,7 @@ * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * 2001 Rewrite by Ronnie Sahlberg and Guy Harris * - * $Id: packet-smb.c,v 1.236 2002/03/26 08:23:58 guy Exp $ + * $Id: packet-smb.c,v 1.237 2002/03/27 04:27:04 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -7964,18 +7964,20 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_item *it; fragment_data *fd; - it = proto_tree_add_text(tree, tvb, 0, 0, "Fragments"); - tr = proto_item_add_subtree(it, ett_smb_segments); - for(fd=r_fd->next;fd;fd=fd->next){ - proto_tree_add_text(tr, tvb, 0, 0, "Frame:%u Data:%u-%u", - fd->frame, fd->offset, fd->offset+fd->len-1); - } - pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen, r_fd->datalen); tvb_set_child_real_data_tvbuff(tvb, pd_tvb); add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB"); pinfo->fragmented = FALSE; + + it = proto_tree_add_text(tree, pd_tvb, 0, -1, "Fragments"); + tr = proto_item_add_subtree(it, ett_smb_segments); + for(fd=r_fd->next;fd;fd=fd->next){ + proto_tree_add_text(tr, pd_tvb, fd->offset, fd->len, + "Frame:%u Data:%u-%u", + fd->frame, fd->offset, + fd->offset+fd->len-1); + } } @@ -11856,19 +11858,21 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree proto_tree *tr; proto_item *it; fragment_data *fd; - - it = proto_tree_add_text(tree, tvb, 0, 0, "Fragments"); - tr = proto_item_add_subtree(it, ett_smb_segments); - for(fd=r_fd->next;fd;fd=fd->next){ - proto_tree_add_text(tr, tvb, 0, 0, "Frame:%u Data:%u-%u", - fd->frame, fd->offset, fd->offset+fd->len-1); - } - + pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen, r_fd->datalen); tvb_set_child_real_data_tvbuff(tvb, pd_tvb); add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB"); pinfo->fragmented = FALSE; + + it = proto_tree_add_text(tree, pd_tvb, 0, -1, "Fragments"); + tr = proto_item_add_subtree(it, ett_smb_segments); + for(fd=r_fd->next;fd;fd=fd->next){ + proto_tree_add_text(tr, pd_tvb, fd->offset, fd->len, + "Frame:%u Data:%u-%u", + fd->frame, fd->offset, + fd->offset+fd->len-1); + } } diff --git a/packet-tcp.c b/packet-tcp.c index b0b046c346..153cf3aa07 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.134 2002/02/24 02:59:30 guy Exp $ + * $Id: packet-tcp.c,v 1.135 2002/03/27 04:27:05 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -471,11 +471,12 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset, * end may, in turn, require desegmentation), * so we show a tree with all segments. */ - si = proto_tree_add_text(tcp_tree, tvb, 0, 0, - "Segments"); + si = proto_tree_add_text(tcp_tree, next_tvb, + 0, -1, "Segments"); st = proto_item_add_subtree(si, ett_tcp_segments); for(ipfd=ipfd_head->next; ipfd; ipfd=ipfd->next){ - proto_tree_add_text(st, tvb, 0, 0, + proto_tree_add_text(st, next_tvb, + ipfd->offset, ipfd->len, "Frame:%u seq#:%u-%u [%u-%u]", ipfd->frame, tsk->start_seq + ipfd->offset, |