Commit Graph

78 Commits

Author SHA1 Message Date
Guy Harris 8efd8ae819 Add support for TXT and WKS records to the DNS dissector.
Add EIGRP and VINES to the list of protocols "ipprotostr()" knows about.

Get rid of the "proto_vals" table in "packet-ip.c" - it's not used, and
the two entries it had that weren't in the table in "ipproto.c" have
been moved there.

svn path=/trunk/; revision=1735
2000-03-21 05:15:12 +00:00
Guy Harris 8a7bae9ab4 Put the EIGRP packet type into the INFO column in the packet list entry
for an EIGRP packet.

svn path=/trunk/; revision=1726
2000-03-16 08:23:21 +00:00
Gilbert Ramirez f6e92a9e93 Break proto_tree_add_item_format() into multiple functions:
proto_tree_add_protocol_format()
	proto_tree_add_uint_format()
	proto_tree_add_ipxnet_format()
	proto_tree_add_ipv4_format()
	proto_tree_add_ipv6_format()
	proto_tree_add_bytes_format()
	proto_tree_add_string_format()
	proto_tree_add_ether_format()
	proto_tree_add_time_format()
	proto_tree_add_double_format()
	proto_tree_add_boolean_format()
If using GCC 2.x, we can check the print-format against the variable args
passed in. Regardless of compiler, we can now check at run-time that the
field type passed into the function corresponds to what that function
expects (FT_UINT, FT_BOOLEAN, etc.)

Note that proto_tree_add_protocol_format() does not require a value field,
since the value of a protocol is always NULL. It's more intuitive w/o the
vestigial argument.

Fixed a proto_tree_add_item_format-related bug in packet-isis-hello.c
Fixed a variable usage bug in packet-v120.c. (ett_* was used instead of hf_*)

Checked in Guy's fix for the function declearation for proto_tree_add_text()
and proto_tree_add_notext().

svn path=/trunk/; revision=1713
2000-03-12 04:48:32 +00:00
Guy Harris f249c7f2dc Fix some "proto_tree_add_text()" calls.
svn path=/trunk/; revision=1696
2000-03-07 05:28:39 +00:00
Gilbert Ramirez ddfa11e870 Create a header file for every packet-*.c file. Prune the packet.h file.
This change allows you to add a new packet-*.c file and not cause a
recompilation of everything that #include's packet.h

Add the plugin_api.[ch] files ot the plugins/Makefile.am packaging list.

Add #define YY_NO_UNPUT 1 to the lex source so that the yyunput symbol
is not defined, squelching a compiler complaint when compiling the generated
C file.

svn path=/trunk/; revision=1637
2000-02-15 21:06:58 +00:00
Gilbert Ramirez f9a8a11ef5 Integrate Ed Meaney's <emeaney@altiga.com> changes for using libpcap
from WinDump with Ethereal. We now have packet capturing on Win32. :)

svn path=/trunk/; revision=1612
2000-02-09 19:18:42 +00:00
Olivier Abad c2943128fc In dissect_ipopt_timestamp() :
Correct a bug reported by Paul Ionescu when dissecting a timestamp IP
option. The offsets where not correct.

svn path=/trunk/; revision=1596
2000-02-02 22:07:38 +00:00
Guy Harris f393a19883 Heikki Vatiainen's patch to add a flag to control whether to interpret
the IPv4 TOS field as a TOS field or as a DiffServ field, and allow that
field to be controlled by a command-line option or an option in the
"Display:Options" dialog box.

svn path=/trunk/; revision=1532
2000-01-24 04:44:58 +00:00
Guy Harris 2461d79698 In "dissect_eth()", update "pi.len" and "pi.captured_len" regardless of
whether we're building a protocol tree or not.

Make "dissect_eth()" use "BYTES_ARE_IN_FRAME()" to see if we have a full
Ethernet header - it can be called with a non-zero offset, if Ethernet
frames are encapsulated inside other frames (e.g., ATM LANE).

