aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ip.c
AgeCommit message (Collapse)AuthorFilesLines
2000-08-07Allow either old-style (pre-tvbuff) or new-style (tvbuffified)Guy Harris1-22/+15
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-08-05Make the ICMP top-of-protocol-tree item cover the entire rest of theGuy Harris1-2/+2
packet, not just the first 4 bytes of the ICMP packet. svn path=/trunk/; revision=2211
2000-08-05Make "ip_checksum()" take just pointer and length arguments, and makeGuy Harris1-31/+37
"ip_checksum_shouldbe()" compute the correct checksum given the computed whole-packet checksum and the value of the checksum field; that scheme can be better extended in the future to handle checksums other than the IP header checksum, e.g. ICMP, UDP, and TCP checksums (although we'd want a somewhat more optimized checksumming routine for that, and perhaps have an option to control whether to do checksum checking on TCP and UDP packets, as that could be expensive). That requires that we remember the value of the computed checksum, not just check it against 0; that renders "ip_checksum_state()" uninteresting, as we can just compare the value against 0 in line. svn path=/trunk/; revision=2210
2000-08-04Clean up the checksumming stuff a bit:Guy Harris1-27/+29
have "ip_checksum()" compute the checksum of the IP header; have "ip_checksum_state()" call "ip_checksum()" and then return TRUE if the result is 0 and FALSE otherwise; have "ip_checksum_shouldbe()" save the current value of the checksum field in the header, set that field to 0, call "ip_checksum()" to get the checksum, restore the value of the checksum field in the header to the saved value, and then return what "ip_checksum()" returned; rather than having duplicated code to compute checksums. svn path=/trunk/; revision=2206
2000-08-04If IP checksum is incorrect, show what correct value should be.Gilbert Ramirez1-9/+37
From "Johannes Hennecke" <Johannes.Hennecke@elsa.de> svn path=/trunk/; revision=2202
2000-07-05Add support for a global "ethereal.conf" preferences file, stored in theGuy Harris1-1/+10
same directory as the "manuf" file ("/etc" or "/usr/local/etc", most likely). Add a mechanism to allow modules (e.g., dissectors) to register preference values, which: can be put into the global or the user's preference file; can be set from the command line, with arguments to the "-o" flag; can be set from tabs in the "Preferences" dialog box. Use that mechanism to register the "Decode IPv4 TOS field as DiffServ field" variable for IP as a preference. Stuff that still needs to be done: documenting the API for registering preferences; documenting the "-o" values in the man page (probably needs a flag similar to "-G", and a Perl script to turn the output into documentation as is done with the list of field); handling error checking for numeric values (range checking, making sure that if the user changes the variable from the GUI they change it to a valid numeric value); using the callbacks to, for example, update the display when preferences are changed (could be expensive); panic if the user specifies a numeric value with a base other than 10, 8, or 16. We may also want to clean up the existing wired-in preferences not to take effect the instant you tweak the widget, and to add an "Apply" button to the "Preferences" dialog. svn path=/trunk/; revision=2117
2000-06-20tvbuffify the IGMP dissector. There's still plenty more to do insideGilbert Ramirez1-32/+33
packet-ip.c. svn path=/trunk/; revision=2082
2000-06-13tos_str is no longer used. it was superseded by iptos_vals.Jun-ichiro itojun Hagino1-27/+1
svn path=/trunk/; revision=2064
2000-06-05Change dissect_ah() so that dissect_ip() doesn't have to make aGilbert Ramirez1-11/+1
special case for it. dissect_ah() is registered with the "ip.proto" handoff table, and dissect_ah() calls the next dissector using this same "ip.proto" handoff table. The old dissect_ah() is kept as dissect_ah_old() since dissect_ipv6() still uses it. I need to convert some more functions before I can get rid of dissect_ah_old(). svn path=/trunk/; revision=2039
2000-06-02Show ICMP sequence number as two bytes, not as integer.Gilbert Ramirez1-3/+3
svn path=/trunk/; revision=2037
2000-05-31Add routines for adding items to a protocol tree that take arguments ofGuy Harris1-27/+27
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-28Give the Appletalk DDP dissector a dissector hash table, and have theGuy Harris1-95/+1
protocols encapsulated inside DDP register themselves with that table. Pull the EIGRP dissector into its own file, as suggested by Paul Ionescu; it's not an IP-specific protocol. svn path=/trunk/; revision=2022
2000-05-26Support for SCTP in the capture dialog, from Michael Tuexen.Guy Harris1-1/+4
svn path=/trunk/; revision=2012
2000-05-24Patch from Scott Howard to show the IP fragment offset as a byte offsetGuy Harris1-3/+3
rather than an 8-byte offset. svn path=/trunk/; revision=1996
2000-05-22EIGRP over Appletalk and EIGRP over IPX support, from Paul Ionescu.Guy Harris1-3/+3
svn path=/trunk/; revision=1994
2000-05-11Add tvbuff class.Gilbert Ramirez1-85/+85
Add exceptions routines. Convert proto_tree_add_*() routines to require tvbuff_t* argument. Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as the tvbuff_t* argument to proto_tree_add_*() routines. dissect_packet() creates a tvbuff_t, wraps the next dissect call in a TRY block, will print "Short Frame" on the proto_tree if a BoundsError exception is caught. The FDDI dissector is converted to use tvbuff's. svn path=/trunk/; revision=1939
2000-05-10Fix a typo in the packet counter.Gerald Combs1-2/+2
svn path=/trunk/; revision=1934
2000-04-20Have the IPv6 dissector use the same dissector table as the IPv4Guy Harris1-33/+15
dissector. Don't dissect the payload of any fragmented IPv6 packet unless it's the initial fragment (that's what we do for IPv4). svn path=/trunk/; revision=1882
2000-04-17Register a "llc.dsap" dissector table for 802.2 LLC, and have dissectorsGuy Harris1-1/+3
for protocols that run inside 802.2 LLC register themselves with it using "dissector_add()". Make various dissectors static if they can be, and remove from header files declarations of those dissectors. svn path=/trunk/; revision=1872
2000-04-16Register an "ip.proto" dissector table for IPv4, and have dissectors forGuy Harris1-55/+30
protocols that run inside IPv4 register themselves with it using "dissector_add()". Make various dissectors static if they can be, and get rid of any header files that no longer contain any information as a result of that change. svn path=/trunk/; revision=1870
2000-04-16Register a "ppp.protocol" dissector table for PPP, and have dissectorsGuy Harris1-1/+3
for protocols that run inside PPP register themselves with it using "dissector_add()". svn path=/trunk/; revision=1869
2000-04-13Change the sub-dissector handoff registration routines so that theGilbert Ramirez1-1/+8
sub-dissector table is not stored in the header_field_info struct, but in a separate namespace. Dissector tables are now registered by name and not by field ID. For example: udp_dissector_table = register_dissector_table("udp.port"); Because of this different namespace, dissector tables can have names that are not field names. This is useful for ethertype, since multiple fields are "ethertypes". packet-ethertype.c replaces ethertype.c (the name was changed so that it would be named in the same fashion as all the filenames passed to make-reg-dotc) Although it registers no protocol or field, it registers one dissector table: ethertype_dissector_table = register_dissector_table("ethertype"); All protocols that can be called because of an ethertype field now register that fact with dissector_add() calls. In this way, one dissector_table services all ethertype fields (hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype) Furthermore, the code allows for names of protocols to exist in the etype_vals, yet a dissector for that protocol doesn't exist. The name of the dissector is printed in COL_INFO. You're welcome, Richard. :-) svn path=/trunk/; revision=1848
2000-03-21Add support for TXT and WKS records to the DNS dissector.Guy Harris1-16/+1
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-16Put the EIGRP packet type into the INFO column in the packet list entryGuy Harris1-13/+13
for an EIGRP packet. svn path=/trunk/; revision=1726
2000-03-12Break proto_tree_add_item_format() into multiple functions:Gilbert Ramirez1-10/+10
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-07Fix some "proto_tree_add_text()" calls.Guy Harris1-14/+14
svn path=/trunk/; revision=1696
2000-02-15Create a header file for every packet-*.c file. Prune the packet.h file.Gilbert Ramirez1-6/+19
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-09Integrate Ed Meaney's <emeaney@altiga.com> changes for using libpcapGilbert Ramirez1-1/+4
from WinDump with Ethereal. We now have packet capturing on Win32. :) svn path=/trunk/; revision=1612
2000-02-02In dissect_ipopt_timestamp() :Olivier Abad1-13/+6
Correct a bug reported by Paul Ionescu when dissecting a timestamp IP option. The offsets where not correct. svn path=/trunk/; revision=1596
2000-01-24Heikki Vatiainen's patch to add a flag to control whether to interpretGuy Harris1-11/+97
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-23In "dissect_eth()", update "pi.len" and "pi.captured_len" regardless ofGuy Harris1-2/+6
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-20Joerg Mayer's updates to the VINES dissector and to protocol layersGuy Harris1-1/+9
above VINES. svn path=/trunk/; revision=1514
2000-01-16Get rid of the include of "util.h" that some dissectors do - it's notGuy Harris1-2/+1
necessary. svn path=/trunk/; revision=1496
1999-12-13Fix problem with number of format args for "option length too short".Gilbert Ramirez1-2/+2
Problem reported by James Coe <jammer@cin.net> svn path=/trunk/; revision=1309
1999-12-09Thou Shalt Not Cast Pointers Into A Packet To Pointers To AnythingGuy Harris1-5/+7
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-08Added Philip Gladstone <philip@raptor.com>'s patch to check IP headerGilbert Ramirez1-2/+23
checksum, and noted the need for user-selectable lines in the GUI tree. svn path=/trunk/; revision=1242
1999-11-21Added Heikki Vatiainen's <hessu@cs.tut.fi> VRRP dissector.Gilbert Ramirez1-1/+4
svn path=/trunk/; revision=1083
1999-11-17Typo fix, from Heikki Vatiainen.Guy Harris1-2/+2
svn path=/trunk/; revision=1045
1999-11-16Replace the ETT_ "enum" members, declared in "packet.h", withGuy Harris1-19/+55
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-02Format the IP header length as an unsigned quantity.Guy Harris1-2/+2
svn path=/trunk/; revision=965
1999-11-02Make a bunch of the bitfields in the IP header filterable items.Guy Harris1-33/+68
svn path=/trunk/; revision=963
1999-10-30Don Lafontaine's IGRP/EIGRP dissector.Guy Harris1-16/+102
svn path=/trunk/; revision=949
1999-10-22Generalize the "ip_src" and "ip_dst" members of the "packet_info"Guy Harris1-12/+17
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-22Check to make sure the header length is at least the minimum length forGuy Harris1-2/+11
an IP header. svn path=/trunk/; revision=906
1999-10-16- replace proto_tree_add_item_format by proto_tree_add_item.Laurent Deniel1-17/+9
- fix hf_ip_len type field (FT_UINT16). svn path=/trunk/; revision=866
1999-10-15IPComp (RFC2393) decoding.Jun-ichiro itojun Hagino1-2/+5
svn path=/trunk/; revision=838
1999-10-14add string IP protocol name into info field of fragmented packet.Jun-ichiro itojun Hagino1-3/+3
svn path=/trunk/; revision=833
1999-10-14implement ipprotostr() in ipproto.c, which basically does ipprotobynumber()Jun-ichiro itojun Hagino1-3/+5
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-13Jun-ichiro itojun Hagino's code for PIM, and some fixes from him asGuy Harris1-2/+12
well. Add some more protocols to the list of value/string pairs for IP protocol types. svn path=/trunk/; revision=822
1999-10-12New proto_tree header_field_info stuff. Header_field_infos now containGilbert Ramirez1-23/+48
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