Commit Graph

116 Commits

Author SHA1 Message Date
Guy Harris b73e8138a8 Make the CRC-32 routines take a tvbuff and a length as arguments.
Rename "crc32()" so as not to collide with the one in zlib; rename
"crc32_802()" to match.

svn path=/trunk/; revision=8268
2003-08-26 06:18:18 +00:00
Guy Harris f7e3062867 From Jesper Peterson:
Extract the FCS decoding section of the PPP_HDLC dissector to
	allow the CHDLC dissector to use the same routine.

	The ppp_options used for preferences has been renamed to
	fcs_options and exported via packet-ppp.h so CHDLC gets a
	separate (but identical) FCS preference.

	This means prefs.h has to be included before packet-ppp.h so a
	couple of ppp related files (packet-{gtp,null,raw,vj}.c) had
	their includes slightly re-arranged.

From me: make the PPP/CHDLC FCS code use "crc32()" to check the 32-bit
FCS.

svn path=/trunk/; revision=8266
2003-08-26 05:52:53 +00:00
Guy Harris 0c88f96ca0 Add a routine "dissect_ipv6_options()" that works like
"dissect_ip_tcp_options()" but for options that are like IPv6 options
(i.e., the length byte has a value that doesn't include the option code
or length byte).

Add an "ip_opts.h" header to declare it, and move the declaration of
stuff used by it and "dissect_ip_tcp_options()", and the declaration of
"dissect_ip_tcp_options()", to that header.

Use "dissect_ipv6_options()" for Mobile IPv6 options.

Get rid of the unused "mip6_opt_types[]" array in "packet-mip6.h".