Make capture routines take an "offset" argument if the corresponding
dissect routine takes one (for symmetry, and for Cisco ISL or any other
protocol that encapsulates Ethernet or Token-Ring frames inside other
frames).

Pass the frame lengths to capture routines via the "pi" structure,
rather than as an in-line argument, so that they can macros such as
"BYTES_ARE_IN_FRAME()" the way the corresponding dissect routines do.

Make capture routines update "pi.len" and "pi.captured_len" the same way
the corresponding diseect routines do, if the capture routines then call
other capture routines.

Make "capture_vlan()" count as "other" frames that are too short, the
way other capture routines do.

svn path=/trunk/; revision=1525
2000-01-23 08:55:37 +00:00
Guy Harris 8e7816815f Joerg Mayer's updates to the VINES dissector and to protocol layers
above VINES.

svn path=/trunk/; revision=1514
2000-01-20 21:34:16 +00:00
Guy Harris cfb98c14c4 Get rid of the include of "util.h" that some dissectors do - it's not
necessary.

svn path=/trunk/; revision=1496
2000-01-16 02:54:49 +00:00
Gilbert Ramirez 939fa8362e Fix problem with number of format args for "option length too short".
Problem reported by James Coe <jammer@cin.net>

svn path=/trunk/; revision=1309
1999-12-13 05:09:05 +00:00
Guy Harris 537cbc8d42 Thou Shalt Not Cast Pointers Into A Packet To Pointers To Anything
Bigger Than A Byte, as there's no guarantee that the pointer is aligned
the way you'd like (consider, for example, FDDI packets, which may be
aligned on an *odd-byte* boundary).

svn path=/trunk/; revision=1268
1999-12-09 21:58:04 +00:00
Gilbert Ramirez f476cf176a Added Philip Gladstone <philip@raptor.com>'s patch to check IP header
checksum, and noted the need for user-selectable lines in the GUI tree.

svn path=/trunk/; revision=1242
1999-12-08 17:54:41 +00:00
Gilbert Ramirez 34c9f8241c Added Heikki Vatiainen's <hessu@cs.tut.fi> VRRP dissector.
svn path=/trunk/; revision=1083
1999-11-21 14:43:53 +00:00
Guy Harris d04da40cba Typo fix, from Heikki Vatiainen.
svn path=/trunk/; revision=1045
1999-11-17 01:35:57 +00:00
Guy Harris a7aba0a288 Replace the ETT_ "enum" members, declared in "packet.h", with
dynamically-assigned "ett_" integer values, assigned by
"proto_register_subtree_array()"; this:

	obviates the need to update "packet.h" whenever you add a new
	subtree type - you only have to add a call to
	"proto_register_subtree_array()" to a "register" routine and an
	array of pointers to "ett_", if they're not already there, and
	add a pointer to the new "ett_" variable to the array, if they
	are there;

	would allow run-time-loaded dissectors to allocate subtree types
	when they're loaded.

svn path=/trunk/; revision=1043
1999-11-16 11:44:20 +00:00
Guy Harris 95b1c8256e Format the IP header length as an unsigned quantity.
svn path=/trunk/; revision=965
1999-11-02 07:06:07 +00:00
Guy Harris dfab69a771 Make a bunch of the bitfields in the IP header filterable items.
svn path=/trunk/; revision=963
1999-11-02 05:38:51 +00:00
Guy Harris 149c40fec9 Don Lafontaine's IGRP/EIGRP dissector.
svn path=/trunk/; revision=949
1999-10-30 06:10:32 +00:00
Guy Harris 047b8751f3 Generalize the "ip_src" and "ip_dst" members of the "packet_info"
structure to "dl_src"/"dl_dst", "net_src"/"net_dst", and "src"/"dst"
addresses, where an address is an address type, an address length in
bytes, and a pointer to that many bytes.

"dl_{src,dst}" are the link-layer source/destination; "net_{src,dst}"
are the network-layer source/destination; "{src,dst}" are the
source/destination from the highest of those two layers that we have in
the packet.

