Commit Graph

1678 Commits

Author SHA1 Message Date
Guy Harris f4a752873f Note that compressed Windows Sniffer files might have a CRC, just not
one computed the right way (as specified by RFC 1952).

svn path=/trunk/; revision=37032
2011-05-09 17:53:45 +00:00
Guy Harris 3de2b1be74 Get rid of the fd member of a wth structure; the FILE_T's in that
structure include a file descriptor.  Add a wtap_fstat() for the file
readers that use file times to generate time stamps (we really need a
way to say "this file has no time stamps" or "this file has only
relative time stamps).

svn path=/trunk/; revision=37026
2011-05-09 08:12:26 +00:00
Guy Harris 88a1ed85e3 From Jakub Zawadzki: for file read progress bars, use the raw offset in
the file, rather than the offset in the uncompressed data stream.  That
way we don't get the "hey, we're more than 100% into the file, better
refigure this" surprise.

svn path=/trunk/; revision=37025
2011-05-09 05:30:59 +00:00
Guy Harris 42ba70cf9c If a gzipped file's name ends in .caz, don't check the CRC - it's
probably a compressed file from the Windows Sniffer, and they don't
bother setting the CRC.

svn path=/trunk/; revision=37024
2011-05-09 03:48:41 +00:00
Guy Harris 306711b634 Note what NetMon 3 actually uses various types for.
For the ones that are used for raw IP, use WTAP_ENCAP_RAW_IP.  (Yes,
NetMon checks for v4 vs. v6 for all of them.)

svn path=/trunk/; revision=36975
2011-05-03 09:14:56 +00:00
Guy Harris 99c6704109 Set the pseudo-header regardless of whether we have a trailer or not.
svn path=/trunk/; revision=36974
2011-05-03 08:49:41 +00:00
Guy Harris 59dc3f3141 It appears that, in NetMon 802.11 captures, management frames have an
FCS and data frames don't have an FCS; I don't know about control
frames.

svn path=/trunk/; revision=36973
2011-05-03 08:22:25 +00:00
Guy Harris 3c06dfc751 Squelch a compiler warning - but note, in a comment, a real problem the
warning points out.

svn path=/trunk/; revision=36972
2011-05-03 05:50:30 +00:00
Guy Harris 491fe27a20 Fix indentation (tab stops are not guaranteed to be every 4 spaces).
svn path=/trunk/; revision=36971
2011-05-03 05:28:39 +00:00
Guy Harris c0dc916adc From Tom Brezinski - fix for bug 5869:
This patch incorporates the following fixes from the patch attached to
bug 5671 with changes as noted below:

1.) Files where the packet header and packet data are noncontiguous are
handled improperly, resulting in read misalignment and ultimately the
error message, "Observer: bad record: Invalid magic number 0xXXXXXXXX."
This bug is caused by not obeying the packet_entry_header.offset_to_frame
field.

2.) Daylight savings time is not properly accounted for in files using
local time encoding.

3.) As of Observer/GigaStor v13.10 (bug 5671 incorrectly stated v14),
timestamps in the file format changed from local time encoding to GMT
encoding.  Wiretap has been changed to support reading both formats. 
Patch submitted with bug 5671 added a separate file type to allow
writing local format.  This patch does not add the separate file type
and always writes GMT.

4.) The wtap_dumper.bytes_dumped field is not being properly incremented
as data is written to files.

This patch also incorporates the following additional enhancements /
fixes not in bug 5671:

1.) Support for reading BFR files which contain Fibre Channel captures. 
Test file Fibre_Channel_Capture.bfr attached.

2.) Support for modified file header used in upcoming v15.  New header
file format takes an unused byte from the version string to allow for a
larger offset to the first packet to be specified.  Test file
V15_Lrg_Hdr_Test.bfr is attached, it is also a fuzz test as the number
of TLV items given in the header is less then the actual.

3.) It was found that if the number of TLV items given in the header was
larger then present it would fail to open the file.  Test file
V9_Num_TLVs_Too_Big.bfr is attached.

svn path=/trunk/; revision=36970
2011-05-03 05:26:10 +00:00
Jakub Zawadzki 229adbc1e5 configure: remove test for gzclearerr (not used anymore), add test for inflatePrime.
svn path=/trunk/; revision=36949
2011-04-29 07:49:55 +00:00
Anders Broman a663d91ca6 From Hans-Christoph Schemmel:
A variant of 3GPP TS 27.010 multiplexing protocol dissector.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5829

svn path=/trunk/; revision=36927
2011-04-28 05:36:26 +00:00
Bill Meier 4e782042de #include <stdlib.h> not needed;
use consistent indentation.

svn path=/trunk/; revision=36921
2011-04-28 01:07:43 +00:00
Bill Meier 856254da59 From Yaniv Kaul: some 'set but not used' compilation fixes;
From me:
 - #include <stdlib.h> not needed;
 - Use consistent indentation;
 - use #if 0/#endif to comment out code rather than /* */

svn path=/trunk/; revision=36884
2011-04-27 03:45:19 +00:00
Bill Meier f4323af2b2 Based upon a patch from Yaniv Kaul: Comment out unused assignmeent/variables;
From me:
  - remove unneeded #include <stdlib.h>;
  - fix some indentation;
  - use #if 0/#endif rather that /* */ to comment out some code

