aboutsummaryrefslogtreecommitdiffstats
path: root/reassemble.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-06-20 19:20:55 +0000
committerGuy Harris <guy@alum.mit.edu>2004-06-20 19:20:55 +0000
commitb4e1ad58fc580c4e28aa2004f3d393bf65bb049f (patch)
treeaf32c972a8a46a633876248fa6944ac0d662e7e0 /reassemble.c
parent2c59ab145d2c61e6a960b2e420dea98e31613281 (diff)
In "show_fragment()", use common code to put the top-level entry into
the protocol tree for the fragment, regardless of whether the fragment has any flags set or not, and, in that common code, handle fragments with 0 bytes of data specially (at least in NDS, you can get zero-length fragments - including the last fragment, so you can't just ignore those fragments; the last fragment has to be added to finish off the reassembly). svn path=/trunk/; revision=11198
Diffstat (limited to 'reassemble.c')
-rw-r--r--reassemble.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/reassemble.c b/reassemble.c
index 78c99624da..43a2c5c52e 100644
--- a/reassemble.c
+++ b/reassemble.c
@@ -1,7 +1,7 @@
/* reassemble.c
* Routines for {fragment,segment} reassembly
*
- * $Id: reassemble.c,v 1.48 2004/05/15 00:41:27 ulfl Exp $
+ * $Id: reassemble.c,v 1.49 2004/06/20 19:20:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1545,21 +1545,22 @@ static void
show_fragment(fragment_data *fd, int offset, const fragment_items *fit,
proto_tree *ft, tvbuff_t *tvb)
{
- if (fd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT
- |FD_MULTIPLETAILS|FD_TOOLONGFRAGMENT) ) {
- /* this fragment has some flags set, create a subtree
- * for it and display the flags.
- */
- proto_tree *fet=NULL;
- proto_item *fei=NULL;
- int hf;
+ proto_item *fei=NULL;
+ int hf;
- if (fd->flags & (FD_OVERLAPCONFLICT
- |FD_MULTIPLETAILS|FD_TOOLONGFRAGMENT) ) {
- hf = *(fit->hf_fragment_error);
- } else {
- hf = *(fit->hf_fragment);
- }
+ if (fd->flags & (FD_OVERLAPCONFLICT
+ |FD_MULTIPLETAILS|FD_TOOLONGFRAGMENT) ) {
+ hf = *(fit->hf_fragment_error);
+ } else {
+ hf = *(fit->hf_fragment);
+ }
+ if (fd->len == 0) {
+ fei = proto_tree_add_uint_format(ft, hf,
+ tvb, offset, fd->len,
+ fd->frame,
+ "Frame: %u (no data)",
+ fd->frame);
+ } else {
fei = proto_tree_add_uint_format(ft, hf,
tvb, offset, fd->len,
fd->frame,
@@ -1567,8 +1568,16 @@ show_fragment(fragment_data *fd, int offset, const fragment_items *fit,
fd->frame,
offset,
offset+fd->len-1,
- fd->len);
- PROTO_ITEM_SET_GENERATED(fei);
+ fd->len);
+ }
+ PROTO_ITEM_SET_GENERATED(fei);
+ if (fd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT
+ |FD_MULTIPLETAILS|FD_TOOLONGFRAGMENT) ) {
+ /* this fragment has some flags set, create a subtree
+ * for it and display the flags.
+ */
+ proto_tree *fet=NULL;
+
fet = proto_item_add_subtree(fei, *(fit->ett_fragment));
if (fd->flags&FD_OVERLAP) {
fei=proto_tree_add_boolean(fet,
@@ -1598,19 +1607,6 @@ show_fragment(fragment_data *fd, int offset, const fragment_items *fit,
TRUE);
PROTO_ITEM_SET_GENERATED(fei);
}
- } else {
- proto_item *fei;
- /* nothing of interest for this fragment */
- fei=proto_tree_add_uint_format(ft, *(fit->hf_fragment),
- tvb, offset, fd->len,
- fd->frame,
- "Frame: %u, payload: %u-%u (%u bytes)",
- fd->frame,
- offset,
- offset+fd->len-1,
- fd->len
- );
- PROTO_ITEM_SET_GENERATED(fei);
}
}