Add a port type to "packet_info" as well, specifying whether it's a TCP
or UDP port.

Don't set the address and port columns in the dissector functions; just
set the address and port members of the "packet_info" structure.  Set
the columns in "fill_in_columns()"; this means that if we're showing
COL_{DEF,RES,UNRES}_SRC" or "COL_{DEF,RES,UNRES}_DST", we only generate
the string from "src" or "dst", we don't generate a string for the
link-layer address and then overwrite it with a string for the
network-layer address (generating those strings costs CPU).

Add support for "conversations", where a "conversation" is (at present)
a source and destination address and a source and destination port.  (In
the future, we may support "conversations" above the transport layer,
e.g. a TFTP conversation, where the first packet goes from the client to
the TFTP server port, but the reply comes back from a different port,
and all subsequent packets go between the client address/port and the
server address/new port, or an NFS conversation, which might include
lock manager, status monitor, and mount packets, as well as NFS
packets.)

Currently, all we support is a call that takes the source and
destination address/port pairs, looks them up in a hash table, and:

	if nothing is found, creates a new entry in the hash table, and
	assigns it a unique 32-bit conversation ID, and returns that
	conversation ID;

	if an entry is found, returns its conversation ID.

Use that in the SMB and AFS code to keep track of individual SMB or AFS
conversations.  We need to match up requests and replies, as, for
certain replies, the operation code for the request to which it's a
reply doesn't show up in the reply - you have to find the request with a
matching transaction ID.  Transaction IDs are per-conversation, so the
hash table for requests should include a conversation ID and transaction
ID as the key.

This allows SMB and AFS decoders to handle IPv4 or IPv6 addresses
transparently (and should allow the SMB decoder to handle NetBIOS atop
other protocols as well, if the source and destination address and port
values in the "packet_info" structure are set appropriately).

In the "Follow TCP Connection" code, check to make sure that the
addresses are IPv4 addressses; ultimately, that code should be changed
to use the conversation code instead, which will let it handle IPv6
transparently.

svn path=/trunk/; revision=909
1999-10-22 07:18:23 +00:00
Guy Harris 2d16674a5a Check to make sure the header length is at least the minimum length for
an IP header.

svn path=/trunk/; revision=906
1999-10-22 03:52:06 +00:00
Laurent Deniel 04f4b3c10b - replace proto_tree_add_item_format by proto_tree_add_item.
- fix hf_ip_len type field (FT_UINT16).

svn path=/trunk/; revision=866
1999-10-16 20:59:03 +00:00
Jun-ichiro itojun Hagino 33d11fff97 IPComp (RFC2393) decoding.
svn path=/trunk/; revision=838
1999-10-15 05:30:43 +00:00
Jun-ichiro itojun Hagino d856a9cee2 add string IP protocol name into info field of fragmented packet.
svn path=/trunk/; revision=833
1999-10-14 16:46:55 +00:00
Jun-ichiro itojun Hagino 810a67a6d0 implement ipprotostr() in ipproto.c, which basically does ipprotobynumber()
for ip.ip_p and ip6.ip6_nxt (and other IPv6 header chain).

use val_to_str() as much as possible in dissect_{ipv6,pim,ripng}().

make --disable-zlib a default for netbsd (temporary workaround).

svn path=/trunk/; revision=827
1999-10-14 03:50:51 +00:00
Guy Harris 93d58bf824 Jun-ichiro itojun Hagino's code for PIM, and some fixes from him as
well.

Add some more protocols to the list of value/string pairs for IP
protocol types.

svn path=/trunk/; revision=822
1999-10-13 06:47:49 +00:00
Gilbert Ramirez bacb9d5bae New proto_tree header_field_info stuff. Header_field_infos now contain
the base for numbers to be displayed in, bitmasks for bitfields, and blurbs
(which are one or two sentences describing the field).

proto_tree_add*() routines now automatically handle bitfields. You tell
it which header field you are adding, and just pass it the value of the
entire field, and the proto_tree routines will do the masking and shifting
for you.