svn path=/trunk/; revision=36883
2011-04-27 03:13:08 +00:00
Guy Harris f7390f0ea9 *Properly* get rid of bogus cast.
svn path=/trunk/; revision=36791
2011-04-22 03:27:40 +00:00
Guy Harris 7c378ed025 Cast away alignment warnings about pointers where we never actually
directly dereference pointers to the field members.

Get rid of an unnecessary cast that provokes warnings.

svn path=/trunk/; revision=36789
2011-04-22 03:12:18 +00:00
Guy Harris 8260657dfd Cast away warnings about "struct sockaddr" -> "struct sockaddr_XXX"
casts that are actually safe.

svn path=/trunk/; revision=36788
2011-04-22 03:11:14 +00:00
Guy Harris c317a1c3cd Make all the fields in the various structures just arrays of bytes, so
we can cast not-necessarily-aligned pointers to pointers to those
structures without risk of compiler warnings *or* the underlying problem
the compiler's trying to warn us about (no, you can't always dereference
an unaligned pointer - SPARC traps, and at least some ARM processors may
do something other than what you want, for example).

This also caught some cases where we were not even properly
byte-swapping on big-endian platforms.

This also lets us not muck around with splitting 64-bit times into two
32-bit fields - we have pletohll(), after all.

svn path=/trunk/; revision=36787
2011-04-22 03:10:22 +00:00
Guy Harris 3edd2b5b0d In a dump_open routine, you don't need to seek to the beginning of the
file before doing any writes - it starts out at the beginning of the
file.  This means that you *can* write a Network Instruments capture
file to a pipe, or write it out in compressed form, now that its
dump_open routine no longer seeks.

NetXRay format and K12 binary format, however, *do* require a seek when
writing them.

svn path=/trunk/; revision=36776
2011-04-21 18:33:20 +00:00
Guy Harris 140cc563c6 In file_wrappers.c, explicitly set err_info to null for all errors that
don't have an "additional information" string.

Get rid of WTAP_ERR_ZLIB; just report an internal error with
WTAP_ERR_INTERNAL instead.  (If they start happening, we can think about
supplying an "additional information" string for compression errors on
output.)

svn path=/trunk/; revision=36774
2011-04-21 17:51:19 +00:00
Guy Harris 6cbf6ce16c Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discovered
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-21 09:41:52 +00:00
Guy Harris ff783ad1d5 Always check whether NEXT() failed - and rename it to GZ_GETC(), as it
has semantics similar to getc().

If it fails due to an EOF, set state->err to WTAP_ERR_SHORT_READ to
report a premature EOF; otherwise, raw_read() has already set
state->err, so don't set state->err to something else - that loses the
errno value in favor of a generic "bad data" error.

svn path=/trunk/; revision=36744
2011-04-20 21:36:23 +00:00
Guy Harris c93f8694e3 Sigh. The "data" element of a GArray is, alas, a "gchar *", not a "void
*", and some compilers complain when you cast that pointer to something
requiring stricter alignment.  Maybe the intent is to nudge you into
thinking about whether the pointer really is properly aligned, but....

svn path=/trunk/; revision=36739
2011-04-20 18:04:43 +00:00
Guy Harris 0aeaa16426 pntohll() takes a guint8 * as an argument; there's no need to cast to a
guint64 *, and it causes clang to complain.

svn path=/trunk/; revision=36738
2011-04-20 17:53:11 +00:00
Michael Tüxen 034373cb86 Unbreak live capture using pcapng.
svn path=/trunk/; revision=36714
2011-04-19 13:28:17 +00:00
Chris Maynard 7f06b2e217 Wrap actual_len inside #ifdef DEBUG_K12 to avoid gcc 4.6.0 warning reported by
Kaul: http://www.wireshark.org/lists/wireshark-dev/201104/msg00170.html

