aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ip.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-04-20 08:06:01 +0000
committerGuy Harris <guy@alum.mit.edu>2003-04-20 08:06:01 +0000
commit87dfb09b12cd9d0df1ed278594fb376fb95f769b (patch)
treefef3d18705b10ba52c1f99b6300a70d6d4b7882d /packet-ip.c
parent56cd2c741b4e2250006fe2e1186becf535ddfc72 (diff)
Pull much of the processing done after a call to "fragment_add_check()"
into a subroutine, for use in other dissectors. Use it in the IPv6 and CLNP dissectors. svn path=/trunk/; revision=7510
Diffstat (limited to 'packet-ip.c')
-rw-r--r--packet-ip.c65
1 files changed, 4 insertions, 61 deletions
diff --git a/packet-ip.c b/packet-ip.c
index 170b49c820..84d298ae09 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.188 2003/04/20 00:11:28 guy Exp $
+ * $Id: packet-ip.c,v 1.189 2003/04/20 08:06:00 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1033,66 +1033,9 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(iph->ip_off & IP_OFFSET)*8,
pinfo->iplen - pinfo->iphdrlen,
iph->ip_off & IP_MF);
-
- if (ipfd_head != NULL) {
- /*
- * XXX - Now that we're using "fragment_add_check()", so that we don't
- * get confused by reused IP IDs, reassembled fragments are
- * hashed by the number of the frame in whch they're reassembled, so
- * the only one of the frames for which we'll get the frame info
- * is the one in which it's reassembled.
- *
- * That means we can't put the "reassembled in" information into the
- * protocol tree or Info column for packets other than the last
- * fragment. In order to do that, we'd need to hash the entry into
- * the hash table multiple times - or retroactively attach the
- * entry to all the other frames with, say, "p_add_proto_data()"
- * and use that. (That could only be done by the reassembly code
- * in "reassemble.c" if we either guaranteed that no protocol
- * doing reassembly attached its own per-protocol data or if
- * we added another list of reassembly data to all frames, growing
- * the per-frame overhead by one pointer.)
- *
- * Note that putting it into the Info column doesn't work when
- * the file is read in or reprocessed; it works only when the
- * capture is filtered. If we switch to a scheme in which the
- * column text is generated on the fly, by having the column
- * list widget get the text to draw by calling back to a routine
- * that would read and re-dissect the packet, that problem would
- * go away, although doing so without running the risk of dragging
- * the scroll bar causing stalls requires fast random access even
- * to gzipped files and fast generation of protocol trees. The
- * former can probably be done by saving the string dictionary at
- * "checkpoint" locations; the latter may require that we build
- * protocol trees using our own code, as "g_node_append()" is
- * linear in the length of the list to which it's appending.)
- */
- if (pinfo->fd->num == ipfd_head->reassembled_in) {
- /* 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, next_tvb, "Reassembled IPv4");
-
- /* show all fragments */
- update_col_info = !show_fragment_tree(ipfd_head, &ip_frag_items,
- ip_tree, pinfo, next_tvb);
- } else {
- /* We don't have the complete reassembled payload. */
- next_tvb = NULL;
- proto_tree_add_uint(ip_tree, hf_ip_reassembled_in, tvb, 0, 0, ipfd_head->reassembled_in);
- }
- } else {
- /* We don't have the complete reassembled payload. */
- next_tvb = NULL;
- }
+ next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled IPv4",
+ ipfd_head, &ip_frag_items, hf_ip_reassembled_in, &update_col_info,
+ ip_tree);
} else {
/* If this is the first fragment, dissect its contents, otherwise
just show it as a fragment.