svn path=/trunk/; revision=8015
2003-07-11 09:30:49 +00:00
Guy Harris eecc575e23 "tvb_format_text()" should be able to handle a length argument of 0.
svn path=/trunk/; revision=7871
2003-06-13 04:07:13 +00:00
Guy Harris ee97ce3196 Add new routines:
tvb_get_string() - takes a tvbuff, an offset, and a length as
	arguments, allocates a buffer big enough to hold a string with
	the specified number of bytes plus an added null terminator
	(i.e., length+1), copies the specified number of bytes from the
	tvbuff, at the specified offset, to that buffer and puts in a
	null terminator, and returns a pointer to that buffer (or throws
	an exception before allocating the buffer if that many bytes
	aren't available in the tvbuff);

	tvb_get_stringz() - takes a tvbuff, an offset, and a pointer to
	a "gint" as arguments, gets the size of the null-terminated
	string starting at the specified offset in the tvbuff (throwing
	an exception if the null terminator isn't found), allocates a
	buffer big enough to hold that string, copies the string to that
	buffer, and returns a pointer to that buffer and stores the
	length of the string (including the terminating null) in the
	variable pointed to by the "gint" pointer.

Replace many pieces of code allocating a buffer and copying a string
with calls to "tvb_get_string()" (for one thing, "tvb_get_string()"
doesn't require you to remember that the argument to
"tvb_get_nstringz0()" is the size of the buffer into which you're
copying the string, which might be the length of the string to be copied
*plus 1*).

Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string).  Use "tvb_get_stringz()", instead.

In some cases where a value is fetched but is only used to pass an
argument to a "proto_tree_add_XXX" routine, use "proto_tree_add_item()"
instead.

svn path=/trunk/; revision=7859
2003-06-12 08:33:32 +00:00
Gerald Combs 7a132e5b48 More tvb_get_nstringz0() fixes. Timo Sirainen pointed out that Bad
Things can happen if we pass a zero buffer length to tvb_get_nstringz0().
Throw an exception if this happens.

In various dissectors make sure the tvb_get_nstringz0()'s buffer length
is greater than zero.

svn path=/trunk/; revision=7688
2003-05-19 03:23:12 +00:00
Guy Harris daeac95d4a Don't export "osinl_subdissector_table" or "ppp_subdissector_table" -
have other dissectors that use them fetch them with
"find_dissector_table()".

svn path=/trunk/; revision=7601
2003-04-29 17:56:49 +00:00
Gerald Combs b2f936ff24 Fix several buffer and integer overflow issues discovered by Timo Sirainen.
tvbuff.c:

  Lots of existing code assumes that you can safely do the following:

    #define MAX_BUF 64
    guint8 *buf[MAX_BUF];
    ...

    tvb_get_nstringz0 (tvb, offset, MAX_BUF, buf, &bytes_copied);

  In reality, tvb_get_nstringz*() can potentially write one byte past
  "buf".  Modify _tvb_get_nstringz() not to do that.

packet-ppp.c:

  Check for a valid BAP suboption length.

packet-mount.c:

  Fix a possible integer overflow in dissect_group().

svn path=/trunk/; revision=7590
2003-04-28 04:03:26 +00:00
Guy Harris 6be6afeb1c From Thierry Pelle: updates (use the correct RFC 2472 term - "interface
identifier", not "interface token" - and print the octets of the
interface identifier with zero padding).

svn path=/trunk/; revision=7094
2003-02-07 20:09:33 +00:00
Guy Harris 231f28ce08 Panic if a preference starts with the name of the module to which it
belongs, as that's redundant.

Fix a bunch of cases where that was done, and map the old name to the
new name.

Instead of marking "mtp3.mtp3_standard" as obsolete, map it to
"mtp3.standard".

svn path=/trunk/; revision=7030
2003-01-28 23:56:40 +00:00
Guy Harris 6c4a845613 Move into "call_dissector_work()" the stuff to handle dissecting, in
error packets, the copy of the packet that got the error, rather than
doing it in the CLNP dissector and the ICMP dissector and the ICMPv6
dissector and the PPP dissector for various control protocols; have it
do that work iff "pinfo->in_error_pkt" is set.

svn path=/trunk/; revision=6942
2003-01-20 05:42:37 +00:00
Guy Harris 88c45369fb If we have packet direction information, display it.
svn path=/trunk/; revision=6861
2003-01-06 22:33:57 +00:00
Guy Harris 64c6541346 I must've been on drugs when I checked in revision 1.56; put in the
"return" that should've been there, so we don't try to dissect Cisco
HDLC frames as PPP after having finished dissecting them as Cisco HDLC.

svn path=/trunk/; revision=6844
2003-01-03 19:40:25 +00:00
Guy Harris 2022534826 From Andreas Trauer: dissect the L2TP AVPs Initial Received LCP CONFREQ,
Last Received LCP CONFREQ, Last Sent LCP CONFREQ, and correct some AVP
names.

svn path=/trunk/; revision=6779
2002-12-11 19:59:08 +00:00
Guy Harris 85fd3afd2f Before dissecting the payload of a Protocol-Reject LCP packet, save the
current "this is an error packet" flag and set that flag, so the payload
is dissected as the payload of an error packet rather than as a "real"
packet.

svn path=/trunk/; revision=6701
2002-11-28 22:18:53 +00:00
Guy Harris ca642e12ba From Pasi Eronen: dissect the packet inside an LCP Protocol Reject message.
svn path=/trunk/; revision=6698
2002-11-28 20:48:14 +00:00
Guy Harris 5ae19d6256 Instead of tweaking a "Protocol configuration options" extension header
item to look more-or-less like a PPP packet, just dissect it in place
and hand off to the appropriate subdissector using the PPP dissector's
handoff table (which we export, along with its value_string table for
protocol IDs, which we use to report the protocol ID symbolically).

This means there's no point in having a configurable option to control
whether to do that tweaking; make it an obsolete option.

Bring "col_get_writable()" back from the dead, and have the GTP
dissector save the current "writable" flag for columns, mark the columns
non-writable before calling the subdissector for the PPP configuration
protocol, and restore the state of the writable flag, rather than
putting the columns back after the PPP configuration protocol's
dissector is done.

Fix some more typos in comments.

Don't register the IP dissector in the "ppp.protocol" table in the GTP
dissector's handoff registration routine - it's already being done in
the IP dissector's handoff routine.

Fix the name for CHAP to match what RFC 1994 calls it (if the name
changed, it should be changed in all places, but, at least according to
this message, a while ago, from Bob Sutterfield, "since the RFC defines
the protocol, the RFC defines the name":

	http://mail-index.netbsd.org/netbsd-help/1996/05/16/0011.html

and the RFC defines the name as "PPP Challenge Handshake Authentication
Protocol (CHAP)").

svn path=/trunk/; revision=6617
2002-11-11 19:23:14 +00:00
Gerald Combs 00e907e211 Register (and initialize) ett_mplscp_options and ett_cdpcp_options. Fix
some indentation inconsistencies.

svn path=/trunk/; revision=6557
2002-11-04 03:57:34 +00:00
Guy Harris e0a7988e6d From Thierry Pelle: IPv6CP support.
svn path=/trunk/; revision=6419
2002-10-14 23:23:20 +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
Gerald Combs 50dfd3eb31 From ENDOH Akira:
- displaying PPP datalink layer protocol names based on iana database:
    http://www.iana.org/assignments/ppp-numbers
- dissecting MPLSCP and CDPCP
- dissecting CDP over PPP

svn path=/trunk/; revision=6011
2002-08-18 15:30:38 +00:00
Guy Harris a2d0f1fa49 From Hidetaka Ogawa: fix PPP FCS computation to include address and
control field if present.

Add Sergei Shokhor to the contributor list in the Ethereal man page.

svn path=/trunk/; revision=5949
2002-08-04 08:44:31 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris cbe8deb189 Fix a typo.
svn path=/trunk/; revision=5521
2002-05-22 09:52:14 +00:00
Guy Harris 44580a93ca Don't include the FCS in the tvbuff handed to "dissect_ppp_common()", so
that it's not included in the tvbuff handed to subdissectors.  Use that
tvbuff to compute the FCS.

Properly handle the FCS in frames that don't include all the captured
data.

In VJ-compressed packets, put the VJ compression information into the
protocol tree, and set the Protocol and Info columns, and don't worry
about the CRC - as per the above, it's no longer in the tvbuff (and
never *was* in the tvbuff in some cases).

Also, clean up some other stuff in the VJ dissector.

svn path=/trunk/; revision=5510
2002-05-20 00:56:30 +00:00
Guy Harris 8a5d5f9bde From Joerg Mayer: get rid of extra arguments to capture routines.
svn path=/trunk/; revision=5233
2002-04-24 06:03:34 +00:00
Guy Harris db31932941 From Joerg Mayer:
Declares some variables static.

	Creates a new include file packet-rsvp.h, and make use of it
	(change some extern decls to #inlcude).

	Move the file packet-pgm.h into packet-pgm.c as it is not used
	by anything outside packet-pgm.c.

svn path=/trunk/; revision=5162
2002-04-14 23:04:04 +00:00
Guy Harris d1f2aaf8ac Get rid of ett_ values for options with no subtrees.
Show the names of the control characters being mapped by the async
control character map option.

Use "proto_item_add_subtree()" to establish a subtree, so that the ett_
value gets associated with it.  (Unfortunately, "proto_item" and
"proto_tree" are typedefs for the same type, so checks for use of one
when you should be using the other aren't done at compile time.)

Get rid of some extra blanks before colons.

svn path=/trunk/; revision=5067
2002-04-01 00:51:43 +00:00
Guy Harris 57294d193a Mark unused variables with _U_ if they can't be eliminated.
Use the "optp" argument in more option dissectors, and set the name of
the option in the table entries for those options - and for one option
where that name *was* being used.

Get rid of unused variables.

svn path=/trunk/; revision=5061
2002-03-31 22:37:09 +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 92915713d3 Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff".  This can be used if

	1) the item covers the entire packet or the remaining payload in
	   the packet

or

	2) the item's length won't be known until it's dissected, and
	   will be then set with "proto_item_set_len()" - if an
	   exception is thrown in the dissection, it means the item ran
	   *past* the end of the tvbuff, so saying it runs to the end of
	   the tvbuff is reasonable.

Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).