svn path=/trunk/; revision=36710
2011-04-18 20:03:32 +00:00
Chris Maynard e4c6b7d0c3 Update Motonori Shindo's email address at the author's request. Fixes bug 5840.
svn path=/trunk/; revision=36695
2011-04-18 02:16:36 +00:00
Stig Bjørlykke bf28f7247c Mark err as unused in k12text_dump_open().
svn path=/trunk/; revision=36682
2011-04-17 17:49:02 +00:00
Guy Harris cd1a4b036c Return ENOMEM if we run out of memory. (We're either running on UN*X,
in which case ENOMEM is the right error, or we're running on Windows but
using UN*Xy routines, in which case ENOMEM is the right error; unlike
zlib, we don't have to run on a whole pile of OSes.)

svn path=/trunk/; revision=36648
2011-04-15 07:27:03 +00:00
Tomas Kukosa 5653540de6 Export new file_...() functions from libwiretap.dll
svn path=/trunk/; revision=36640
2011-04-14 09:02:01 +00:00
Guy Harris 7fa71ab07e Check for _setmode() failing, Just In Case. Squelches some MSVC static
analyzer warnings.

Return an actual error if we're failing because we're trying to write to
the standard output in compressed mode.

svn path=/trunk/; revision=36636
2011-04-14 02:53:18 +00:00
Guy Harris e5f767cb50 #if 0 out some unused variables; we may make use of them later, but this
keeps GCC 4.6.0 from complaining about them and failing to build with
-Werror, and may also squelch some Coverity (and other static analyzer)
complaints.

svn path=/trunk/; revision=36599
2011-04-12 18:21:05 +00:00
Guy Harris 92c974f2f7 Now that wtap_read() checks for delayed errors on EOF, there's no need
to check for it on close.

svn path=/trunk/; revision=36593
2011-04-12 17:37:05 +00:00
Guy Harris fd96236cdf From Jakub Zawadski: some small fixes.
From me: small indentation fix (use spaces rather than tabs in all lines
in that routine).

svn path=/trunk/; revision=36591
2011-04-12 16:31:16 +00:00
Guy Harris 91e1769ac5 Update and expand some comments.
In the end-of-stream code, when we're checking the CRC and length, don't
check the CRC or length if we failed to read them, and don't check the
length if the CRC is bad.

We define O_BINARY as 0 on UN*X in <wsutil/file_util.h>, so we don't
need to avoid using it on UN*X.

In file_gets(), check for delayed errors.

svn path=/trunk/; revision=36590
2011-04-12 16:21:14 +00:00
Martin Mathieson b76b05b75b A parameter isn't used if ZLIB isn't enabled.
svn path=/trunk/; revision=36584
2011-04-12 14:33:31 +00:00
Guy Harris bbcb51276a If we hit an EOF - wth->subtype_read returns FALSE, but sets *err to 0 -
call file_error() to fetch any deferred error, so we report an error
rather than an "everything's OK" EOF.

svn path=/trunk/; revision=36578
2011-04-12 03:27:10 +00:00
Guy Harris b28ee8b331 From Jakub Zawadzki: speed up random access to gzipped files, as per the
zran.c example in the zlib source.

This means that problems in the file's contents might not be reported
when a packet is read, as long as there's no problem in the contents of
the file up to the last bit of compressed data for the packet; we now
check for errors after finishing the sequential read of the file, at
least in some programs, so that shouldn't be an issue (the other
programs need to be changed to do so as well).  This is necessary in
order to be able to read all the packets we saw in the sequential pass;
it also lets us get a few more packets from truncated files in some
cases.

svn path=/trunk/; revision=36577
2011-04-12 02:40:14 +00:00
Guy Harris e5fe0128d7 Allow wtap_sequential_close() and wtap_close() to return an error; this
may happen if, when reading a compressed file, we find an error in the
file's contents past the last packet (e.g., the file being cut short so
that we can't get a full buffer worth of compressed data), and that
reporting of that error is delayed (so that you can get all of the
packets that we *can* decompress).  Check for those errors, at least on
the sequential read pass (the only errors we should see when closing the
random stream are errors we've already seen in the sequential stream).

svn path=/trunk/; revision=36576
2011-04-12 01:36:12 +00:00
Guy Harris 2b8ebd389b "This file format can't be written to a pipe" and "this file format
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-12 00:44:44 +00:00
Guy Harris f5f74bed3d Use ws_open(), not open(), so we handle UTF-8 pathnames on Windows.
Update or remove some additional "we don't have ferror() in zlib"
comments to reflect the current reality.

svn path=/trunk/; revision=36568
2011-04-11 22:19:01 +00:00
Guy Harris 35c66a1745 Remove a no-longer-valid comment (we're not using zlib's I/O routines,
and the routines we're now using guarantee that an error has occured in
that case).

svn path=/trunk/; revision=36567
2011-04-11 22:11:44 +00:00
Guy Harris b184c69559 Don't use the zlib I/O routines for writing compressed files, either;
this frees us from worrying about zlib large file issues on the write
side, and also lets us clean up a few other things.

svn path=/trunk/; revision=36563
2011-04-11 21:33:22 +00:00
Guy Harris a6fc7f14c4 To fill in a ws_statb64, you must use ws_fstat64.
Declare ws_stdio_stat64, as that's its new name.

svn path=/trunk/; revision=36549
2011-04-10 22:04:14 +00:00
Guy Harris 4fdcc5c180 Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64
as an argument, along the lines of ws_fstat64, and, on Windows, make it
use _wstati64, to handle 64-bit file sizes.

svn path=/trunk/; revision=36547
2011-04-10 20:59:10 +00:00
Guy Harris 0629b7399a Define ws_statb64 to be the appropriate "struct XXX" for a
64-bit-file-size-capable stat call, and use it for ws_fstat64().

svn path=/trunk/; revision=36545
2011-04-10 19:56:06 +00:00
Guy Harris 71d4caa5b9 Add ws_fstat64(), defined to be fstat on UN*X and _fstati64 on Windows.
Use it in some places where we're getting the file size.

svn path=/trunk/; revision=36544
2011-04-10 18:55:06 +00:00
Guy Harris c349caf925 Use AC_SYS_LARGEFILE to turn on large file support on platforms that
support it.

Rename ws_lseek to ws_lseek64, as it should be given a 64-bit offset,
and have it use _lseeki64 on Windows, to try to get 64-bit offset
support; AC_SYS_LARGEFILE should cause lseek() to support 64-bit offsets
on UN*X if possible.

svn path=/trunk/; revision=36542
2011-04-10 18:22:47 +00:00
Guy Harris f3502974a0 Point to RFC 1952 as a description of the gzip file format.
Point to pages for some other compressed file formats we might want to
support.

svn path=/trunk/; revision=36539
2011-04-10 17:01:13 +00:00
Guy Harris f27f61ac9e Move the definition of the structure pointed to by a FILE_T into
wiretap/file_wrappers.c; nothing outside of file_wrappers.c needs to
know what it looks like, it just passes around pointers to it.

svn path=/trunk/; revision=36538
2011-04-10 16:53:32 +00:00
Guy Harris de938dddce Just make the fh member of a wtap_dumper_t a void * for now, and, in all
calls that use it, cast it to whatever it's supposed to be.  Making it a
gzFile means you can't use any stdio macros that reach inside the
structure; making it a FILE *, as it used to be, amounts to trying to
use a FILE * as a void * if we're writing a compressed file out.

svn path=/trunk/; revision=36521
2011-04-08 17:42:20 +00:00
Anders Broman 19642f9dc0 Make wtap plugins build on windows again.
svn path=/trunk/; revision=36517
2011-04-08 15:57:44 +00:00
Guy Harris 44462adc0f Change ng_file_read() to take only one size argument - and make it an
unsigned int - to match file_read().  Shrink some arguments, variables,
and structure members appropriately.

Fix an incorrect sizeof - sizeof a pointer is the size of the pointer,
not the size of what it points to.

svn path=/trunk/; revision=36515
2011-04-08 01:57:02 +00:00
Guy Harris f3873931ec To squelch some compiler warnings, temporarily cast the argument to
ws_lseek() to the appropriate type for the second argument to _lseek()
for Windows or lseek() for UN*X; ultimately, we want to call the
appropriate 64-bit-offset seek routine if available, otherwise cast the
value down and hand it to the 32-bit-offset seek routine.

svn path=/trunk/; revision=36514
2011-04-08 01:55:25 +00:00
Guy Harris ab261a3281 From Jakub Zawadzki:
Steal file_wrappers functions from zlib v2.

svn path=/trunk/; revision=36513
2011-04-08 00:28:37 +00:00
Gerald Combs 56bc7f5e47 Be more picky about our sscanf integer field widths. Hopefully this will
help squelch Coverity CIDs 701-709.

svn path=/trunk/; revision=36511
2011-04-07 23:16:05 +00:00
Guy Harris d00527f369 From Jakub Zawadzki:
Introduce file_clearerr

	I'm unsure of this patch, 

	gzclearerr() is used to clear the end-of-file mark, but for FILE
	there's function which do the same (clearerr).

	I created test program if clearerr() is needed for tailing file. 
	and it seems to work without it (at least on Linux, so for
	!HAVE_LIBZ I commented it out).

	For now this patch introduce file_clearerr macro, and define it
	only when EOF marking must be cleared (i.e.  when HAVE_LIBZ and
	HAVE_GZCLEARERR are defined).

	So everything works like before, patch just to keep same prefix
	for file interface :)