This means that bitfields are more naturally filtered via dfilter now.

Added Phil Techau's support for signed integers in dfilters/proto_tree.

Added the beginning of the SNA dissector. It's not complete, but I'm
committing it now because it has example after example of how to use
bitfields with the new header_field_info struct and proto_tree routines.
It was the impetus to change how header_field_info works.

svn path=/trunk/; revision=815
1999-10-12 06:21:15 +00:00
Laurent Deniel 6269de2c37 Add ICMP display filters.
svn path=/trunk/; revision=751
1999-10-02 16:21:07 +00:00
Laurent Deniel 58aba1ccb3 Fix IGMP dfilter (some fields were registered and so
documented in man but the new dfilter functions were
not used).

svn path=/trunk/; revision=750
1999-10-02 15:55:28 +00:00
Guy Harris e22e07c397 Dirk Bonne's fix to ICMP timestamp dissection.
svn path=/trunk/; revision=713
1999-09-23 19:05:28 +00:00
Guy Harris b1f5853f41 Daniel Ryde's patch to show the IP flags as 4 bits, rather than showing
the full octet containing the flags and the upper 4 bits of the fragment
offset.

svn path=/trunk/; revision=678
1999-09-14 08:18:24 +00:00
Guy Harris fa1930a89c We now use "snprintf()" in "dissect_ip_tcp_options()", so we may need to
include "snprintf.h" to declare it.

svn path=/trunk/; revision=621
1999-08-31 23:21:29 +00:00
Guy Harris 670cf84e9b For unknown options without "syntax" errors, show the length in bytes.
svn path=/trunk/; revision=605
1999-08-28 19:38:37 +00:00
Guy Harris f9068da3e0 Handle unknown options in "dissect_ip_tcp_options()" better; we assume
that the only options that contain *no* length byte are the IP and TCP
EOL and NOP options so that we can treat unknown options as
VARIABLE_LENGTH with a minimum of 2, and at least be able to move on to
the next option by using the length in the option, rather than just
reporting the unknown option and processing no options after it.

svn path=/trunk/; revision=604
1999-08-28 19:17:17 +00:00
Guy Harris 18ecb7c367 PPP options in LCP, IPCP, etc. are like IP and TCP options - one octet
of option code, one octet of length (which includes the two option code
and length bytes), followed by 0 or more octets of option data, with
some options being fixed-length and some being variable-length.  Put
some stuff from the PPP control protocol option parsing code into the
IP-and-TCP option parsing code, and use the latter instead of the
former.

(That code might also be usable for CDP as well, with some stuff added
to it.)

Shuffle the arguments to "dissect_ip_tcp_options()" to resemble those of
various other dissectors (i.e., with the "proto_tree *" at the end).

Add in code to dissect a pile of PPP options documented in various RFCs.

svn path=/trunk/; revision=601
1999-08-28 08:31:28 +00:00
Gilbert Ramirez 75e0f95517 Changed ip.flags from FT_UINT16 to FT_UINT8, and made it highlight only
one byte in the hexdump.

svn path=/trunk/; revision=600
1999-08-28 03:56:03 +00:00
Gilbert Ramirez 6f46f57ff1 Set protocol column to "IP" for fragmented IP packets. It was not being set at
the IP layer, leaving the lower layer's abbreviation in the protocol column.

svn path=/trunk/; revision=599
1999-08-28 02:33:47 +00:00
Gilbert Ramirez da72d12846 Dissect unknown IP protocols with dissect_data().
svn path=/trunk/; revision=585
1999-08-26 17:31:37 +00:00
Gerald Combs 5c57f09423 Richard J�rgensen <ric@tbit.dk> pointed out that ICMP and IGMP checksums
were printed in the wrong byteorder.

svn path=/trunk/; revision=539
1999-08-21 21:06:11 +00:00
Guy Harris ac4f87218d Declare the "packet_info" structure "pi" in "packet.h", rather than in a
bunch of source files.