In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).

Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.

Fix some indentation.

svn path=/trunk/; revision=4578
2002-01-20 22:12:39 +00:00
Guy Harris 45dc78bd7d Support for BSD Compress, MVRCA, and Deflate compression options in
CCP, from Motonori Shindo.

svn path=/trunk/; revision=4530
2002-01-11 21:37:10 +00:00
Guy Harris c57411dbb9 PPP multiplexing support, from Jayaram V.R.
svn path=/trunk/; revision=4469
2002-01-03 20:30:33 +00:00
Guy Harris b9de49243d Make the address and control fields in the PPP/HDLC header, and the
protocol field in the PPP header, filterable fields.

Show the FCS value with a leading "0x".

svn path=/trunk/; revision=4430
2001-12-20 06:22:24 +00:00
Guy Harris 3624071a79 Van Jacobson decompression support for PPP, from Irfan Khan.
svn path=/trunk/; revision=4427
2001-12-19 21:14:49 +00:00
Guy Harris 23319ff023 Move the pointer to the "column_info" structure in the "frame_data"
structure to the "packet_info" structure; only stuff that's permanently
stored with each frame should be in the "frame_data" structure, and the
"column_info" structure is not guaranteed to hold the column values for
that frame at all times - it was only in the "frame_data" structure so
that it could be passed to dissectors, and, as all dissectors are now
passed a pointer to a "packet_info" structure, it could just as well be
put in the "packet_info" structure.