svn path=/trunk/; revision=36510
2011-04-07 21:53:31 +00:00
Guy Harris f73c579d55 From Jakub Zawadzki:
file-wrappers.[ch] is used only for reading files, and mode is always
"rb".

Attached patch removes 'mode' argument from file_open() & filed_open().

svn path=/trunk/; revision=36493
2011-04-06 07:09:56 +00:00
Guy Harris 7fa6d929cf From Jakub Zawadzki: fix the type of an argument.
svn path=/trunk/; revision=36492
2011-04-06 06:59:19 +00:00
Guy Harris 4c93827e34 From Jakub Zawadzki:
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-04-06 06:51:19 +00:00
Chris Maynard 9e49109b28 Check return value of file_seek(). Fixes CID 338.
svn path=/trunk/; revision=36425
2011-03-31 18:28:52 +00:00
Chris Maynard b92bf3b06c Use BSWAP16 instead of BSWAP32 for 16-bit values. Fixes CID's 1179 and 1180.
svn path=/trunk/; revision=36422
2011-03-31 16:46:16 +00:00
Jeff Morriss 607d944d02 Don't put a 196808 byte variable on the stack: instead, malloc/free it.
Coverity 789-790.

Since we've been keeping track of how many bytes we put in the buffer,
use that value instead of calling strlen() find it again.

Also, some white space/indentation cleanup.

svn path=/trunk/; revision=36397
2011-03-29 14:29:45 +00:00
Jeff Morriss ce392b5764 Don't put a 65536 byte variable on the stack: instead, malloc/free it.
Coverity 791-794.

Also, some white space/indentation cleanup.

svn path=/trunk/; revision=36394
2011-03-29 14:05:28 +00:00
Guy Harris 173708364c More updates to the wtap_open_offline() comment.
svn path=/trunk/; revision=36384
2011-03-28 17:23:06 +00:00
Anders Broman 08f71f1232 Update a comment.
svn path=/trunk/; revision=36376
2011-03-28 13:09:47 +00:00
Stig Bjørlykke a39c0d9577 Added a missing break.
Coverity 492.

svn path=/trunk/; revision=36356
2011-03-27 13:15:14 +00:00
Gerald Combs 4ee10e769e Fix Coverity CIDs 810 & 811: uninitialized variables.
svn path=/trunk/; revision=36340
2011-03-25 23:45:48 +00:00
Anders Broman f14e039375 Make it build on Windows 7
(pcapng.c(1817) : warning C4267: '=' : conversion from 'size_t' to 'gint', possible loss of data)

svn path=/trunk/; revision=36325
2011-03-25 06:42:59 +00:00
Gerald Combs 1cc613c32d Add a missing include.
svn path=/trunk/; revision=36321
2011-03-24 23:33:38 +00:00
Gerald Combs fcf51fc73b Add initial pcapng name resolution record support. Wireshark has read
support; TShark has read+write support. Additionally TShark can read a
"hosts" file and write those records to a capture file.

