aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/nettl.c
AgeCommit message (Collapse)AuthorFilesLines
2013-03-25Wiretap file open routines should not free wth->priv on error, since thatEvan Huus1-7/+0
leads to a double-free in wtap_close. Fix all the instances I found via manual code review, and add a brief comment to the list of open routines in file_access.c Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8518 svn path=/trunk/; revision=48552
2012-12-27Do not call wtap_file_read_unknown_bytes() orGuy Harris1-4/+4
wtap_file_read_expected_bytes() from an open routine - open routines are supposed to return -1 on error, 0 if the file doesn't appear to be a file of the specified type, or 1 if the file does appear to be a file of the specified type, but those macros will cause the caller to return FALSE on errors (so that, even if there's an I/O error, it reports "the file isn't a file of the specified type" rather than "we got an error trying to read the file"). When doing reads in an open routine before we've concluded that the file is probably of the right type, return 0, rather than -1, if we get WTAP_ERR_SHORT_READ - if we don't have enough data to check whether a file is of a given type, we should keep trying other types, not give up. For reads done *after* we've concluded the file is probably of the right type, if a read doesn't return the number of bytes we asked for, but returns an error of 0, return WTAP_ERR_SHORT_READ - the file is apparently cut short. For NetMon and NetXRay/Windows Sniffer files, use a #define for the magic number size, and use that for both magic numbers. svn path=/trunk/; revision=46803
2012-10-18Move some arguments up a line.Guy Harris1-5/+4
svn path=/trunk/; revision=45649
2012-10-17Fill some phdr values also when doing random readJakub Zawadzki1-6/+5
svn path=/trunk/; revision=45619
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-7/+7
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-2/+0
svn path=/trunk/; revision=45015
2012-06-02Try to squelch warningsAnders Broman1-1/+1
svn path=/trunk/; revision=42998
2012-05-04file_seek() used to be a wrapper around fseek() or gzseek(), both ofGuy Harris1-4/+1
which could use lseek() and were thus expensive due to system call overhead. To avoid making a system call for every packet on a sequential read, we maintained a data_offset field in the wtap structure for sequential reads. It's now a routine that just returns information from the FILE_T data structure, so it's cheap. Use it, rather than maintaining the data_offset field. Readers for some file formats need to maintain file offset themselves; have them do so in their private data structures. svn path=/trunk/; revision=42423
2012-02-25Add a presence flag field to the packet information structure filled inGuy Harris1-0/+1
by Wiretap, to indicate whether certain fields in that structure actually have data in them. Use the "time stamp present" flag to omit showing time stamp information for packets (and "packets") that don't have time stamps; don't bother working very hard to "fake" a time stamp for data files. Use the "interface ID present" flag to omit the interface ID for packets that don't have an interface ID. We don't use the "captured length, separate from packet length, present" flag to omit the captured length; that flag might be present but equal to the packet length, and if you want to know if a packet was cut short by a snapshot length, comparing the values would be the way to do that. More work is needed to have wiretap/pcapng.c properly report the flags, e.g. reporting no time stamp being present for a Simple Packet Block. svn path=/trunk/; revision=41185
2011-12-13Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports anyGuy Harris1-4/+4
form of corruption/bogosity in a file, including in a file header as well as in records in the file. Change the error message wtap_strerror() returns for it to reflect that. Use it for some file header problems for which it wasn't already being used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only be used for files that we have no reason to believe are invalid but that have a version number we don't know about or some other non-link-layer-encapsulation-type value we don't know about. svn path=/trunk/; revision=40175
2011-12-13Add missing checks for a too-large packet, so we don't blow up trying toGuy Harris1-0/+11
allocate a huge buffer. svn path=/trunk/; revision=40170
2011-09-01Use guint8 rather than guchar for raw octets and pointers to arrays ofGuy Harris1-7/+7
same. Add to wiretap/pcap-common.c a routine to fill in the pseudo-header for ATM (by looking at the VPI, VCI, and packet data, and guessing) and Ethernet (setting the FCS length appropriately). Use it for both pcap and pcap-ng files. svn path=/trunk/; revision=38840
2011-05-10file_read() can return -1; don't just blindly add it to a previousGuy Harris1-23/+36
file_read() return value. Use wtap_file_read_expected_bytes() in a number of places. svn path=/trunk/; revision=37054
2011-04-21Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discoveredGuy Harris1-12/+14
by the gunzipping code. Have it also supply a err_info string, and report it. Have file_error() supply an err_info string. Put "the file" - or, for WTAP_ERR_DECOMPRESS, "the compressed file", to suggest a decompression error - into the rawshark and tshark errors, along the lines of what other programs print. Fix a case in the Netscaler code where we weren't fetching the error code on a read failure. svn path=/trunk/; revision=36748
2011-04-12"This file format can't be written to a pipe" and "this file formatGuy Harris1-1/+1
can't be saved in compress form" are both equivalent to "this file file format requires seeking when writing it". Change the "can compress" Boolean in the file format table to "writing requires seeking", give all the entries the proper value, and do the checks for attempting to write a file format to a pipe or write it in compressed format to common code. This means we don't need to pass the "can't seek" flag to the dump open routines. svn path=/trunk/; revision=36575
2011-04-06From Jakub Zawadzki:Guy Harris1-12/+12
file_read(buf, bsize, count, file) macro is compilant with fread function and takes elements count+ size of each element, however to make it compilant with gzread() it always returns number of bytes. In wiretap file_read() this is not really used, file_read is called either with bsize set to 1 or count to 1. Attached patch remove bsize argument from macro. svn path=/trunk/; revision=36491
2011-03-25Fix Coverity CIDs 810 & 811: uninitialized variables.Gerald Combs1-0/+2
svn path=/trunk/; revision=36340
2010-06-06Don't use fwrite directly when writing a dump file; call it throughGuy Harris1-44/+6
wtap_dump_file_write(). Replace various wrappers around fwrite() with wtap_dump_file_write(), or at least make the wrappers call wtap_dump_file_write(). svn path=/trunk/; revision=33116
2010-04-26Clean up properly if we get an error after allocating the private dataGuy Harris1-1/+7
structure. svn path=/trunk/; revision=32563
2010-02-26Move the definitions of all the private data structures out ofGuy Harris1-13/+13
wtap-int.h, and change the unions of pointers to those private data structures into just void *'s. Have the generic wtap close routine free up the private data, rather than the type-specific close routine, just as the wtap_dumper close routine does for its private data. Get rid of close routines that don't do anything any more. svn path=/trunk/; revision=32015
2009-04-24[Trivial] Constify a few thingsBill Meier1-2/+2
svn path=/trunk/; revision=28144
2009-02-25From Mark C. Brown:Jaap Keuter1-6/+7
Added support for HPVM (Integrity Virtual Machines) guest AVIO (Accelerated Virtual IO) driver IGSSN. Cleaned up the trace record checks. Made the default ethernet if the nettl subsystem is not recognized. svn path=/trunk/; revision=27549
2008-05-08From Anders: Checkapi enabled for wiretap and more functions converted.Martin Mathieson1-6/+7
svn path=/trunk/; revision=25257
2008-04-12From Mark C. Brown:Jaap Keuter1-0/+2
Added support for HPVM (Integrity Virtual Machines) guest AVIO (Accelerated Virtual IO) driver IGSSN and 2nd generation 10 Gigabit Ethernet adapter AD386A driver ICXGBE. svn path=/trunk/; revision=24926
2007-10-27From Mark C. Brown:Anders Broman1-1/+27
Add support for the new NS_LS_SCTP tracing subsystem. svn path=/trunk/; revision=23290
2007-01-01From Mark C. Brown:Jaap Keuter1-36/+44
HP-UX 11.31 will add a new nettl trace subsystem, NS_LS_TELNET (ID=267). NS_LS_TELNET is just raw telnet data. There is no layer 2/3/4 headers, so there's just the HP-UX nettl record header followed directly by the TCP payload for a telnet connection. Thus the need for a new wiretap encapsulation type... svn path=/trunk/; revision=20253
2007-01-01From Mark C. Brown:Jaap Keuter1-37/+39
Fix some nettl encap types and size checks svn path=/trunk/; revision=20252
2006-11-05change all file offsets from long to gint64 so we can - theoretically - ↵Ulf Lamping1-4/+4
handle files > 2GB correct. Please distclean Win32 builds! svn path=/trunk/; revision=19814
2006-08-18Rework some of the header processing, to handle some additional nettlGuy Harris1-238/+239
files, and to clean the code up a bit - and incorporate some fixes to the rework, and other fixes, from Mark C. Brown. svn path=/trunk/; revision=18945
2006-07-26The nettl_file_hdr structure has a fixed format, as it's an on-disk dataGuy Harris1-19/+16
structure. Instead of making the host_name field bigger, make the thing we put in it smaller. Use that structure when reading files as well as when writing them. svn path=/trunk/; revision=18796
2006-07-26postadal@suse.cz:Jörg Mayer1-1/+1
Bufferoverflow caused by ethereal->wireshark rename (ws is 1 char longer). http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1015 svn path=/trunk/; revision=18794
2006-06-06Ethereal -> WiresharkGerald Combs1-2/+2
svn path=/trunk/; revision=18369
2006-05-31Tethereal/tethereal -> TShark/tshark.Gerald Combs1-1/+1
svn path=/trunk/; revision=18268
2005-08-25timestamp display precision:Ulf Lamping1-0/+1
- automatic adjustment depending on file format - manual adjustment through menu items save the setting in the recent file svn path=/trunk/; revision=15534
2005-08-24EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry! Ulf Lamping1-10/+10
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ... What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere. As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon. Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way... As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number... svn path=/trunk/; revision=15520
2005-07-08Make nettl file header items containing strings "gchar", to squelchGuy Harris1-5/+5
signed vs. unsigned compiler warnings. svn path=/trunk/; revision=14873
2005-06-04Fix some more leaks in error returns from open routines (if the open canGuy Harris1-14/+23
fail after the private data is allocated, you have to free the private data). The file header in nettl files is 128 bytes - use a #define for it, and also a #define for the magic number size. svn path=/trunk/; revision=14553
2005-05-17From Mark C Brown,:Anders Broman1-132/+76
Fixes for LAP-B (SX25L2) and X.25 (SX25L3) nettl trace records. svn path=/trunk/; revision=14385
2005-04-07updating Mark C Browns informationRonnie Sahlberg1-0/+3
svn path=/trunk/; revision=14025
2005-04-01From Mark C Brown NETTL updatesRonnie Sahlberg1-44/+94
svn path=/trunk/; revision=13999
2005-02-03Mark C. Brown: Added support for new ixgbe cardJörg Mayer1-25/+28
svn path=/trunk/; revision=13267
2004-10-19From Mark C. Brown:Guy Harris1-4/+44
fix FDDI to use correct bit swapped encap; tweak file open code to guess at file encap so merge works better. svn path=/trunk/; revision=12351
2004-10-14From Mark C. Brown: add 100VG support.Guy Harris1-0/+1
svn path=/trunk/; revision=12299
2004-10-12From Mark C. Brown: support dumping files with the raw ICMP and rawGuy Harris1-0/+10
ICMPv6 encapsulations. svn path=/trunk/; revision=12279
2004-10-12Correctly update the count of bytes dumped.Guy Harris1-2/+1
svn path=/trunk/; revision=12275
2004-10-12fix MSVC unused magic warningUlf Lamping1-2/+2
svn path=/trunk/; revision=12274
2004-10-11From Mark C. Brown: add support for writing nettl files.Guy Harris1-5/+171
svn path=/trunk/; revision=12258
2004-10-06From Mark C. Brown: add EISA 100BaseTX, EISA FDDI, and HSC FDDI support,Guy Harris1-12/+19
and make a small performance fix to HP-PB FDDI. svn path=/trunk/; revision=12218
2004-10-05From Mark C. Brown: support for the NETTL_SUBSYS_HPPB_FDDI records.Guy Harris1-37/+110
svn path=/trunk/; revision=12202
2004-10-01From Mark C. Brown: add the HP-PB FDDI card type, although we currentlyGuy Harris1-1/+9
don't have any code to handle it (other than to report that fact...). Also, refer to the subsystem type code as such, not as a "network type". svn path=/trunk/; revision=12178