That saves memory, by shrinking the "frame_data" structure (there's one
of those per frame), and also lets us clean up the code a bit.

svn path=/trunk/; revision=4370
2001-12-10 00:26:21 +00:00
Guy Harris 75cc056222 Attach a descriptive name field type and base to dissector tables; that
specifies how the selector values used as keys in those tables are to be
displayed, and the title to use when displaying the table.

Use that information in the code to display the initial and current
entries of various dissector tables.

Have the dissector for BACnet APDUs register itself by name, and have
the BACnet NPDU dissector call it iff the BAC_CONTROL_NET bit isn't set,
rather than doing it with a dissector table.

svn path=/trunk/; revision=4358
2001-12-08 06:41:48 +00:00
Guy Harris 3af8644dac BACP and BAP support in PPP dissector, from Motonori Shindo.
svn path=/trunk/; revision=4356
2001-12-08 01:03:19 +00:00
Guy Harris bced8711f6 Make "dissector_add()", "dissector_delete()", and "dissector_change()"
take a dissector handle as an argument, rather than a pointer to a
dissector function and a protocol ID.  Associate dissector handles with
dissector table entries.

svn path=/trunk/; revision=4308
2001-12-03 04:00:26 +00:00
Ed Warnicke 34dbc86e65 Moved from using dissect_data to using call_dissector()
svn path=/trunk/; revision=4264
2001-11-25 22:51:14 +00:00
Guy Harris 60fe401dc7 Get rid of some unused variables.
svn path=/trunk/; revision=4241
2001-11-21 02:01:06 +00:00
Guy Harris e8d4f4f0ac Make the capture routines take an additional argument giving the amount
of packet data captured.

Make the "BYTES_ARE_IN_FRAME()" macro take a "captured length of the
packet" argument.

Add some length checks to capture routines.

svn path=/trunk/; revision=4235
2001-11-20 21:59:18 +00:00
Guy Harris a4676104d9 CBCP support in PPP, from Motonori Shindo.
svn path=/trunk/; revision=4153
2001-11-04 04:50:12 +00:00
Guy Harris 493f2a8279 Small fix to previous patch, from Motonori Shindo.
svn path=/trunk/; revision=4106
2001-10-30 10:16:51 +00:00
Guy Harris e5276cd0b4 PPP CCP support, from Motonori Shindo.
svn path=/trunk/; revision=4096
2001-10-29 19:48:45 +00:00
Richard Sharpe ed5e9c9768 Committing Montonori Shindo's patched to ppp for chap support.
svn path=/trunk/; revision=3979
2001-09-30 13:30:51 +00:00
Guy Harris 170d538f16 Patch from Motonori Shindo to add support for decoding additional data,
for CHAP, in LCP Authentication Protocol option.

Fix a typo.

svn path=/trunk/; revision=3827
2001-08-05 19:44:13 +00:00
Guy Harris 74fb14adac Patch from Motonori Shindo, adding
1) Shiva PAP (SPAP) and Extensible Authentication Protocol (EAP)

 2) CBCP negotiation in LCP Callback Operation Field

to the PPP dissector.

svn path=/trunk/; revision=3826
2001-08-05 10:09:40 +00:00
Guy Harris 8412393197 From Joerg Mayer: explicitly fill in all members of a
"header_field_info" structure, including the ones that are later set by
the routines to register fields.

svn path=/trunk/; revision=3561
2001-06-18 02:18:27 +00:00
Guy Harris 07bdfa61bc Set the Protocol column in dissectors for PPP-specific subprotocols.
svn path=/trunk/; revision=3556
2001-06-16 00:51:45 +00:00