This uses "struct addrinfo" in many places and probably won't compile on
some platforms.

svn path=/trunk/; revision=36318
2011-03-24 22:47:57 +00:00
Guy Harris 423e428441 Use the same style in netscreen_seek_read() that we use in
netscreen_read(), checking the return value of
parse_netscreen_hex_dump() against -1 and explicitly returning FALSE if
it's -1, otherwise driving on.

svn path=/trunk/; revision=36237
2011-03-22 07:42:45 +00:00
Sake Blok 5a1cdb5754 Fix for bug 5762, wireshark asserts on reading juniper snoop output when no hex data is present (snoop detail off).
svn path=/trunk/; revision=36232
2011-03-21 22:04:22 +00:00
Martin Mathieson f558138026 Avoid having large buffers on the stack (as noted in VS Code Analyzer warnings).
svn path=/trunk/; revision=36202
2011-03-16 22:53:41 +00:00
Bill Meier 16b528aaf1 From Martin Kaiser: dissector for DVB-CI (Common Interface)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5654

From me:
- Entry for DVBCI added to wtap.c encap_table_base[];
- Some code simplification with respect to the use of col_...() for COL_INFO;
- Certain tests for "enough bytes available" not really needed;
- (Other minor tweaks);
- #include<stdio.h> not req'd;
- Minor reformatting and whitespace cleanup;


svn path=/trunk/; revision=36149
2011-03-07 02:22:48 +00:00
Bill Meier 0d7508cf8e From Robert Bullen: ... code is not incrementing wtap_dumper.bytes_dumped.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5666

Fro me: use 4 -space indentation (not tab) to match surrounding code lines.

svn path=/trunk/; revision=36074
2011-02-25 20:33:43 +00:00
Bill Meier 39c2e1f71d From Robert Bullen: Fix "Potential access violation when writing to LANalyzer files"
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5698

(Note from me: Before the fix "File ! Save As" in Lanalyzer format
                crashed quite consistently on my Windows 7)

svn path=/trunk/; revision=36061
2011-02-25 00:40:22 +00:00
Bill Meier 3dc7697930 Revert SVN #36059; patch from Bug #5698 to be used instead
svn path=/trunk/; revision=36060
2011-02-25 00:26:37 +00:00
Bill Meier 60817fb9a1 Fix Bug #5698: "Potential access violation when writing to LANalyzer files"
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5698

Note: before fix
 File ! SaveAs  in Lanalyzer format crashed quite consistently on Windows.

svn path=/trunk/; revision=36059
2011-02-25 00:15:34 +00:00
Guy Harris 965ecf3056 Return an error value for the new error return; it "can't happen" (but
either the VC++ analyzer can't determine that or it *can*, in fact,
happen).  Pick an error code that's not too far off.

svn path=/trunk/; revision=35957
2011-02-16 02:21:31 +00:00
Guy Harris 59f65ab815 Check the index before storing into the array.
svn path=/trunk/; revision=35956
2011-02-16 02:16:12 +00:00
Gerald Combs b2d28ce435 Fix checkapi.
svn path=/trunk/; revision=35955
2011-02-16 01:28:29 +00:00
Gerald Combs 8af7080001 Fix errors found by the Visual C++ analyzer.
svn path=/trunk/; revision=35954
2011-02-16 00:44:12 +00:00
Gerald Combs f3bbbce5e3 Fix a buffer overflow found by the Visual C++ analyzer.
svn path=/trunk/; revision=35953
2011-02-16 00:42:06 +00:00
Guy Harris a595f69ce4 The lack of _WITH_PHDR in WTAP_ENCAP_BLUETOOTH_H4 means there's no
pseudo-header, and hence there's no direction indication. Don't set
pinfo->p2p_dir for it.  Use WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR, not
WTAP_ENCAP_BLUETOOTH_H4, for capture files where we have the direction.

Don't assume pinfo->p2p_dir is either P2P_DIR_SENT or P2P_DIR_RECV when
setting the info column in various Bluetooth dissectors; it might be
unknown.

In the HCI H4 dissector, put the direction into the info column
regardless of whether we have a type match or not; the dissectors for
HCI packet types appear to assume it's been set (as they put a blank at
the beginning of the stuff they append to the direction).

svn path=/trunk/; revision=35933
2011-02-12 19:59:41 +00:00
Guy Harris d63741d566 Add some information based on a Tektronix manual whose name popped up in
an email I found when looking for some other stuff and which I then
found with a Google search.

svn path=/trunk/; revision=35898
2011-02-10 18:27:39 +00:00
Gerald Combs 6e66cae876 Check for a large packet_len. Fixes a bug reported by Huzaifa
Sidhpurwala of the Red Hat Security Response Team.

See also: bug 5661.

