Commit Graph

32 Commits

Author SHA1 Message Date
Guy Harris d735ac10cc The first element in a fragment list isn't a fragment, it's a special
entry for the reassembled packet; don't look at it when checking to see
if we've already seen a fragment (its "frame" field isn't initialized,
so we shouldn't check it in any case).

svn path=/trunk/; revision=7498
2003-04-19 09:42:53 +00:00
Ronnie Sahlberg 379298f77f Add a small extra check in fragment_add() to make it idempotent.
This solves a problem introduced by the recent rewrite of dcerpc-over-smb
reassembly which caused the last fragment for each dcerpc pdu to be duplicated and flagged as overlapping fragment.

This

svn path=/trunk/; revision=7478
2003-04-17 10:31:35 +00:00
Ronnie Sahlberg 90a6dc4ea0 Added new field reassembled_in to the fragment data structure.
This field gets set to the frame number when this pdu was first completely reassembled.

This is useful since it will allow us to do reassembly properly in say packet-ip.c
instead of printing the full pdu for every fragment and thus making NFSoverUDP  rpc-rtt statistics less than useful.

A dissector using fragment_add() can tehn choose to only dissect the reassembled PDU only for the frame where it was first reassembled.

svn path=/trunk/; revision=7427
2003-04-09 09:04:08 +00:00
Guy Harris 9db95664d1 When deciding whether we have enough data in a lower-level packet to
attempt reassembly of a higher-level packet that includes the
lower-level packet, use "tvb_bytes_exist()" to check whether all the
data that's to be included in the reassembly is available, rather than
by checking whether the packet is short.

Add some checks of that sort that were missing.

Use the reported length of the packet when doing reassembly.

Make the "iphdrlen" field of a "packet_info" structure be the length of
the IP header in bytes, not in 4-byte words.

svn path=/trunk/; revision=7274
2003-03-04 06:47:10 +00:00
Ronnie Sahlberg e4633bc783 Update reassemble.c/show_item and all callers to use FT_FRAMENUM for the list of packets corresponding to a reassembled pdu
svn path=/trunk/; revision=6807
2002-12-19 11:22:38 +00:00
Guy Harris 59932f2722 Don't cast away constness, and fix variable and structure member
qualifiers as necessary to ensure that we don't have to.

"strcmp()", "strcasecmp()", and "memcmp()" don't return booleans; don't
test their results as if they did.

Use "guint8", not "guchar", for a pointer to (one or more) 8-bit bytes.

Update Michael Tuexen's e-mail address.

svn path=/trunk/; revision=6726
2002-12-02 23:43:30 +00:00
Guy Harris 07d0032f1c Add a "fragment_add_seq_next()" to reassemble fragments that don't have
sequence numbers or offsets and are thus assumed to be received in order
with no duplicates or dropped fragments (e.g., for NetBIOS Frame, where
802.2 LLC guarantees in-order delivery to NetBIOS with no duplicates or
dropped fragments).

"show_fragment_tree()' and "show_fragment_seq_tree()" don't modify the
"fragment_items" to which the "fit" argument points, so make that
argument a "const fragment_items *".

Make all the "fragment_items" tables "static" (as they're not used
outside the modules defining them) and "const" (as they're not
modified).

Add support for reassembly of NetBIOS fragmented requests and responses.

Get rid of an unnecessary include of "packet-tr.c" in the NetBIOS
dissector, and make its table of dissection function pointers static.

Fix some typos in the AppleTalk and NetBIOS dissectors.

svn path=/trunk/; revision=6491
2002-10-24 06:17:36 +00:00
Guy Harris 18dd6eff9e Flag fragment overlaps when reassembling based on sequence number, and,
when displaying the fragment tree for reassembly based on sequence
number, show the correct offset.

svn path=/trunk/; revision=6448
2002-10-17 21:14:17 +00:00
Guy Harris 3618a128a6 Put in a missing check for fragment overlaps, and add an assertion to
check for bogus dfpos values before using the value.

svn path=/trunk/; revision=6447
2002-10-17 20:51:35 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Guy Harris 88e6717f51 Don't check for a short frame until we care whether the frame is short;
that lets us get rid of a variable.

