aboutsummaryrefslogtreecommitdiffstats
path: root/packet-eth.c
AgeCommit message (Collapse)AuthorFilesLines
2004-02-03From Peter J. Creath: add a heuristic dissector table, so thatGuy Harris1-1/+14
dissectors for protocols that put non-802.3 packets inside 802.3 frames can intercept 802.3/Ethernet frames before they're dissected as 802.3/Ethernet packets. svn path=/trunk/; revision=9976
2003-10-01Have a pseudo-header for Ethernet packets, giving the size of the FCS -Guy Harris1-14/+46
0 means "there is no FCS in the packet data", 4 means "there is an FCS in the packet data", -1 means "I don't know whether there's an FCS in the packet data, guess based on the packet size". Assume that Ethernet encapsulated inside other protocols has no FCS, by having the "eth" dissector assume that (and not check for an Ethernet pseudo-header). Have "ethertype()" take an argument giving the FCS size; pass 0 when appropriate. Fix up Wiretap routines to set the pseudo-header. This means we no longer use the "generic" seek-and-read routine, so get rid of it. svn path=/trunk/; revision=8574
2003-08-27From Jesper Peterson: fix a typo.Guy Harris1-3/+3
svn path=/trunk/; revision=8282
2003-08-26Make the CRC-32 routines take a tvbuff and a length as arguments.Guy Harris1-3/+2
Rename "crc32()" so as not to collide with the one in zlib; rename "crc32_802()" to match. svn path=/trunk/; revision=8268
2003-08-26From Jesper Peterson:Guy Harris1-2/+2
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-26Extract the CRC-32 code from the 802.11 dissector into a separate file,Guy Harris1-4/+14
and use it in the Ethernet dissector as well, to check the FCS in Ethernet frames, if present. svn path=/trunk/; revision=8265
2003-08-26Handle snapshot lengths that cut off *part* of the FCS.Guy Harris1-5/+31
svn path=/trunk/; revision=8264
2003-08-24"tvb_get_ptr()" returns a "const guint8 *"; make the pointers to whichGuy Harris1-2/+2
you assign its return value pointers to "const" as well. svn path=/trunk/; revision=8229
2003-08-23New feature. Statistics/EndpointTalkjers can now present a sortable table ↵Ronnie Sahlberg1-24/+36
with a list of all seen conversations of a certain type. Supported types are Ethernet/TokenRing/IP/UDP and TCP. Will add FibreChannel soon. The framework for this feature needs to be enhanced in the future so that by selecting one entry and click the right mousebutton, this will bring up a menu with Prepare/Match options with suboptions for AnyDirection, ForwardOnly or ReverseOnly which updates the display filter accordingly. Had to update some of the taps as well to change them to use a proper address structure for the address fields. We should now be able to to these stats correctly even for ip tunneled over ip tunnelled over ip ... svn path=/trunk/; revision=8222
2003-08-21Sometimes Ethernet captures include an FCS at the end of the packet.Guy Harris1-1/+36
An Ethernet trailer is only needed to pad the packet to 60 bytes of Ethernet header plus payload; if the packet has what appears to be a trailer, and it's 4 or more bytes (i.e., long enough to include an FCS), and the Ethernet frame was claimed to have 64 or more bytes (i.e., it has at least an FCS worth of data more than the minimum 60 bytes), assume that the last 4 bytes of the frame were an FCS. svn path=/trunk/; revision=8207
2003-01-22From Dinesh Dutt:Guy Harris1-5/+35
- A new decoder called MDSHDR which decodes the internal header of the Cisco MDS switch (this is different from the Boardwalk header). - Support for some more new columns as part of FC support. - Fixed the decoding of the Special Frame in FCIP. - Fixed the decoding of credit management type field in FLOGI/PLOGI frame in FC-ELS. svn path=/trunk/; revision=6974
2003-01-22reate a TAP for EthernetRonnie Sahlberg1-25/+31
svn path=/trunk/; revision=6971
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-5/+5
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6117
2002-08-26From Ulf Lamping:Guy Harris1-2/+3
Put "bytes" after the byte counts for the frame sizes in the top-level item for the "Frame" protocol, to make it clearer what they refer to. Put the source and destination MAC addresses into the top-level item for Ethernet. svn path=/trunk/; revision=6090
2002-08-08From Alfred Koebler: support for interpreting Ethernet captures asGuy Harris1-1/+20
CheckPoint FireWall-1 monitor files (those files look like snoop files for Ethernet). svn path=/trunk/; revision=5969
2002-08-02Replace the types from sys/types.h and netinet/in.h by their glib.hJörg Mayer1-6/+2
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-04-24From Joerg Mayer: get rid of extra arguments to capture routines.Guy Harris1-2/+2
svn path=/trunk/; revision=5233
2002-01-21Include files from the "epan" directory and subdirectories thereof withGuy Harris1-3/+3
"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
2001-12-10Move the pointer to the "column_info" structure in the "frame_data"Guy Harris1-7/+7
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-03Make "dissector_add()", "dissector_delete()", and "dissector_change()"Guy Harris1-9/+8
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-11-20Get rid of "tvb_compat()"; it's no longer needed (the one remaining callGuy Harris1-5/+1
to it returns data that's no longer used). svn path=/trunk/; revision=4237
2001-11-20Get rid of the "len" and "captured_len" members of the "packet_info"Guy Harris1-25/+3
structure; they're no longer used. svn path=/trunk/; revision=4236
2001-11-20Make the capture routines take an additional argument giving the amountGuy Harris1-7/+7
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-06-29Update Gerald's e-mail address.Guy Harris1-3/+2
svn path=/trunk/; revision=3620
2001-06-18From Joerg Mayer: explicitly fill in all members of aGuy Harris1-7/+7
"header_field_info" structure, including the ones that are later set by the routines to register fields. svn path=/trunk/; revision=3561
2001-04-17Move the declaration of "etype_vals[]" from "epan/packet.h" toGuy Harris1-3/+1
"etypes.h". svn path=/trunk/; revision=3314
2001-04-03An Ethernet type of 0x6558 is "Transparent Ethernet Bridging" which,Guy Harris1-1/+7
apparently, means an Ethernet packet is stuffed into the payload; add support for it as an Ethernet, Cisco HDLC, and GRE packet type. Sort the Ethernet types in "etypes.h" by value. svn path=/trunk/; revision=3250
2001-03-22Show "IEEE 802.3" as "IEEE 802.3 Ethernet" so as not to confuseGilbert Ramirez1-3/+3
anyone. svn path=/trunk/; revision=3161
2001-03-13Make tvb_get_ptr() return 'const guint8*', and clean up all theGilbert Ramirez1-2/+2
usages of tvb_get_ptr(). packet-ieee80211.c still has one bad usage, in which it *does* modify the tvbuff's data. svn path=/trunk/; revision=3128
2001-02-08Pull a lot of common code for handling 802.3 frames (i.e., frames with aGuy Harris1-80/+23
length field rather than an Ethernet type field) into a "dissect_802_3()" routine. In that routine, catch exceptions thrown by the IPX or LLC dissector or dissectors under them, so that the trailer information is added to the tree even if an exception is thrown (similar to what "ethertype()" does). svn path=/trunk/; revision=3002
2001-01-21Start removing "{OLD_}CHECK_DISPLAY_AS_DATA()" calls, and code to setGuy Harris1-4/+1
"pinfo->current_proto"; dissectors called only through dissector tables and handles don't need to do either of those, as the dissector table and handle code will do it for them. (Dissectors called directly, or dissectors that can be attached to conversations, still have to do it themselves.) Register the PPP Multilink Protocol, PPP Link Control Protocol, and PPP IP Control Protocol as official protocols, and register them in PPP's dissector table rather than having PPP handle them specially; change "dissect_cp()" to take a protocol ID, get the protocol short name information from it, and use the protocol ID for the top-level protocol tree item. Set the Protocol column in the PPP Multilink Protocol dissector, and set the Info column before extracting anything from the frame, so that if an exception is thrown, the Info and Protocol columns will reflect that the packet is supposed to be a PPP Multilink Protocol frame. Make the "First fragment" and "Last fragment" flags in the PPP Multilink Protocol header boolean bitfields, and let "proto_tree_add_boolean()" do all the heavy lifting when displaying them, rather than doing it by hand. Don't extract the sequence number in the PPP Multilink Protocol until you're ready to put it into the tree, just in case the captured packet includes the flags but not the sequence number. Clean up the code to check the FCS of PPP frames - extract it with "tvb_get_letohs()" or "tvb_get_letohl()", don't extract it byte-by-byte and then put it together yourself. svn path=/trunk/; revision=2926
2001-01-21Always call the Ethernet and Token Ring dissectors through a dissectorGuy Harris1-2/+2
handle, and make them static. svn path=/trunk/; revision=2925
2001-01-18Make sure "fh_tree" is always set in "dissect_eth()" before passing itGuy Harris1-2/+2
to "ethertype()". svn path=/trunk/; revision=2916
2001-01-18Pull the handling of trailers in Ethernet (as opposed to 802.3) framesGuy Harris1-92/+69
into "ethertype()". svn path=/trunk/; revision=2915
2001-01-09Register the IPX dissector, make it static, and call it through aGuy Harris1-3/+5
handle. Call the IP dissector through a handle in the Frame Relay dissector. svn path=/trunk/; revision=2851
2001-01-09Add an additional "protocol index" argument to "{old_}dissector_add()",Guy Harris1-3/+4
"{old_}heur_dissector_add()", "{old_}conv_dissector_add()", and "register_dissector()", so that an entry in those tables has associated with it the protocol index of the protocol the dissector handles (or -1, if there is no protocol index for it). This is for future use in a number of places. (Arguably, "proto_register_protocol()" should take a dissector pointer as an argument, but 1) it'd have to handle both regular and heuristic dissectors; 2) making it take either a "dissector_t" or a union of that and a "heur_dissector_t" introduces some painful header-file interdependencies so I'm punting on that for now. As with other Ethereal internal APIs, these APIs are subject to change in the future, at least until Ethereal 1.0 comes out....) svn path=/trunk/; revision=2849
2001-01-03Have the TR MAC and LLC dissectors register themselves, make themGuy Harris1-5/+7
static, and have other dissectors call them through handles. svn path=/trunk/; revision=2816
2001-01-03Have "proto_register_protocol()" build a list of data structures forGuy Harris1-2/+2
protocols, in addition to adding structures to the list of filterable fields. Give it an extra argument that specifies a "short name" for the protocol, for use in such places as pinfo->current_proto; the dialog box for constructing filters; the preferences tab for the protocol; and so on (although we're not yet using it in all those places). Make the preference name that appears in the preferences file and the command line for the DIAMETER protocol "diameter", not "Diameter"; the convention is that the name in question be all-lower-case. Make some routines and variables that aren't exported static. Update a comment in the ICP dissector to make it clear that the dissector won't see fragments other than the first fragment of a fragmented datagram. svn path=/trunk/; revision=2810
2000-12-28Tvbuffify the CDP, CGMP, ISL, and VTP dissectors.Guy Harris1-3/+13
Add a new subdissector table in the LLC dissector for protocol IDs with a Cisco OUI, and register the CDP, CGMP, and VTMP dissectors in that table, rather than calling them via a switch statement. Register the ISL dissector by name, and have the Ethernet dissector call it via a handle. Fix the handling of the checksum field in the CDP dissector. The strings in CDP are counted, not null-terminated; treat them as such. Fix the handling of the encapsulated frame CRC, and the encapsulated frame, in the ISL dissector, at least for Ethernet frames; it may not be correct for encapsulated Token Ring frames. svn path=/trunk/; revision=2792
2000-11-29Wrap the dissect_fddi() call (with a 4th argument) withGilbert Ramirez1-1/+7
dissect_fddi_not_bitswapped() and dissect_fddi_bitswapped(), both of which use the standard 3-argument tvbuffified-dissector argument list. Add a dissector table called "wtap_encap" which is used to call dissectors from dissect_frame(). The switch() statement from this top-level dissector is removed. The link-layer dissectors register themselves with the "wtap_encap" dissector table. The dissectors are now static where possible. svn path=/trunk/; revision=2708
2000-11-19For each column, have both a buffer into which strings for that columnGuy Harris1-3/+3
can be put, and a pointer to the string for the column, which might or might not point to that buffer. Add a routine "col_set_str()", which sets the string for the column to the string passed to it as an argument; it should only be handed a static string (a string constant would be ideal). It doesn't do any copying, so it's faster than "col_add_str()". Make the routines that append to columns check whether the pointer to the string for the column points to the buffer for the column and, if not, copy the string for the column to the buffer for the column so that you can append to it (so you can use "col_set_str()" and then use "col_append_str()" or "col_append_fstr()"). Convert a bunch of "col_add_str()" calls that take a string constant as an argument to "col_set_str()" calls. Convert some "col_add_fstr()" calls that take a string constant as the only argument - i.e., the format string doesn't have any "%" slots into which to put strings for subsequent arguments to "col_set_str()" calls (those calls are just like "col_add_str()" calls). Replace an END_OF_FRAME reference in a tvbuffified dissector with a "tvb_length(tvb)" call. svn path=/trunk/; revision=2670
2000-11-19Have the Etherenet and PPP dissectors register themselves, and haveGuy Harris1-1/+3
other dissectors call them through handles. Do the same for the "PPP payload" dissector, after tvbuffifying it. Tvbuffify the PPPoE dissector. Do the last little bit of tvbuffifying the L2TP dissector (it takes old-style arguments and immediately generates a tvbuff out of them; make it take new-style arguments). svn path=/trunk/; revision=2664
2000-11-18Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSIGuy Harris1-30/+45
ESIS dissectors. Register the IP dissector and have dissectors that call it directly (rather than through a port table) call it through a handle. Add a routine "tvb_set_reported_length()" which a dissector can use if it was handed a tvbuff that contains more data than is actually in its part of the packet - for example, handing a padded Ethernet frame to IP; the routine sets the reported length of the tvbuff (and also adjusts the actual length, as appropriate). Then use it in IP. Given that, "ethertype()" can determine how much of the Ethernet frame was actually part of an IP datagram (and can do the same for other protocols under Ethernet that use "tvb_set_reported_length()"; have it return the actual length, and have "dissect_eth()" and "dissect_vlan()" use that to mark trailer data in Ethernet II frames as well as in 802.3 frames. svn path=/trunk/; revision=2658
2000-11-13If either of the "tvb_new_subset()" calls throws an exception, it meansGuy Harris1-1/+19
we don't have so much data in the frame that there's a trailer, so we should set "trailer_tvb" to NULL. Put in a comment explaining what the exception catching is all about. svn path=/trunk/; revision=2633
2000-11-13"It's pronounced 'volatile pointer to tvbuff_t' but it's spelledGuy Harris1-12/+7
'tvbuff_t *volatile'." Makes "Throat-Warbler Mangrove" vs. "Luxury-Yacht" sound almost normal.... Type-qualified pointers to non-type-qualified objects are a barrel of fun in C. The way you declare a volatile pointer named "bar" to a *non-volatile* "foo" is foo *volatile bar; as opposed to a non-volatile pointer "bar" to a volatile "foo", which is volatile foo *bar; GCC's complaint about variables being clobbered by longjmp refers to the fact that "longjmp()" isn't guaranteed to restore variables stored in registers to the values they had at the time of the "longjmp()" (if "setjmp()" stuffs the current register values in the "jmp_buf", and "longjmp()" just reloads them rather than walking the stack to restore all register values pushed onto the stack, the values at the time of the "setjmp()" will be restored, clobbering any updates done after the "setjmp()"); the workaround provided in ANSI C is to declare the variables in question "volatile", which will keep them out of registers (or any other place that "setjmp()"/"longjmp()" can't handle). svn path=/trunk/; revision=2631
2000-08-13Add the "Edit:Protocols..." feature which currently only implementsLaurent Deniel1-1/+3
the following: It is now possible to enable/disable a particular protocol decoding (i.e. the protocol dissector is void or not). When a protocol is disabled, it is displayed as Data and of course, all linked sub-protocols are disabled as well. Disabling a protocol could be interesting: - in case of buggy dissectors - in case of wrong heuristics - for performance reasons - to decode the data as another protocol (TODO) Currently (if I am not wrong), all dissectors but NFS can be disabled (and dissectors that do not register protocols :-) I do not like the way the RPC sub-dissectors are disabled (in the sub-dissectors) since this could be done in the RPC dissector itself, knowing the sub-protocol hfinfo entry (this is why, I've not modified the NFS one yet). Two functions are added in proto.c : gboolean proto_is_protocol_enabled(int n); void proto_set_decoding(int n, gboolean enabled); and two MACROs which can be used in dissectors: OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree) CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree) See also the XXX in proto_dlg.c and proto.c around the new functions. svn path=/trunk/; revision=2267
2000-08-07Allow either old-style (pre-tvbuff) or new-style (tvbuffified)Guy Harris1-7/+7
dissectors to be registered as dissectors for particular ports, registered as heuristic dissectors, and registered as dissectors for conversations, and have routines to be used both by old-style and new-style dissectors to call registered dissectors. Have the code that calls those dissectors translate the arguments as necessary. (For conversation dissectors, replace "find_conversation_dissector()", which just returns a pointer to the dissector, with "old_try_conversation_dissector()" and "try_conversation_dissector()", which actually call the dissector, so that there's a single place at which we can do that translation. Also make "dissector_lookup()" static and, instead of calling it and, if it returns a non-null pointer, calling that dissector, just use "old_dissector_try_port()" or "dissector_try_port()", for the same reason.) This allows some dissectors that took old-style arguments and immediately translated them to new-style arguments to just take new-style arguments; make them do so. It also allows some new-style dissectors not to have to translate arguments before calling routines to look up and call dissectors; make them not do so. Get rid of checks for too-short frames in new-style dissectors - the tvbuff code does those checks for you. Give the routines to register old-style dissectors, and to call dissectors from old-style dissectors, names beginning with "old_", with the routines for new-style dissectors not having the "old_". Update the dissectors that use those routines appropriately. Rename "dissect_data()" to "old_dissect_data()", and "dissect_data_tvb()" to "dissect_data()". svn path=/trunk/; revision=2218
2000-05-31Add routines for adding items to a protocol tree that take arguments ofGuy Harris1-11/+11
a particular type, rather than taking a varargs list, along the lines of the "proto_tree_add_XXX_format()" routines. Replace most calls to "proto_tree_add_item()" and "proto_tree_add_item_hidden()" with calls to those routines. Rename "proto_tree_add_item()" and "proto_tree_add_item_hidden()" to "proto_tree_add_item_old()" and "proto_tree_add_item_hidden_old()", and add new "proto_tree_add_item()" and "proto_tree_add_item_hidden()" routines that don't take the item to be added as an argument - instead, they fetch the argument from the packet whose tvbuff was handed to them, from the offset handed to them. svn path=/trunk/; revision=2031
2000-05-19Make "packet-clip.c", "packet-raw.c", "packet-ppp.c", "packet-tr.c",Guy Harris1-1/+2
"packet-eth.c", and "packet-fddi.c" include the include files that declare the functions they export, so that the declarationss in the header files will be checked against the definitions in the source files. svn path=/trunk/; revision=1981
2000-05-19Add protection against 0-length FT_BYTES being added to proto_tree.Gilbert Ramirez1-2/+2
Convert ethertype() and dissect_null() to use tvbuff. svn path=/trunk/; revision=1979