svn path=/trunk/; revision=35855
2011-02-07 19:39:05 +00:00
Guy Harris f5bfa67b11 Set the error code and additional information string in more cases.
svn path=/trunk/; revision=35809
2011-02-04 09:45:39 +00:00
Guy Harris 4849599a13 Set *err before *err_info - that's how it's done in most other modules.
svn path=/trunk/; revision=35807
2011-02-04 08:10:08 +00:00
Guy Harris 52638933cb Set *err before *err_info - that's how it's done in most other modules.
svn path=/trunk/; revision=35806
2011-02-04 08:09:35 +00:00
Guy Harris 5399384c29 Set *err before *err_info - that's how it's done in most other modules.
svn path=/trunk/; revision=35805
2011-02-04 08:09:17 +00:00
Guy Harris 79b01c78be Fix indentation.
svn path=/trunk/; revision=35804
2011-02-04 08:07:50 +00:00
Guy Harris 17d1226a56 Put more data into the "additional error information" messages.
Get rid of debugging printouts that are equivalent to the "additional
error information" messages.

Return additional error info for all WTAP_ERR_BAD_RECORD errors.

svn path=/trunk/; revision=35800
2011-02-04 02:24:33 +00:00
Jeff Morriss 84af13f080 (As in the Windows builds) don't have checkapi check the 'abort' group in wiretap.
svn path=/trunk/; revision=35797
2011-02-04 02:10:15 +00:00
Jeff Morriss 1587ac63d8 Use g_strdup() instead of strdup()
svn path=/trunk/; revision=35796
2011-02-04 02:08:47 +00:00
Gerald Combs 0c9649929e From Huzaifa Sidhpurwala of the Red Hat Security Response Team: Don't
free uninitialized memory.

See also: bug 5652.

svn path=/trunk/; revision=35791
2011-02-03 22:50:49 +00:00
Jaap Keuter 9e367f5cff From njohnkev:
Add support for LAPD data link type.

svn path=/trunk/; revision=35771
2011-02-02 22:49:40 +00:00
Bill Meier d3efa3ed9f A bit of Windows makefiles rework and cleanup:
- Define macros for certain CFLAGS in config.nmake iso of having defs in each makefile;
  a. -DHAVE_CONFIG_H and -D_U_="" are now part of a macro named STANDARD_CFLAGS;
  b. -WX has been replaced by WARNINGS_ARE_ERRORS (defined as -WX in config.nmake)
      (This allows disabling "Warnings as Errors" by just changing config.nmake)
  c. CVARSDLL definitions (not usage) have been removed from the various makefiles.
     XXX: It appears the usage of CVARSDLL can also be removed (not yet done) since:
     -DWIN32 and -DNULL=0 do not appear to be needed (any more);
     -D_MT and _D_DLL  are not needed since /MP causes these definitions.
  d. Define a macro WARNINGS_CFLAGS with additional specific compiler (level4) warnings to be enabled.
     E.G., 4295: array is too small to include a terminating null character
- config.nmake: reformat some long lines for readability;
- plugins\Makefile.nmake: clean-deps does nothing: remove it (and usage in top-level makefile);
- dissectors/Makefile.nmake: test to enable packet-rrc.obj target needs to include MSVC2010 ...

svn path=/trunk/; revision=35747
2011-02-02 01:19:53 +00:00
Martin Mathieson 9ca092db13 Return a string (even though abort is called first) to pacify gcc.
svn path=/trunk/; revision=35724
2011-01-31 16:38:40 +00:00
Bill Meier 7f0107220d Fix various instances of "unreachable code".
svn path=/trunk/; revision=35713
2011-01-30 23:27:57 +00:00
Stephen Fisher fc7b0c019b Fix the dead initialization warnings found by clang's static analysis
("Value stored to 'xxx' during its initialization is never read")


svn path=/trunk/; revision=35598
2011-01-20 18:56:11 +00:00
Martin Mathieson 7a0f12239c Support FP_R8 over ATM, plus a couple of other tidying-ups.
svn path=/trunk/; revision=35373
2011-01-05 14:36:48 +00:00
Guy Harris a22e640a8d We must always return an error code on an error; otherwise, our caller
will see random crap as the error code.

However, if we're skipping a "TCPIPTRACE-W-BUFFERSFUL" error, if the
"error" we get is an end-of-file indication, that's *not* an error.

It is, however, ultimately a "we dropped some packets" indication; add a
comment noting that we should eventually treat it as such.

svn path=/trunk/; revision=35337
2011-01-03 09:17:20 +00:00
Guy Harris c8fd1ca472 It is not guaranteed that the records in numerical (frame table) order
will be in sequential (byte offset) order in the file; don't treat the
record offset going backwards as an error.

svn path=/trunk/; revision=35291
2010-12-28 20:32:58 +00:00
Stephen Fisher a7c89cdfd6 Fix bug #5509: CommView file format now uses reserved bytes and adds a
new use for the direction field per:

  http://www.tamos.com/htmlhelp/commview/logformat.htm

Add basic support for new fields and don't reject files that fit the new
format.


svn path=/trunk/; revision=35234
2010-12-20 23:34:14 +00:00
Jaap Keuter 7e16ec5b99 Prepare for handling DLT_IPV4 and DLT_IPV6.
svn path=/trunk/; revision=35223
2010-12-19 18:46:08 +00:00
Jeff Morriss fb83d1bba8 Fill out libwiretap's DEPENDENCIES line with the rest of the dependencies (from LIBADD).
svn path=/trunk/; revision=35146
2010-12-07 14:28:28 +00:00
Balint Reczey 8b4573f705 Make libtool export only symbols listed in *.def files
svn path=/trunk/; revision=35145
2010-12-07 13:38:15 +00:00
Chris Maynard 2c5b94680c Fix typos.
svn path=/trunk/; revision=35063
2010-11-29 17:22:05 +00:00
Chris Maynard dbe63e9730 Add support for USB isochronous. From Marton Nemeth via bug #5370.
svn path=/trunk/; revision=35025
2010-11-24 17:33:58 +00:00
Anders Broman cc8992668c Try to fix the build for text_import_scanner.
Please check if the compile flags are OK...
3:d time lucky ?

