aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ip.c
Commit message (Collapse)AuthorAgeFilesLines
* Moved from using dissect_data() to using call_dissector()Ed Warnicke2001-11-261-5/+7
| | | | svn path=/trunk/; revision=4269
* If we have to worry about subdissectors changing the "packet_info"Guy Harris2001-11-211-15/+1
| | | | | | | | | | structure, we may have to worry about it in more places than the places that *used* to set "pi.len" and "pi.captured_len", so there's no point in just saving and restoring it there. We'll remove those saves/restores, and worry about saves and restores when we find a problem. svn path=/trunk/; revision=4245
* Get rid of the "len" and "captured_len" members of the "packet_info"Guy Harris2001-11-201-5/+4
| | | | | | structure; they're no longer used. svn path=/trunk/; revision=4236
* Make the capture routines take an additional argument giving the amountGuy Harris2001-11-201-3/+3
| | | | | | | | | | | 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
* Get rid of NullTVB, the "compat_top_tvb" member of the "packet_info"Guy Harris2001-11-151-2/+1
| | | | | | | | structure, the check for a null tvbuff pointer in "alloc_field_info()", and the "tvb_create_from_top()" macro; they're no longer needed, as there's no non-tvbuffified dissector code remaining. svn path=/trunk/; revision=4205
* Support for Mobile IP's use of ICMP Router Advertisements, from DavidGuy Harris2001-10-311-11/+269
| | | | | | | | | | | | Frascone. Small white-space fix. Display the preference level in router advertisements as signed, not unsigned, as per RFC 1256, which says it's a "signed, twos-complement value". svn path=/trunk/; revision=4118
* Have a flag in the "packet_info" structure, which indicates whether theGuy Harris2001-10-011-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | stuff currently being dissected is part of a packet included in an error packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not bother doing reassembly if the TCP segment is part of an error packet, rather than an actual TCP transmission; other dissectors might want to treat those packets specially as well. Add to the "tcpinfo" structure a flag indicating whether the URG flag was set, rather than having the zero or non-zero value of the urgent pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent pointer value isn't useful, as it means "the stuff before this segment is urgent", but it's certainly possible to put onto the wire a TCP segment with URG set and a zero urgent pointer.) Don't dissect the TCP header by grabbing the entire header with "tvb_memcpy()" and then pulling stuff out of it - extract stuff with individual tvbuff calls, and put stuff into the protocol tree and the Info column as we extract it, so that we can dissect a partial header. This lets us, for example, get the source and destination ports from the TCP header of the part of a TCP segment included in a minimum-length ICMPv4 error packet. svn path=/trunk/; revision=3986
* When dissecting an ICMP datagram that contains part of an IP datagram,Guy Harris2001-09-271-5/+57
| | | | | | | | | | | hand the (possibly-partial) IP datagram to the IP dissector, as we do for IPv6 datagrams inside ICMPv6 and CLNP datagrams inside CLNP ER PDUs. When dissecting IPv6 datagrams inside ICMPv6 and CLNP datagrams inside CLNP ER PDUs, catch the ReportedLengthError exception and ignore it, as they don't guarantee that all of the original PDU is present. svn path=/trunk/; revision=3960
* Get rid of some unused variables.Guy Harris2001-07-201-2/+1
| | | | svn path=/trunk/; revision=3744
* Create a routine to do the tvbuff-length-adjusting andGuy Harris2001-06-291-26/+4
| | | | | | | | | | | | | "pinfo->{len,captured_len}"-adjusting currently done by the IP dissector, make the IP dissector call that rather than doing the work itself, make the IPv6 dissector call that rather than just adjusting the tvbuff length itself, and make the IPX dissector call that rather than just adjusting "pi.{len,captured_len}" itself. This cleans things up a bit, and causes trailers to be properly reported in IPX-over-Ethernet frames. svn path=/trunk/; revision=3621
* More signed vs. unsigned cleanups, and initialization cleanups, fromGuy Harris2001-06-191-3/+4
| | | | | | Joerg Mayer. svn path=/trunk/; revision=3578
* From Joerg Mayer: explicitly fill in all members of aGuy Harris2001-06-181-37/+37
| | | | | | | "header_field_info" structure, including the ones that are later set by the routines to register fields. svn path=/trunk/; revision=3561
* Don't display the data portion of an ER NPDU - we dissect it as a CLNPGuy Harris2001-06-081-2/+2
| | | | | | PDU. svn path=/trunk/; revision=3527
* Move the fragment reassembly code into "reassemble.c" andGuy Harris2001-06-081-323/+22
| | | | | | | | "reassemble.h", and remove IPv4 dependencies from it. Use it for OSI CLNP segment reassembly as well. svn path=/trunk/; revision=3525
* There is no string value assigned to the "ip.fragment.error",Guy Harris2001-06-051-8/+8
| | | | | | | | | "ip.fragment", and "ip.fragments" fields, so make them FT_NONE, not FT_STRING. (Otherwise, if you try to do a "Match Selected" on them, we dump core because the value is a null pointer and we try to dereference it.) svn path=/trunk/; revision=3512
* Add tree summary information similar to what's in packet-tcp.c.Gerald Combs2001-05-231-3/+17
| | | | svn path=/trunk/; revision=3436
* Rewritten IGMP dissector, from Ronnie Sahlberg.Guy Harris2001-05-201-131/+1
| | | | svn path=/trunk/; revision=3426
* IP fragment reassembly, from Ronnie Sahlberg.Guy Harris2001-04-181-34/+545
| | | | svn path=/trunk/; revision=3324
* Move the declaration of "ipprotostr()" out of "epan/packet.h" into a newGuy Harris2001-04-171-1/+2
| | | | | | "ipproto.h" header file. svn path=/trunk/; revision=3313
* Use "proto_tree_add_boolean_hidden()", notGuy Harris2001-03-281-3/+3
| | | | | | | | "proto_tree_add_item_hidden()", to add the "checksum bad" flags to packets; the value should be "TRUE", not the numerical value of the checksum field. svn path=/trunk/; revision=3202
* If the IP header length is < 20, don't try to dissect the header (otherGuy Harris2001-03-281-4/+17
| | | | | | | than, well, dissecting the header length field), just show the packet has having a bogus IP header length. svn path=/trunk/; revision=3198
* Add a new Wiretap encapsulation type for Cisco HDLC. Map the NetBSDGuy Harris2001-03-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | DLT_HDLC to it. Make a separate dissector for Cisco HDLC, and add a dissector for Cisco SLARP. Have the PPP dissector call the Cisco HDLC dissector if the address field is the Cisco HDLC unicast or multicast address. Use the Cisco HDLC dissector for the Cisco HDLC Wiretap encapsulation type. Add a new dissector table "chdlctype", for Cisco HDLC packet types (they're *almost* the same as Ethernet types, but 0x8035 is SLARP, not Reverse ARP, and 0x2000 is the Cisco Discovery protocol, for example), replacing "fr.chdlc". Have a "chdlctype()" routine, similar to "ethertype()", used both by the Cisco HDLC and Frame Relay dissectors. Have a "chdlc_vals[]" "value_string" table for Cisco HDLC types and protocol names. Split the packet type field in the Frame Relay dissector into separate SNAP and Cisco HDLC fields, and give them the Ethernet type and Cisco HDLC type "value_string" tables, respectively. svn path=/trunk/; revision=3133
* IP_PROTO_IPV4 and IP_PROTO_IPIP are both 4; there's no need to registerGuy Harris2001-03-051-2/+1
| | | | | | both of them as dissected by the IP dissector. svn path=/trunk/; revision=3105
* Add hidden fields for bad checksums to various IP-family protocols.Guy Harris2001-02-281-6/+6
| | | | | | | | Initialize the "hf_" value for "icmp.checksum_bad" to -1, the way all other "hf_" values are initialized, and declare it and "ip.checksum_bad" to have base BASE_NONE, not 4. svn path=/trunk/; revision=3087
* Initialize hf_ip_checksum_bad to -1 like all other fields.Gilbert Ramirez2001-02-211-2/+2
| | | | svn path=/trunk/; revision=3064
* Change from James E. Flemer to add hidden Boolean fields that are set ifGuy Harris2001-02-211-1/+14
| | | | | | the IP or ICMP checksum is bad. svn path=/trunk/; revision=3063
* Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="Guy Harris2001-01-221-15/+3
| | | | | | | | | | | | | | | | | | | statements. Move the setting of the Protocol column in various dissectors before anything is fetched from the packet, and also clear the Info column at that point in those and some other dissectors, so that if an exception is thrown, the columns don't reflect the previous protocol. Make the IP dissector static, as it's called only via dissector tables or dissector handles. Also make the "dissect the TOS field as the DiffServ DS field" flag static, as it's not referred to outside of "packet-ip.c". In the NCP dissector, refer to the port type through "pinfo" rather than through the global "pi", as it's a tvbuffified dissector. svn path=/trunk/; revision=2929
* Make GRE use a dissector table for its protocol types, and registerGuy Harris2001-01-131-4/+6
| | | | | | | | | | | dissectors for protcools that can be encapsulated inside GRE in that table. Fix a bug in the handling of WCCPv2 IP encapsulation (it was constructing the next tvbuff before, rather than after, advancing the offset past the redirection header). svn path=/trunk/; revision=2893
* Make the stuff to handle SNAP frames (OUI, PID, payload) a routine ofGuy Harris2001-01-101-2/+6
| | | | | | | | | | | | | | its own; it's used not only by LLC, but by Frame Relay with RFC 2427 and ATM with RFC 2684. Support for RFC 2427-encapsulation Frame Relay packets, from Paul Ionescu. Get rid of the CISCO_IP PPP protocol type - Cisco HDLC uses, in most cases, Ethernet packet types, so use ETHERTYPE_IP instead (they're both 0x0800). svn path=/trunk/; revision=2854
* Add an additional "protocol index" argument to "{old_}dissector_add()",Guy Harris2001-01-091-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | "{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
* Ensure that all value_string arrays end in {0, NULL}. Dissectors got awayGilbert Ramirez2001-01-031-2/+4
| | | | | | | | | | | | | | with not terminating their arrays because they knew the limits of the value used to look up strings in the value_string array, but the dfilter_expr_dlg does not know these limits and must rely on the terminating {0, NULL} record. Also, in SNA fixed a bug in which a field should have been defined as FT_UINT8 but was defined as FT_BOOLEAN. In WTP, fixed a value string which had duplicate keys. svn path=/trunk/; revision=2817
* Add a new "prefs_register_protocol()" routine, which is likeGuy Harris2001-01-031-2/+2
| | | | | | | | | | | | "prefs_register_module()" except that it takes a protocol index as returned by "proto_register_protocol()" as its first argument, rather than taking two character strings as arguments as its first two arguments, and uses the protocol's abbreviation as the name to use for preferences in the preferences file and the "-o" flag and uses the protocol's short name as the name to use in the tabs in the "Edit->Preferences" window. svn path=/trunk/; revision=2812
* Have "proto_register_protocol()" build a list of data structures forGuy Harris2001-01-031-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* If we get an exception when dissecting a packet, append "[Short Frame]"Guy Harris2000-12-291-7/+14
| | | | | | | | | | | | or "[Malformed Frame]" to the Info column. Make some dissectors set the Protocol column and clear the Info column before fetching anything from the tvbuff they were handed, so that if the frame is short or malformed, it'll be marked as being the right top-level protocol, and the Info column won't have cruft left over from the previous protocol. svn path=/trunk/; revision=2800
* Fix a typo in a comment.Guy Harris2000-12-141-2/+2
| | | | svn path=/trunk/; revision=2758
* PPP patches from Burke Lau to:Guy Harris2000-12-141-1/+2
| | | | | | | | | | add FCS checking; support Cisco HDLC format in the PPP dissector; handle MPLS-over-PPP. svn path=/trunk/; revision=2754
* Added support for Router-Alert IP option (RFC2113)Ashok Narayanan2000-12-131-2/+25
| | | | svn path=/trunk/; revision=2753
* Don't check the checksum of ICMP datagrams that are fragmentedGuy Harris2000-12-131-5/+4
| | | | | | (unlikely, perhaps even forbidden, but not impossible). svn path=/trunk/; revision=2752
* Add code to check the checksums of TCP segments and UDP datagrams;Guy Harris2000-12-131-45/+17
| | | | | | | | | | | | | | | | | | | replace the existing checksummer with a modified version of the BSD checksumming code. Add a flag to the "packet_info" structure to indicate that a packet is the first fragment of a fragmented datagram, so that the checksummers won't try to checksum those. (It doesn't seem to add a lot of CPU overhead, so we don't introduce a flag to disable it, yet. Further checks may be necessary to see whether the overhead is just swamped by other overheads when scanning through a capture dissecting all frames, or if it truly is negligible.) Make the Boolean preference option controlling whether to make the top-level protocol tree item for TCP display a packet summary static to the TCP dissector (it doesn't need to be accessible outside the TCP dissector). svn path=/trunk/; revision=2751
* When printing an address mask in hex, zero-pad it, don't blank-pad it.Guy Harris2000-12-081-2/+2
| | | | svn path=/trunk/; revision=2747
* Add a "col_clear()" routine, to clear a column; it appears (and itGuy Harris2000-12-041-9/+9
| | | | | | | | | | | | | | | | | | | | | | doesn't just seem to be a profiling artifact) that, at least on FreeBSD 3.4, it's significantly more efficient to clear out a column by stuffing a '\0' into the first byte of the column data than to do so by copying a null string (I guess when copying one byte, the fixed overhead of the procedure call and of "strcpy()" is significant). Have the TCP dissector set the Protocol column, and clear the Info column, before doing anything that might cause an exception to be thrown, so that if we *do* get an exception thrown, the frame at least shows up as TCP. Instead of, in the TCP dissector, constructing a string and then stuffing it into the Info column, just append to the Info column, which avoids one string copy. Pass a "frame_data" pointer to dissectors for TCP and IP (and PPP) options, so they can use it to append to the Info column. svn path=/trunk/; revision=2744
* For each column, have both a buffer into which strings for that columnGuy Harris2000-11-191-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSIGuy Harris2000-11-181-228/+229
| | | | | | | | | | | | | | | | | | | | | | 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
* Give the "null" link-layer header dissector a dissector table, and putGuy Harris2000-11-171-1/+3
| | | | | | | the BSD AF_ type values it uses into an "aftypes.h" header file for dissectors that register themselves in that dissector table include. svn path=/trunk/; revision=2653
* Check ICMP checksum. XXX - won't work if the ICMP packet is inside aGuy Harris2000-10-211-4/+26
| | | | | | fragmented IP datagram, although that's probably extremely unlikely. svn path=/trunk/; revision=2522
* Apply the patch for ECN in the IP header fromRichard Sharpe2000-09-161-9/+19
| | | | | | Ulrich Kiermayr <kie@thp.univie.ac.at> svn path=/trunk/; revision=2441
* Add the "Edit:Protocols..." feature which currently only implementsLaurent Deniel2000-08-131-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Miscellaneous code cleaningLaurent Deniel2000-08-111-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add <stdarg.h> or <varargs.h> in snprintf.h and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes - remove the check of multiple inclusions in source (.c) code (there is a bit loss of _cpp_ performance, but I prefer the gain of code reading and maintenance; and nowadays, disk caches and VM are correctly optimized ;-). - protect all (well almost) header files against multiple inclusions - add header (i.e. GPL license) in some include files - reorganize a bit the way header files are included: First: #include <system_include_files> #include <external_package_include_files (e.g. gtk, glib etc.)> Then #include "ethereal_include_files" with the correct HAVE_XXX or NEED_XXX protections. - add some HAVE_XXX checks before including some system header files - add the same HAVE_XXX in wiretap as in ethereal Please forgive me, if I break something (I've only compiled and regression tested on Linux). svn path=/trunk/; revision=2254
* Allow either old-style (pre-tvbuff) or new-style (tvbuffified)Guy Harris2000-08-071-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
* Make the ICMP top-of-protocol-tree item cover the entire rest of theGuy Harris2000-08-051-2/+2
| | | | | | packet, not just the first 4 bytes of the ICMP packet. svn path=/trunk/; revision=2211