svn path=/trunk/; revision=5689
2002-06-17 01:12:13 +00:00
Guy Harris 41846edc8b Put the stuff to add the "Illegal {fragment,segment}" item to the Info
column, and to return TRUE or FALSE, depending on whether there were any
reassembly errors, in a common routine.

svn path=/trunk/; revision=5645
2002-06-07 10:17:21 +00:00
Guy Harris 4f9508837a Add "show_fragment_seq_tree()", which is like "show_fragment_tree()",
but for stuff reassembled with "fragment_add_seq()" or
"fragment_add_seq_check()".

Add a "fragment tag" string to the "fragment_items", so that packets
with fragmentation errors can be properly flagged as having "Illegal
fragments" or "Illegal segments" depending on the term used with the
protocol in question.

Make all the dissectors that can use "show_fragment_tree()" or
"show_fragment_seq_tree()", and don't already use them, do so.

svn path=/trunk/; revision=5644
2002-06-07 10:11:41 +00:00
Ronnie Sahlberg 31823cb851 Added show_fragment_tree() to reassemble. This function will do the common
task of creating a fregment tree for the fragmented packets.
Having this identical code to create this tree in every dissector that does
PDU reassembly is a huge waste and duplication of code.

Updated IP, SMB and DCERPC to use the new function.

svn path=/trunk/; revision=5626
2002-06-05 11:21:49 +00:00
Ronnie Sahlberg 2031280796 Reassembly of fragmented DCE/RPC (only for connection oriented DCE/RPC).
svn path=/trunk/; revision=5548
2002-05-24 11:51:14 +00:00
Guy Harris 1408767b75 "fragment_add_seq_work()" returns a Boolean value, not a pointer, so
have it return FALSE, not NULL.

svn path=/trunk/; revision=5249
2002-04-25 21:28:15 +00:00
Guy Harris d215b73503 Get rid of some unused variables and arguments.
svn path=/trunk/; revision=5221
2002-04-22 08:14:12 +00:00
Guy Harris faeb2c2ee1 In "fragment_add_seq_check()", handle short frames the same way
regardless of whether they're the first frame we see in a reassembly or
not - put all but the last fragment into the hash table (so subsequent
frames with the same reassembly ID don't get misdissected as
unfragmented frames), return the head of the fragment list for the first
fragment and NULL for all other fragments (so the first fragment gets
dissected as a fragmented packet), and unhash the fragment head from the
reassembly hash table when we see the last fragment.

svn path=/trunk/; revision=5189
2002-04-17 10:59:58 +00:00
Guy Harris b2c11b5e13 Don't try to reassemble short frames - but do still pass them through at
least some of the reassembly mechanism, so we can deal with both bogus
and real last fragment (display the bogus ones as unfragmented frames,
treat the real ones as fragments).

svn path=/trunk/; revision=5186
2002-04-17 10:07:57 +00:00
Guy Harris e76bb99b9f Don't bother with "reassembled_key" structures - just use the
"frame_data" structure for the frame as the key structure, and use the
frame number in that field as the key.  (We could be even cheesier and
use the frame number as the key, with casts.)

When we move an entry from the hash table of reassemblies to the hash
table of reassembled packets, free the key structure for the first hash
table.  (This doesn't plug a leak, as they get freed when you
reinitialize the data structures, but it does reduce the memory needed
for them to the amount needed for in-progress reassemblies rather than
the amount needed for all reassemblies.)

svn path=/trunk/; revision=5180
2002-04-17 08:57:07 +00:00
Guy Harris ed3b0cae65 Add a separate hash table to the reassembly code for reassembled
packets, using the reassembly ID and the frame number of the final frame
as the key.  There is no guarantee that reassembly IDs won't be reused,
even when talking between the same source and destination address; if,
once reassembly is complete, the "fragment_data" structure is moved to
the latter hash table, this will keep reused reassembly IDs from causing
mis-reassembly.

Add a routine "fragment_add_seq_check()", which

	if a fragment has the "more fragments" flag not set but is the
	first fragment of a reassembly, treats that as a non-fragmented
	frame, allocating a "fragment_data" structure for the reassembly
	but not attaching any fragment to it, and adding it to a
	reassembled packet list;

	if a packet has been reassembled, removes it from the table of
	reassemblies and moves it to the table of reassembled packets;

	if the frame's been seen already, looks it up in the table of
	reassembled packets rather than the table of reassemblies.