svn path=/trunk/; revision=34862
2010-11-13 16:47:57 +00:00
Anders Broman 8722e8576b From Robert Bullen:
Network Instruments' trace files sometimes cannot be read with an error message of "Observer: bad record: Invalid magic number"
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5330

svn path=/trunk/; revision=34783
2010-11-05 07:14:21 +00:00
Jaap Keuter d6c7ebee86 From Alexis La Goutte:
Replace all *_min()/*_max() by MIN() and MAX().

svn path=/trunk/; revision=34770
2010-11-04 06:37:58 +00:00
Anders Broman 37e8e4cde6 From Stephen Donnelly:
Wireshark tools do not detect and read some ERF files correctly
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5344

svn path=/trunk/; revision=34665
2010-10-28 14:33:55 +00:00
Jeff Morriss e80ecd628c Fix a cut-n-pasteo in a comment.
svn path=/trunk/; revision=34603
2010-10-21 14:23:22 +00:00
Bill Meier ce9f471175 From Jeff Morriss: Fix crash: WTAP_ERR_BAD_RECORD error return needs to fill in *err_info.
From me: For ipfix_open() don't actually return with *err=WTAP_ERR_BAD_RECORD.
Also: Move #define RECORDS_FOR_IPFIX_CHECK to ipfix.c from ipfix.h since
      the definition is only used in ipfix.c.

svn path=/trunk/; revision=34589
2010-10-20 17:20:56 +00:00
Bill Meier 54fa1f56da Fix bug which caused ascend_open() to return "I/O error" (instead of "not me").
(This happened if ascend_open was called with *err != 0).

svn path=/trunk/; revision=34588
2010-10-20 17:07:55 +00:00
Bill Meier c587b61e2d Fix a typo in a comment
svn path=/trunk/; revision=34586
2010-10-20 15:14:56 +00:00
Bill Meier 25130bd482 From Hadriel Kaplan: Update wiretap/README.developer
svn path=/trunk/; revision=34578
2010-10-20 01:15:12 +00:00
Bill Meier 9787a5734a From Hadriel Kaplan: IPFIX file format support.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5242

svn path=/trunk/; revision=34576
2010-10-20 00:36:53 +00:00
Guy Harris e81797342e Make it a bit clearer what's going on - ASCII '0' has the decimal value
48, and that's converting '0'-'9' to 0-9.

svn path=/trunk/; revision=34326
2010-10-02 08:04:15 +00:00
Jörg Mayer 4bfd2dfdf1 - FindGLIB2.cmake updates from
http://www.opensync.org/browser/branches/3rd-party-cmake-modules/modules
  + split out FindGMODULE2.cmake
  + contains /sw/... by default
  + supposedly tested on OSX
- Disable pcre for cmake builds by default, gregex should be
  picked up automatically if glib2 is not too old.

Should you have trouble linking due to some libgmodule... stuff
undefined, please add "${GMODULE2_LIBRARIES}" after "${GLIB2_LIBRARIES}"
an report back.

svn path=/trunk/; revision=34248
2010-09-25 15:38:12 +00:00
Jörg Mayer 79d806450f H.sivank:
Cmake fixes.

svn path=/trunk/; revision=34225
2010-09-23 21:14:23 +00:00
Jörg Mayer de68ad3066 H. Sivank <hsivank@gmail.com>
I try to configure Wireshark with cmake on macosx 10.6.
It fails with : set_target_properties called with incorrect number of arguments.
Attached a patch to fix this issue.


svn path=/trunk/; revision=34201
2010-09-23 07:02:33 +00:00
Jeff Morriss 80d78c6794 Very old versions of libz (such as the one that comes with Solaris 10) don't have gzclearerr(). Check for that function and only use it if we have it.
svn path=/trunk/; revision=34187
2010-09-22 21:51:53 +00:00
Bill Meier 5dfb597163 Fix issue which causes daintree-sna frames to be rejected with "capture length > packet length".
This fix adds back two lines of code removed in SVN #33678.

 "Define WTAP_ENCAP_IEEE802_15_4_NOFCS, for use in file formats that don't
  include the FCS, and use it for the Daintree SNA file format. [...]"

This fix just restores the discarding of two end-of-frame "pad" bytes as each frame is read
from the capture file; This seems to me to be the correct behaviour.



svn path=/trunk/; revision=33909
2010-08-24 14:59:11 +00:00
Anders Broman 95901a9b76 From Hamish Moffatt:
daintree-sna.c doesn't initialise capture_file snapshot_length.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5128

svn path=/trunk/; revision=33904
2010-08-24 05:44:55 +00:00
Guy Harris 414dadf6ba Add a note.
svn path=/trunk/; revision=33741
2010-08-08 23:32:40 +00:00
Stig Bjørlykke 166ffa49aa From Jon Smirl:
Added "IEEE 802.15.4 Wireless PAN no fcs".

svn path=/trunk/; revision=33728
2010-08-07 09:44:54 +00:00
Guy Harris 11b9ed0426 Define WTAP_ENCAP_IEEE802_15_4_NOFCS, for use in file formats that don't
include the FCS, and use it for the Daintree SNA file format.  While
we're at it, explicitly check to make sure the purported packet length
gives it at least one byte of packet data, and fix some print formats to
use %u for unsigned values.

svn path=/trunk/; revision=33678
2010-07-30 02:30:50 +00:00
Guy Harris 99a086051b At least in some NetMon 3.4 VPN captures, the per-packet link-layer type
is 0, but the packets have Ethernet headers.  We handle this by mapping
0 to WTAP_ENCAP_ETHERNET.

(XXX - should we, instead, use the per-file link-layer type?)

svn path=/trunk/; revision=33620
2010-07-23 10:11:44 +00:00
Guy Harris 1da49c2899 The 32-bit unsigned time offset in version 1.x files should be converted
to a gint64 (which won't sign-extend it) before multiplying by 1000, so
that the product is 64-bit and won't overflow.

svn path=/trunk/; revision=33609
2010-07-21 18:37:01 +00:00
Guy Harris 45c49c957f According to mail from Paul Long at Microsoft, in the 1.x NetMon file
format, the time offset from the start of the capture always had a
positive value, so it's an unsigned value.  (In newer versions of NetMon
3.x, the capture can start before the "capture start" time stamp is set,
so packets can have a *negative* offset from the capture start time
stamp.  Those captures are in the 2.x file format.)

svn path=/trunk/; revision=33607
2010-07-21 16:25:59 +00:00
Guy Harris d1751061c8 Initial support for Network Monitor 802.11 radio header.
svn path=/trunk/; revision=33583
2010-07-19 18:00:20 +00:00
Guy Harris 8c19a3441f Add an entry in encap_table_base for SocketCAN.
svn path=/trunk/; revision=33578
2010-07-18 22:14:56 +00:00
Guy Harris 9903a7853c The time delta in a NetMon frame header is signed - it can be negative.
svn path=/trunk/; revision=33576
2010-07-18 20:47:48 +00:00
Guy Harris 770dc398a4 NetMon per-packet link-layer types with 0xE000 in the upper 4 bits are
converted pcap files; the LINKTYPE_ value is in the lower 12 bits.

svn path=/trunk/; revision=33574
2010-07-18 20:27:46 +00:00
Guy Harris 6cb47bde7a Initial support for the trailer information in versions 2.1 and later of
the NetMon file format.  Currently, we just use the network type field,
and we ignore all the special record types and don't try to handle any
of the other special network types.

We also catch bogus frame tables where the record is bigger than the
frame table says it is.

svn path=/trunk/; revision=33572
2010-07-18 19:41:11 +00:00
Martin Mathieson b3f57106d4 It makes (slightly) more sense for comments to be "sent" by the context than "received".
svn path=/trunk/; revision=33552
2010-07-16 13:52:18 +00:00
Stig Bjørlykke 30f105640f Don't pass tvb data to col_set_str(), as it will not stay around.
Added support for Note (dumping as text).
Renamed Info to Power (as used in PacketLogger).

svn path=/trunk/; revision=33526
2010-07-14 20:24:38 +00:00
Gerald Combs bc9f8d0cd7 Add Visual C++ project files to the distribution.
svn path=/trunk/; revision=33386
2010-06-30 23:20:03 +00:00
Guy Harris a88d19d961 Clean up indentation.
svn path=/trunk/; revision=33118
2010-06-06 22:35:33 +00:00
Guy Harris 2206464efb Get rid of file_write(); nobody uses it, and file writers should use
wtap_dump_file_write() (it does the right error checking for you, and
returns FALSE on failure and gives you the right error code).

svn path=/trunk/; revision=33117
2010-06-06 22:24:48 +00:00
Guy Harris 194cfe2d2f Don't use fwrite directly when writing a dump file; call it through
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-06-06 22:19:30 +00:00
Guy Harris ae3049a04f Move the seekback stuff out of esc_read() to the one place where it's
done.

Use the wtap_dump_file_ routines to write out capture files, and check
for errors.

Use the phton macros, when available, to translate to big-endian byte
order.  Add a new phton24() macro.

Clean up indentation.

svn path=/trunk/; revision=33114
2010-06-06 19:37:49 +00:00
Guy Harris 1bf478fdef Rename wtap_dump_file_write_all() to wtap_dump_file_write(), and have
everybody use it; the places using the old wtap_dump_file_write() were
using it in the same way the old wtap_dump_file_write_all() did.

That also lets us get rid of wtap_dump_file_ferror().

Also, have the new wtap_dump_file_write() check for errors from
gzwrite() and fwrite() differently - the former returns 0 on error, the
latter can return a short write on error.

svn path=/trunk/; revision=33113
2010-06-06 19:14:32 +00:00
Guy Harris de4eefa3b1 From Rolf Fiedler: support for writing EyeSDN trace files.
svn path=/trunk/; revision=33107
2010-06-05 22:59:20 +00:00
Guy Harris 149ccb3b68 Attempt to handle isochronous descriptors between the 64-byte header and
the payload.  Should fix bug 4401.

svn path=/trunk/; revision=32828
2010-05-16 03:19:40 +00:00
Martin Mathieson 33dc9a3eb4 Fix non-libz build.
svn path=/trunk/; revision=32734
2010-05-10 12:56:01 +00:00