Replace the "payload" field of a "packet_info" structure with "len" and
"captured_len" fields, which contain the total packet length and total
captured packet length (including all headers) at the current protocol
layer (i.e., if a given layer has a length field, and that length field
says its shorter than the length we got from the capture, reduce the
"pi.len" and "pi.captured_len" values appropriately).  Those fields can
be used in the future if we add checks to make sure a field we're
extracting from a packet doesn't go past the end of the packet, or past
the captured part of the packet.

Get rid of the additional payload argument to some dissection functions;
use "pi.captured_len - offset" instead.

Have the END_OF_FRAME macro use "pi.captured_len" rather than
"fd->cap_len", so that "dissect the rest of the frame" becomes "dissect
the rest of the packet", and doesn't dissect end-of-frame padding such
as padding added to make an Ethernet frame 60 or more octets long.  (We
might want to rename it END_OF_PACKET; if we ever want to label the
end-of-frame padding for the benefit of people curious what that extra
gunk is, we could have a separate END_OF_FRAME macro that uses
"fd->cap_len".)

svn path=/trunk/; revision=506
1999-08-18 00:57:54 +00:00
Gilbert Ramirez d4331d4329 Converted more of the IP fields to filterable fields.
svn path=/trunk/; revision=505
1999-08-17 03:09:39 +00:00
Guy Harris 9e58014e7f Add ICMP to the set of packet types counted in the window shown while a
capture is in progress.

svn path=/trunk/; revision=491
1999-08-14 23:47:20 +00:00
Guy Harris 2563e672c8 Fix the list of descriptions of codes in ICMP Unreachable messages.
svn path=/trunk/; revision=458
1999-08-10 04:57:47 +00:00
Gilbert Ramirez e3e125878f Added John McDermott's patch for handling ICMP Unreachable|Fragmentation
Required packets.

svn path=/trunk/; revision=455
1999-08-09 18:18:38 +00:00
Guy Harris 50dbd34d6d Fix a "proto_tree_add_text()" call that should've been a
"proto_tree_add_item()" call (and fix the length passed to it, which, it
appears, has been wrong for ages).

svn path=/trunk/; revision=439
1999-08-05 00:02:55 +00:00
Laurent Deniel 98ebf4ee0a Remove srcip and destip from packet_info since it is not safe to affect
string pointer from the result of ip_to_str (statically allocated string).
Use the ip_src and the new field ip_dst in follow.c to build a correct
string display filter.

svn path=/trunk/; revision=408
1999-07-31 11:21:06 +00:00
Gilbert Ramirez 7bd6c15378 Made the protocol (but not the fields) use the new proto_tree routine,
allowing users to filter on the existence of these protocols. I also
added packet-clip.c to the Nmake makefile.

svn path=/trunk/; revision=402
1999-07-29 05:47:07 +00:00
Gilbert Ramirez 9612b74c16 Added just enough fields to TCP to support "Follow TCP Stream". It works now.
Added the protocol IDs for ipx and IGMP, but not their fields.

svn path=/trunk/; revision=365
1999-07-17 04:19:15 +00:00
Gilbert Ramirez 0d36ec8de2 Modified the proto_register_field_array usage again. Thanks to Guy's
suggestion, this new method using a static array should use less memory
and be faster. It also has a nice side-effect of making the source-code
more readble, IMHO.

Changed the print routines to look for protocol proto_data instead of
looking at the text label as they did before, hoping that the data hex
dump field item starts with "Data (".

Added the -G keyword to ethereal to make it dump a glossary of display
filter keywords to stdout and exit. This data is then formatted with
the doc/dfilter2pod perl program to pod format, which is combined
with doc/ethereal.pod.template to create doc/ethereal.pod, from which
the ethereal manpage is created. This way we can keep the manpage up-to-date
with a list of fields that can be filtered on.

svn path=/trunk/; revision=364
1999-07-15 15:33:52 +00:00