Add reassembly support for fragmented 802.11 frames.  Use
"fragment_add_seq_check()" to cope with the fact that some
hardware+drivers apparently hands us reassembled frames with a non-zero
fragment number and the "more fragments" bit clear (as if it puts the
802.11 header of the *last* fragment onto the reassembled data).

svn path=/trunk/; revision=5177
2002-04-17 08:25:05 +00:00
Guy Harris f5880dd3bd Rename the "frag_offset" argument of "fragment_add_seq()" to
"frag_number", to make it clearer that it's not a byte offset but a
sequence number.

svn path=/trunk/; revision=5175
2002-04-17 04:54:30 +00:00
Guy Harris 2eb1990b0b From Joerg Mayer: mark function arguments as unused.
svn path=/trunk/; revision=5052
2002-03-31 21:05:47 +00:00
Guy Harris 6d55906750 From Ricardo Barroetave�a: support dissectors that are handed
reassembled TCP data being able to indicate that they need still more
reassembly, so that, for example, a dissector can indicate that it needs
reassembly in order to dissect a header that says how long the PDU is
and, when that reassembly is done and it dissects the header, it can
then indicate that it needs more reassembly to get the entire PDU.

svn path=/trunk/; revision=4694
2002-02-03 23:28:38 +00:00
Guy Harris ee5ca25d31 Include files from the "epan" directory and subdirectories thereof with
"epan/..." pathnames, so as to avoid collisions with header files in any
of the directories in which we look (e.g., "proto.h", as some other
package has its own "proto.h" file which it installs in the top-level
include directory).

Don't add "-I" flags to search "epan", as that's no longer necessary
(and we want includes of "epan" headers to fail if the "epan/" is left
out, so that we don't re-introduce includes lacking "epan/").

svn path=/trunk/; revision=4586
2002-01-21 07:37:49 +00:00
Guy Harris 8ee4e324f5 WTP reassembly, from Tom Uijldert.
svn path=/trunk/; revision=4480
2002-01-04 20:20:08 +00:00
Guy Harris c139b9138a From Ronnie Sahlberg: new infrastructure to reassemble packets where
fragments are identified by block sequence numbers and not byte offsets.

svn path=/trunk/; revision=4398
2001-12-15 05:40:32 +00:00
Guy Harris ac16b7463b Assorted changes from Ronnie Sahlberg:
Add a few small functions to reassemble.c to cope with protocols
	where the total length of defragmented PDUs are specified in the
	first fragment (all previous uses of reassembly has been for
	PDUs where the last fragment is signalled by a flag in the
	header for the last fragment).

	Add a few small functions to reassemble.c to abort-and-delete
	defragmentation of PDUs and also detect IF a PDU is currently
	being defragmented.  (Useful for PDUs where the "unique"
	identifier is rather ununique, or may be reused often enough so
	it can be a problem for Ethereal.)

	Change where NT Cancel presents its Cancelation-to output, and
	makes the three trans secondary requests also output similar
	information.

svn path=/trunk/; revision=4255
2001-11-24 09:36:40 +00:00
Guy Harris 10da28737f Get rid of some unused variables.
svn path=/trunk/; revision=4240
2001-11-21 01:21:08 +00:00
Guy Harris 2a148564d6 TCP desegmentation support, and changes to the ONC RPC and NBSS
dissectors to use it, from Ronnie Sahlberg, with additional changes to
handle the case where a frame contains messages that don't run past the
end followed by one that does and where a reassembled chunk has, at the
end, a message that runs past the end of that chunk (because the
reassembly was for an earlier message).

svn path=/trunk/; revision=3923
2001-09-13 07:56:53 +00:00
Guy Harris aca26c6f02 Include <string.h> to get "memcmp()" and "memcpy()" declared.
svn path=/trunk/; revision=3619
2001-06-28 19:15:11 +00:00
Guy Harris c9da803a08 Move the fragment reassembly code into "reassemble.c" and
"reassemble.h", and remove IPv4 dependencies from it.

Use it for OSI CLNP segment reassembly as well.

svn path=/trunk/; revision=3525
2001-06-08 06:27:16 +00:00