Commit Graph

2064 Commits

Author SHA1 Message Date
Guy Harris cf6d9841e3 Keep track, in Wiretap, of whether the file is compressed, and provide
an API to fetch that.

When doing "Save" on a compressed file, write it out compressed.

In the Statistics -> Summary dialog and in capinfos, report whether the
file is gzip-compressed.

svn path=/trunk/; revision=42818
2012-05-24 05:05:29 +00:00
Anders Broman 00ba6b0dc5 From Stephen Donnelly:
Add frame.interface_id support for ERF file format

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7266

svn path=/trunk/; revision=42807
2012-05-23 06:41:37 +00:00
Guy Harris e6a57c8e93 In Windows, in the Save As and Export Selected Packets dialog, append
the default extension for the file type iff

	the file type we're using has a list of extensions;

	the file has no extension or it has one but it's not one of the
	ones in the list.

*Don't* expect a file extension to be at most 5 characters plus the dot
- the extension for pcap-ng, our default capture file type, is "pcapng",
and that's 6 characters!

svn path=/trunk/; revision=42800
2012-05-23 03:05:17 +00:00
Jakub Zawadzki 63d6b6bf2a Z_BLOCK was added in zlib-1.2.0.5
Pass Z_NO_FLUSH to inflate() when Z_BLOCK is not defined,
just in case also disable fast seeking when it's not defined.

References: http://www.wireshark.org/lists/wireshark-dev/201205/msg00145.html 

svn path=/trunk/; revision=42714
2012-05-19 13:27:43 +00:00
Gerald Combs bdb614e264 Fix a bunch of uninitialized variables found by Coverity Scan. CIDs
702403, 702404, 702405, 702406, 702407, 702408, 702409, 702410, 702411,
and 702412.

svn path=/trunk/; revision=42658
2012-05-16 16:29:12 +00:00
Gerald Combs 88ae29c149 Use "%parse-param" instead of a global variable. Fixes a scan-build
warning.

svn path=/trunk/; revision=42578
2012-05-11 17:15:12 +00:00
Guy Harris 1fc695a022 Directly calculate the time stamp based on the offset in the stream from
the first bit in the stream.  This prevents accumulated truncation
errors.

Get the seek offset from file_tell().

svn path=/trunk/; revision=42436
2012-05-05 02:52:41 +00:00
Guy Harris c7ee2fb1e3 Clean up indentation.
svn path=/trunk/; revision=42427
2012-05-04 21:18:01 +00:00
Guy Harris 9bad4b330d ng_file_seek_rand() is supposed to return a Boolean; make it do so.
svn path=/trunk/; revision=42424
2012-05-04 17:18:15 +00:00
Guy Harris 33bb54a945 file_seek() used to be a wrapper around fseek() or gzseek(), both of
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-05-04 16:56:18 +00:00
Guy Harris ba78859f64 Fix comments.
svn path=/trunk/; revision=42413
2012-05-04 05:43:48 +00:00
Guy Harris 739f7c2f1d Get rid of declaration of non-existent routine.
svn path=/trunk/; revision=42412
2012-05-04 05:42:42 +00:00
Guy Harris 9467af6931 Make everything static that doesn't need to be exported.
svn path=/trunk/; revision=42409
2012-05-04 02:35:12 +00:00
Guy Harris daa7f8851e Fix indentation.
svn path=/trunk/; revision=42408
2012-05-04 02:16:51 +00:00
Guy Harris ecacaacbe2 Add a file_skip() routine to skip N bytes forward in the file - it's
currently just a wrapper around file_seek(), but could be implemented by
reading forward if, for example, we add support for reading
(sequentially only!) from a pipe.

Sort the declarations of file-reading routines into one block.

svn path=/trunk/; revision=42391
2012-05-02 21:25:48 +00:00
Guy Harris e1ee9ca907 Put all the comments about the "don't check the CRC" flag together, and
expand the resulting comment a bit.

svn path=/trunk/; revision=42390
2012-05-02 21:11:28 +00:00
Guy Harris 0275247b97 Use WTAP_ENCAP_IEEE_802_11_xxx for all the "802.11 plus radio header"
encapsulations.

For pre-V9 AiroPeek captures, leave the radio information in the packet
data, just as we do with the Prism, AVS, radiotap, and NetMon headers. 
Add a dissector for it.

svn path=/trunk/; revision=42379
2012-05-02 03:11:00 +00:00
Guy Harris 7ed15c8deb Remove unnecessary null-pointer check.
svn path=/trunk/; revision=42376
2012-05-01 22:29:08 +00:00
Chris Maynard 73f3d23999 Fix 2 redundant redeclaration warnings and a bug where logical AND (&&) was incorrectly used where bit-wise AND (&) was meant.
svn path=/trunk/; revision=42373
2012-05-01 02:47:52 +00:00
Guy Harris 4021d7c5ea Add ".dmp" as a suffix for pcap files of various flavors. Add ".ntar"
as a suffix for pcap-ng files.

svn path=/trunk/; revision=42330
2012-04-29 02:49:17 +00:00
Guy Harris 3684bb31a0 Remove _U_ from arguments that are actually used.
Fix a comment.

svn path=/trunk/; revision=42311
2012-04-28 16:05:18 +00:00
Guy Harris a59e931733 If xml_get_int() fails, bail immediately; don't use the variable it
would have filled in had it not failed.  (Thanks and a tip of the Hatlo
hat to the Clang static analyzer for complaining about this.)

svn path=/trunk/; revision=42306
2012-04-28 03:07:04 +00:00
Guy Harris d6e5b20bf2 Get rid of some unnecessary assignments, to remove warnings from the
Clang static analyzer.

svn path=/trunk/; revision=42304
2012-04-28 02:01:40 +00:00
Guy Harris 781891bd7b Remove duplicate comment.
svn path=/trunk/; revision=42270
2012-04-26 16:30:33 +00:00
Guy Harris c0cdd900fc Add a pcoreytohll() macro to extract "Corey-endian" 64-bit quantities,
and use it.

Fix some comments.

svn path=/trunk/; revision=42269
2012-04-26 16:27:03 +00:00
Guy Harris a3ce72529c Use the pletohXX macros when fetching little-endian values.
svn path=/trunk/; revision=42256
2012-04-26 08:57:33 +00:00
Guy Harris c7575ff095 Put the pseudo-header information for Veriwave packets into the buffer
in little-endian byte order, as that's what the dissector expects.  Add
a pletohl() macro for that purpose.

Fix comments (the Veriwave code is *not* writing data to a file!) and
clean up indentation.

svn path=/trunk/; revision=42255
2012-04-26 08:45:48 +00:00
Guy Harris d4d080e1a1 Use pntohs(), pntoh24(), and pntohl() to fetch big-endian data from the
headers.

Fix some indentation.

svn path=/trunk/; revision=42252
2012-04-26 05:07:53 +00:00
Guy Harris 1e6eaee16c Global variables considered harmful. Move all the per-capture-file
global variables into a structure that's attached to the wtap_t as
private data, and make all the per-*packet* global variables local
variables.

svn path=/trunk/; revision=42251
2012-04-26 04:26:03 +00:00
Guy Harris 28175cbf9a Put pcapng_open() right after libpcap_open(); pcap and pcap-ng are our
native file formats, so try them first.

Move eyesdn_open() to the section for open routines for file formats
that have a magic number - EyeSDN traces all start with "EyeSDN".

svn path=/trunk/; revision=42250
2012-04-26 03:21:29 +00:00
Guy Harris 51633791a9 If you get an I/O error when looking for the FPGA version, return -1, so
we know we had a real problem with the file.  If we just get a short
read, return 0, as it means the file is probably not a VWR file.

If we get an invalid message length when reading packets (rather than
when looking for the FPGA version), return WTAP_ERR_BAD_FILE and an
"Invalid message record length" indication, not a generic fallback
"can't read the file" error.

For file_tell() errors, fetch the error code with file_error().

For file_seek() errors, use the error file_seek returned.

svn path=/trunk/; revision=42249
2012-04-26 03:06:35 +00:00
Martin Mathieson e74d2fd9db Return 0 if doesn't match signature of vwr files.
Pointed out by Martin Kaiser in bug 7196.

svn path=/trunk/; revision=42248
2012-04-25 22:54:45 +00:00
Anders Broman 71780ae952 Add wtap_dump_fdopen_ng
svn path=/trunk/; revision=42231
2012-04-25 14:00:23 +00:00
Anders Broman 102991bf0f Handle wtap_dump_fdopen() as wtap_dump_open() eg call
wtap_dump_fdopen_ng() and add a dummy IDB to be able to write pcapng files.
Solves https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6969
mergecap: Can't open or create <FILENAME>: Internal error.

We might want to add a SHB comment from mergecap giving the merged filenames or something like that, Merging of pcapng files
is a different issue, idealy we should probably start using several SHB:s in that case.

svn path=/trunk/; revision=42230
2012-04-25 12:33:23 +00:00
Martin Mathieson 56add1934d Remove some unnecessary includes and fix some indentation.
svn path=/trunk/; revision=42227
2012-04-25 00:28:19 +00:00
Bill Meier 9c8aba73d7 Fix a buildbot compile warning.
svn path=/trunk/; revision=42197
2012-04-22 19:14:19 +00:00
Bill Meier ee89329b9a Various minor cleanup:
- fix a few small memory leaks;
 - fix some indentation to match style used (gnu);
 - remove trailing whitespace;
 - ...

svn path=/trunk/; revision=42196
2012-04-22 18:44:10 +00:00
Guy Harris 7dc39930a6 Global variables considered harmful (and unnecessary).
svn path=/trunk/; revision=42189
2012-04-22 02:03:29 +00:00
Martin Mathieson dae0b453f0 Lose some more unused variables reported by clang.
svn path=/trunk/; revision=42173
2012-04-21 02:43:11 +00:00
Martin Mathieson 048833b933 Try to fix up some clang warnings. Will look at other modules I added
recently later.

svn path=/trunk/; revision=42167
2012-04-20 18:09:50 +00:00
Martin Mathieson d74383ed1c Add a couple of casts to try to make the Windows-7-x64 buildbot happy.
svn path=/trunk/; revision=42159
2012-04-20 12:44:19 +00:00
Martin Mathieson b227c024fe Missed file from previous commit.
svn path=/trunk/; revision=42156
2012-04-20 12:09:16 +00:00
Martin Mathieson 45252c84e3 Patch for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5048
From Tom Cook and Tom Alexander.

1. A VWR encapsulation that reads VeriWave capture files (*.vwr)
generated from
WaveTest test hardware
2. Dissectors that display the VeriWave tap headers (both 802.11 and
Ethernet)
3. A dissector for the WaveAgent protocol.  The WaveAgent dissector is
heuristic and parses the WaveAgent packet (a UDP payload).

The WaveAgent dissector has been Fuzz tested.

The VWR ENCAP and dissectors have been used extensively by VeriWave
customers in a special version of WireSark compiled by VeriWave.

svn path=/trunk/; revision=42155
2012-04-20 12:08:31 +00:00
Guy Harris bb36edf54e Fix more indentation.
svn path=/trunk/; revision=42147
2012-04-20 01:44:49 +00:00
Guy Harris 5a1b276845 Use consistent 2-space indentation, and don't use tabs.
svn path=/trunk/; revision=42146
2012-04-20 01:43:12 +00:00
Guy Harris 33fc4a29bc Fix typo.
svn path=/trunk/; revision=42145
2012-04-19 23:58:53 +00:00
Guy Harris 13592b9b57 Don't byte-swap bytes that aren't there.
svn path=/trunk/; revision=42144
2012-04-19 23:19:10 +00:00
Anders Broman ec0c5baf4f From Rolf Fiedler:
patch to fix mp2t.c to reject more byte streams that are not MPEG2.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7132

svn path=/trunk/; revision=42127
2012-04-18 08:32:12 +00:00
Anders Broman be31ffaeb0 Get the Windows build going again. The Netxray "fix" cast to guint8 may not be OK.
svn path=/trunk/; revision=42125
2012-04-18 08:15:32 +00:00
Alexis La Goutte 6aedbbaf35 From Colus Tang via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7134
Unable to display the correct IEEE802.11 MCS data rates due to header definition

The problem is due to the ieee_802_11_phdr.data_rate is defined as guint8,
since this variable is counting number of 0.5Mbps units, any datarates which is
higher than 255Mbps would get wrapped up.  In the above example, only the lower
8bit value will be put into the ieee_802_11_phdr which is 0x04 and result in
the incorrect 2Mbps display.

There are 802.11n WLAN product is capable to transmit @450Mbps, we should fix
this data_rate from guint8 to guint16.

#BACKPORT

svn path=/trunk/; revision=42123
2012-04-18 07:22:12 +00:00
Guy Harris 477185a387 If we see a 5View time-stamped header with a bad key, make sure we
return the right error code and information string.

InfoVista bought Accellent Group, and, at least according to the
InfoVista Web site, it's "5View", not "5Views".

svn path=/trunk/; revision=42119
2012-04-18 02:48:23 +00:00
Guy Harris 81209da65b Fix some indentation errors from the previous change.
svn path=/trunk/; revision=42118
2012-04-18 00:54:11 +00:00
Guy Harris e3053e0105 Get rid of tabs, so we don't have to worry about 4-space vs. 8-space tabs.
svn path=/trunk/; revision=42117
2012-04-18 00:51:18 +00:00
Michael Tüxen bacf81ff06 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7048
Write timetamps for the interface statistic blocks the way specified
by http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html


svn path=/trunk/; revision=42080
2012-04-15 11:11:36 +00:00
Michael Tüxen 587e0213eb Whitespace cleanup (done while debugging).
svn path=/trunk/; revision=42079
2012-04-15 11:08:40 +00:00
Martin Mathieson 722c68ec90 Fix a typo (just clearing my client out before I start doing diffs).
svn path=/trunk/; revision=42077
2012-04-15 01:38:12 +00:00
Guy Harris f3c2e6087e More double-free fixes - destroy_k12_file_data() frees its argument, so
calling g_free() on that argument after calling destroy_k12_file_data()
is always an error.

svn path=/trunk/; revision=42067
2012-04-14 17:20:22 +00:00
Anders Broman f4c5e276c5 From From Evan Huus: Potential double-free while importing k12xx *.rf5 files https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7084
svn path=/trunk/; revision=42062
2012-04-14 07:53:22 +00:00
Jakub Zawadzki 8a1dc57c03 Remove doubled semicolons and semicolons outside function.
svn path=/trunk/; revision=42053
2012-04-13 20:22:31 +00:00
Guy Harris 4a8f46a5ac Call LAPD-with-Linux-pseudoheader "linux-lapd", and fix its description
to indicate the Linux pseudo-header.

Fix the description of LAPD-without-Linux-pseudoheader to be just
"LAPD".

svn path=/trunk/; revision=42018
2012-04-10 23:32:16 +00:00
Guy Harris 51e76d89eb Fix tpo.
svn path=/trunk/; revision=42017
2012-04-10 23:28:17 +00:00
Guy Harris 4db2d3443a It's "X.25", not "X25".
svn path=/trunk/; revision=42016
2012-04-10 23:27:39 +00:00
Jakub Zawadzki ac5c40e6c5 Mark some function static.
svn path=/trunk/; revision=41999
2012-04-09 19:43:19 +00:00
Gerald Combs e5cd6c087e 1.7.1 → 1.7.2.
svn path=/trunk/; revision=41971
2012-04-06 17:27:20 +00:00
Guy Harris 154c0f37dd Indicate where BACnet MS/TP is specified.
Add a new WTAP_ENCAP_BACNET_MS_TP_WITH_PHDR encapsulation type, for use
by the EyeSDN file reader; unlike the pcap-encapsulated MS/TP, it
includes a direction indicator.  Don't treat WTAP_ENCAP_BACNET_MS_TP as
if it has a direction indicator, as it doesn't; instead, do that for
WTAP_ENCAP_BACNET_MS_TP_WITH_PHDR.

Add some missing entries to encap_table_base for WTAP_ENCAP_ values that
didn't get entries added.

svn path=/trunk/; revision=41969
2012-04-06 03:42:32 +00:00
Guy Harris ae62dc3bdb Use tabs more uniformly.
svn path=/trunk/; revision=41966
2012-04-05 21:24:10 +00:00
Guy Harris a98336862a WTAP_ENCAP_MTP2 is for MTP2 *without* a pseudo-header giving direction
or other information; WTAP_ENCAP_MTP2_WITH_PHDR is for MTP2 *with* such
a pseudo-header.  Use WTAP_ENCAP_MTP2_WITH_PHDR for the EyeSDN captures,
and don't assume there's a pseudo-header if you have WTAP_ENCAP_MTP2.

svn path=/trunk/; revision=41962
2012-04-05 20:25:26 +00:00
Jakub Zawadzki c67d24077e Allow loading xml files (file MUST start with <?xml).
I needed it for testing (bug #7028)
if you feel like it's stupid idea give me nfo :)

svn path=/trunk/; revision=41944
2012-04-04 20:52:52 +00:00
Jeff Morriss 75c3c92f19 Add a "-build" argument to checkAPIs.pl. Use that argument when building
from makefiles (and thus from the buildbot).

The intention is to be able to tell when a human is running the tool so we
can provide more code-review guidance.

As a starter, enable the "too many proto_tree_add_text() calls" check when
a human is running the tool.

svn path=/trunk/; revision=41943
2012-04-04 20:46:49 +00:00
Anders Broman 77b67c7456 From Rolf Fiedler:
Patch to add V5.2 tracing capability on E1 links using EyeSDN probes.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7027

Removed preference related stufff as it's not needed.

svn path=/trunk/; revision=41915
2012-04-04 07:33:39 +00:00
Martin Mathieson f0798dabd1 Set up table to help with ascii-hex -> hex conversion in advance to
avoid testing static for every conversion.

svn path=/trunk/; revision=41900
2012-04-03 01:49:27 +00:00
Jakub Zawadzki bb8afe3f68 Add initial support for dissecting packets encapsulated in Netfilter LOG (DLT_NFLOG=239).
svn path=/trunk/; revision=41872
2012-03-31 17:29:41 +00:00
Jeff Morriss a572670849 From Martin Kaiser via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6984 :
The attached patch extends the mpeg2 ts format detection to take into account
that trailing bytes might be added to each packet.

Once it finds no sync after 188 bytes, it checks an additional 40 bytes for the
next sync byte and adjusts the packet size accordingly.

Only the 188 bytes of the actual ts packet are passed on to wiretap, the
trailer is omitted.

svn path=/trunk/; revision=41863
2012-03-30 23:19:49 +00:00
Gerald Combs beee8db906 Print the correct block size in a debug message.
svn path=/trunk/; revision=41773
2012-03-26 19:29:33 +00:00
Jeff Morriss 9c1bf7223e Don't mark the file as unsaved unless the capture or packet comments actually changed.
svn path=/trunk/; revision=41744
2012-03-23 01:41:59 +00:00
Anders Broman efa9387886 From Krishna:
Enhancement to add more trace record fields in Citrix NetScaler capture file format.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?

svn path=/trunk/; revision=41740
2012-03-22 15:36:37 +00:00
Anders Broman 63c19bd071 Disable debug.
svn path=/trunk/; revision=41716
2012-03-21 08:58:27 +00:00
Anders Broman 456c7c2dc6 Try to make the buildbot happy.
svn path=/trunk/; revision=41684
2012-03-20 11:58:29 +00:00
Anders Broman 148c8a3a30 Write ISB:s if we have them.
svn path=/trunk/; revision=41683
2012-03-20 11:42:55 +00:00
Jeff Morriss 90df1a9d94 Set eol-style to native (just to make these files readable on *NIX).
svn path=/trunk/; revision=41654
2012-03-19 01:46:24 +00:00
Guy Harris 6c500f66f8 Fix indentation.
svn path=/trunk/; revision=41627
2012-03-17 08:46:20 +00:00
Jeff Morriss fb46cda196 When we're in a for(i=0,[...]) loop, don't reuse (and thus reset) 'i' in another for(i=0,[...]) loop. This fixes the capinfos double-free crashes that the fuzz bot has been experiencing.
svn path=/trunk/; revision=41610
2012-03-16 14:07:22 +00:00
Guy Harris 8af620acd7 Initialize the new num_stat_entries and interface_statistics members of
a wtapng_if_descr_t, so that we don't crash on a close (as is happening
in the buildbot).

Fix up some 4-space tabs.

svn path=/trunk/; revision=41575
2012-03-15 21:44:54 +00:00
Anders Broman fb0fec7c1c If we have one ISB, display the droped count from it.
svn path=/trunk/; revision=41561
2012-03-15 14:33:04 +00:00
Anders Broman dc674a6043 - Store ISB data.
- free IDB and ISB data when closing.

svn path=/trunk/; revision=41558
2012-03-15 13:46:42 +00:00
Jeff Morriss 603b4d4348 Don't free idb_inf in wtap_dump_open_ng(): free it in the callers. This fixes the double-free editcap crashes that the buildbot's been seeing lately.
svn path=/trunk/; revision=41542
2012-03-14 01:08:09 +00:00
Anders Broman 0e4998190f From Jose Pedro Oliveira:
Remove a printf line in wiretap/pcapng.c
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6718

svn path=/trunk/; revision=41534
2012-03-13 15:26:36 +00:00
Anders Broman bb611755e9 Add data structure to hold information from ISB:s
svn path=/trunk/; revision=41522
2012-03-13 08:36:52 +00:00
Anders Broman 35bf2e9619 From Jose Pedro Oliveira:
Enforce the modelines in wiretap/pcapng.c

svn path=/trunk/; revision=41506
2012-03-12 15:43:59 +00:00
Anders Broman 1a8f3eddc7 From Jose Pedro Oliveira: Add Modlines
svn path=/trunk/; revision=41495
2012-03-12 06:39:45 +00:00
Gerald Combs 7a8df2f485 In pcapng.c use the units per second value from the interface instead of
the default.

Add support for reading nseclibpcap files to dumpcap.

svn path=/trunk/; revision=41455
2012-03-10 00:24:42 +00:00
Anders Broman e15692be8a From Jose Pedro Oliveira: Corrects several 'wdh->bytes_dumped += ...' lines. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6718
svn path=/trunk/; revision=41443
2012-03-09 04:50:43 +00:00
Anders Broman cd2c726c8c The User & Network direction is reversed https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6656
svn path=/trunk/; revision=41402
2012-03-07 17:02:27 +00:00
Anders Broman 1b25b08a0f From Martin Kaiser: correct sorting for wiretap's file type list
svn path=/trunk/; revision=41387
2012-03-07 08:03:42 +00:00
Anders Broman 7fba54762b From Mike Wakerly: Add wiretap suport for LINKTYPE_NFC_LLCP
svn path=/trunk/; revision=41368
2012-03-06 09:02:06 +00:00
Anders Broman ddd69f4775 Use correct lenght when writing if_filter_str.
svn path=/trunk/; revision=41352
2012-03-05 09:32:21 +00:00
Anders Broman a20cfcc745 Fix calculation of pading for if_filter_str.
svn path=/trunk/; revision=41351
2012-03-05 09:21:36 +00:00
Anders Broman 995e10ef36 From Martin Kaiser:
wiretap mpeg2 ts: eof vs short read
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6909

svn path=/trunk/; revision=41350
2012-03-05 08:34:36 +00:00
Anders Broman 4db442ab90 From Martin Kaiser:
wiretap mpeg2 ts: more thorough check for sync byte.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6908

svn path=/trunk/; revision=41349
2012-03-05 08:30:39 +00:00
Guy Harris 732de9018d Squelch a can't-really-happen uninitialized reference warning.
svn path=/trunk/; revision=41342
2012-03-04 20:49:17 +00:00
Anders Broman 7348837ccd Use parentheses
svn path=/trunk/; revision=41341
2012-03-04 19:31:33 +00:00
Anders Broman 971cb84877 if_filter isn't a string per se,The first byte of the Option Data keeps a code of the filter used
svn path=/trunk/; revision=41339
2012-03-04 19:01:14 +00:00
Guy Harris aa974fda50 Make sure all names in NRB records are null-terminated; report an error
if they're not.  Also report an error for zero-length names.

Handle multiple names per IP address - the pcap-NG spec says "one or
more zero-terminated strings containing the DNS entries for that
address."

Use a Buffer to hold NRB records, so there's no maximum size (well,
there is a maximum size, because the record length is 16 bits, but let's
not allocate 64KiB on the stack if we don't have to).

svn path=/trunk/; revision=41332
2012-03-04 02:20:25 +00:00
Anders Broman ad6640344f From Jose Pedro Oliveira: Fix typos
svn path=/trunk/; revision=41330
2012-03-03 16:17:20 +00:00
Guy Harris b18a5f9805 Don't look at the interface_id field of the packet header if
WTAP_HAS_INTERFACE_ID isn't set in the presence flags.

svn path=/trunk/; revision=41327
2012-03-03 00:13:25 +00:00
Guy Harris 57839d9e4a Flag mp2t file as really having only relative time stamps. Put the
comment on its own line in mpeg.c as well.

svn path=/trunk/; revision=41294
2012-03-02 10:17:36 +00:00
Guy Harris 0475f29216 The additional_file_extensions member of struct file_type_info need not
and should not contain the extension in the default_file_extension
member - that's why the name starts with "additional".

svn path=/trunk/; revision=41293
2012-03-02 10:09:23 +00:00
Guy Harris 17dff5f3c4 Get rid of no-longer-needed argument to pcapng_write_section_header_block().
svn path=/trunk/; revision=41292
2012-03-02 09:38:43 +00:00
Guy Harris 10337e0ca4 Skip an intermediating wtapng_block_t in the code path to write
Interface Description Blocks.

Fix a typo (if_fcslen was meant rather than opt_comment when writing the
FCS length).

svn path=/trunk/; revision=41291
2012-03-02 09:30:10 +00:00
Guy Harris 334a807e14 Simplify the code path for writing pcap-NG packets, and remove some
no-longer-needed elements from the wtapng_packet_t structure.

svn path=/trunk/; revision=41289
2012-03-02 09:03:26 +00:00
Anders Broman e82ad19e58 From Weston Schmidt: Add mpeg-ts capture file format support. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6894
svn path=/trunk/; revision=41286
2012-03-02 06:02:28 +00:00
Guy Harris 44528a6437 Fill in the wtap_pkthdr fields in pcap_read_packet_block() and
pcap_read_simple_packet_block(), not in pcap_read() - the way the fields
are filled in differs between simple and non-simple packet blocks.

Clean up white space.

svn path=/trunk/; revision=41284
2012-03-02 05:03:06 +00:00
Bill Meier f2c1c108f5 AFAIKT there's no reason to #include <wsutil/crc32.c>; Include crc32.h like everyone else...
Also: Do some whitespace and indentation cleanup.

svn path=/trunk/; revision=41281
2012-03-02 00:31:30 +00:00
Michael Tüxen 59dee69a95 Fix CID 1385.
svn path=/trunk/; revision=41264
2012-03-01 14:57:14 +00:00
Michael Tüxen 3bd0e0be10 Fix CID 354.
svn path=/trunk/; revision=41263
2012-03-01 14:51:26 +00:00
Anders Broman ffbba61fdf Read the complete NRB.
#Backport

svn path=/trunk/; revision=41259
2012-03-01 13:31:40 +00:00
Anders Broman cc9bcfb068 Add debuginfo
svn path=/trunk/; revision=41258
2012-03-01 10:13:02 +00:00
Anders Broman 23ec82fae9 From Reinhard Speyerer: Adding support for LINKTYPE_PPP_ETHER/DLT_PPP_ETHER
svn path=/trunk/; revision=41256
2012-03-01 07:39:54 +00:00
Anders Broman d24fad6371 - Add a LED in the statusbar to indicate that capture comments exists,
clickable to open an edit window.
- Add checks for NULL pointers.

Help with a different color LED possibly with Jeff's (c) in it apreceated.
Should the LED be placed elsewhere or the whole thing done differently?

svn path=/trunk/; revision=41242
2012-02-29 16:51:32 +00:00
Guy Harris 76652d9d4a Some more details about REC_HEADER1 and REC_V2DESC; REC_HEADER1 doesn't
appear to contain anything of use to us - too random - but REC_V2DESC
might be worth converting into a comment.

svn path=/trunk/; revision=41215
2012-02-28 01:11:11 +00:00
Anders Broman 38c69c8431 Make it possible to edit capture comments
svn path=/trunk/; revision=41193
2012-02-26 17:04:28 +00:00
Guy Harris 83bf13e1e6 For LANalyzer files, make the "File type name" be the file comment.
Display the file comment in the Summary dialog.

svn path=/trunk/; revision=41188
2012-02-26 10:20:40 +00:00
Guy Harris b6ff142f60 Add a presence flag field to the packet information structure filled in
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
2012-02-25 23:24:34 +00:00
Bill Meier 605dea0486 CVARSDLL hasn't been used (is undefined) for a while....
svn path=/trunk/; revision=41180
2012-02-24 16:23:38 +00:00
Anders Broman cacbe31797 Fix a typo and revert previous.
svn path=/trunk/; revision=41179
2012-02-24 15:57:56 +00:00
Anders Broman c14dbfc465 Fix a typo.
svn path=/trunk/; revision=41178
2012-02-24 15:53:00 +00:00
Michael Tüxen 525df25b7f No debug output, please.
svn path=/trunk/; revision=41165
2012-02-23 19:14:58 +00:00
Michael Tüxen 2b3cd82cb1 interface id is 32-bit, not 64-bit.
svn path=/trunk/; revision=41159
2012-02-23 11:55:24 +00:00
Guy Harris b6330fc765 Do a check of the block total length in pcapng_read_unknown_block().
That means we don't need to do the block length check in
pcapng_read_block(); each block type reader, including the one for
unknown block types, does a check that's as stringent as that block
length check or more stringent, which means any block whose length is
less than the minimum will fail with the same error in both cases.

Fix the message for a too-short NRB.

svn path=/trunk/; revision=41152
2012-02-23 10:03:16 +00:00
Guy Harris 4bf0c5bf5b Fix typo introduced by previous checkin.
svn path=/trunk/; revision=41145
2012-02-22 23:44:25 +00:00
Guy Harris 3b262a0621 Add sanity checks to make sure the claimed block size is big enough to:
1) contain the block length fields and block type field;

	2) contain that plus the fixed-length portion of the block;

	3) for blocks that have a variable-length portion other than the
	   options, contain that variable-length portion.

Fixes a crash we're seeing with a bad pcap-NG file in the Wireshark
menagerie (7799-lastPacketWithoutComment.pcapng - the last packet's
block length is 128, but it claims to have 98 bytes of packet data,
which requires a 132-byte block).

Clean up white space (use 8-space tabs).

svn path=/trunk/; revision=41143
2012-02-22 18:32:43 +00:00
Anders Broman ace4d65e47 Grr forgot debug flag - again.
svn path=/trunk/; revision=41140
2012-02-22 16:02:38 +00:00
Anders Broman 8fff390455 - Write ISB(s) at start and end of capture.
- Read all options.
- Prepare to write ISB.

svn path=/trunk/; revision=41137
2012-02-22 14:41:02 +00:00
Guy Harris 46cb65974b Handle the case where there are no IDBs before the first non-SHB/non-IDB
block, which could be the case even in a *valid* file (consider a file
with an SHB, an NRB, an IDB, and a packet block, in that order); even if
there's no IDB before the first packet block, that should be reported to
the user as "interface N not less than interface count M", to more
precisely indicate the problem.

(Yes, the loop should probably keep going until it finds a packet block,
not just a non-IDB block.)

svn path=/trunk/; revision=41132
2012-02-22 03:03:34 +00:00
Michael Tüxen b85f69ebde Fix bugs which resulted in the buildbot errors.
svn path=/trunk/; revision=41126
2012-02-21 20:37:22 +00:00
Michael Tüxen 2764d9977b Use wtap_dump_open_ng() in tshark.
svn path=/trunk/; revision=41123
2012-02-21 17:19:45 +00:00
Michael Tüxen 660a348df1 When saving a file and the are no IDBs, create a default one.
This seems right, but doesn't make the buildbots happy, because
a read pcap file is reported a per packet encaps...

svn path=/trunk/; revision=41121
2012-02-21 16:51:23 +00:00
Michael Tüxen 4ea2838bdb Disable debug output...
svn path=/trunk/; revision=41119
2012-02-21 16:33:33 +00:00
Michael Tüxen 877edcc89d When writing an option in an IDB, also write an endofoption option.
Use (consistently) 0 as the default for the interface speed.
While there, do some whitespace cleanups.

svn path=/trunk/; revision=41118
2012-02-21 16:32:25 +00:00
Michael Tüxen 822782f7c4 Improve the error handling.
svn path=/trunk/; revision=41112
2012-02-21 15:36:08 +00:00
Michael Tüxen 7d7c5ca02d Don't dereference idb_inf in wtap_dump_open_ng() when
you provide NULL when you call it via wtap_dump_open.

This does not make the buildbots happy, but at least
tshark doesn't crash anymore.

svn path=/trunk/; revision=41111
2012-02-21 15:21:01 +00:00
Michael Tüxen da14b5b8ec Improve peeking for IDBs.
While there, cleanup some whitespaces.

svn path=/trunk/; revision=41106
2012-02-21 12:24:42 +00:00
Guy Harris a0ccca53d9 Once we've read a valid SHB, we've concluded the file is a pcap-NG file,
so if we later get a short read, we have to return -1 and set *err to
WTAP_ERR_SHORT_READ.  Otherwise, we'll try other file types and, if none
of them match, we'll try to close the wtap structure, which crashes.

svn path=/trunk/; revision=41102
2012-02-21 08:27:41 +00:00
Anders Broman b15cea5c18 Declare opt_cont_buf_len
svn path=/trunk/; revision=41101
2012-02-21 07:25:22 +00:00
Anders Broman b301446753 Free the buffer
svn path=/trunk/; revision=41099
2012-02-21 06:57:14 +00:00
Anders Broman 311116da93 Change comment to Loop ower all IDB:s that appear before any packets sugested by Guy, there can be more IDBs in a cpture file
svn path=/trunk/; revision=41096
2012-02-21 05:58:40 +00:00
Anders Broman 89758cdec8 From Jose Pedro Oliveira fix a typo
svn path=/trunk/; revision=41091
2012-02-20 22:40:17 +00:00
Anders Broman c7f1a431d2 Handle reading and writing of multiple IDB:s, write IDB options and use correct lengt for strings, handle more than 100 char comment
svn path=/trunk/; revision=41082
2012-02-20 20:15:51 +00:00
Guy Harris 55001ef198 With the WTAP_ERR_UNSUPPORTED error, Wiretap supplies a string giving
the details of what in particular is unsupported; report it in TShark
and Wireshark.

Handle WTAP_ERR_RANDOM_OPEN_PIPE in TShark.

Handle WTAP_ERR_COMPRESSION_NOT_SUPPORTED in TShark, and have its error
message in Wireshark not speak of gzip, in case we support compressed
output in other formats in the future.

If we see a second section header block in a pcap-NG file, don't report
it as "the file is corrupted", report it as "the file uses a feature we
don't support", as that's the case - and don't free up the interface
data array, as the file remains open, and Wireshark might still try to
access the packets we were able to read.

svn path=/trunk/; revision=41041
2012-02-16 18:58:40 +00:00
Guy Harris 5e8d2c79f6 Again, turn off the debug logging; it messes up the fuzz-testing bot.
svn path=/trunk/; revision=41034
2012-02-16 02:06:48 +00:00
Anders Broman 0b6b3937ab Make it possible to get inforamtion from the read SHB to the one to write out.
svn path=/trunk/; revision=41032
2012-02-15 19:44:16 +00:00
Guy Harris 197f7b9c02 TYPE_PAD records can have zero bytes of payload; don't treat them as
errors.

svn path=/trunk/; revision=41030
2012-02-14 22:31:33 +00:00
Michael Tüxen 68204c94a4 From Anders: Add support for options in the SHB.
From me: Some whitespace changes.

svn path=/trunk/; revision=41026
2012-02-14 17:07:52 +00:00
Anders Broman 1bc9a08e41 White space changes.
svn path=/trunk/; revision=41015
2012-02-13 17:34:56 +00:00
Anders Broman c7b1aeb5f5 Drop count is 64 bits
svn path=/trunk/; revision=41014
2012-02-13 17:34:15 +00:00
Jeff Morriss 670120c481 Fix the crash reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6804
For WTAP_ENCAP_ERF files if we find an Extension and/or Multi-Channel header,
ensure that the size of the full pseudoheader is smaller than the packet size
to avoid an underflow and subsequent attempt to allocate a rather large amount
of memory.

svn path=/trunk/; revision=41008
2012-02-13 03:03:03 +00:00
Guy Harris 61c2e0ea40 Do not assume tab stops are set every 4 spaces.
svn path=/trunk/; revision=41007
2012-02-12 23:50:13 +00:00
Michael Tüxen 13beca3bbf Fix debug output.
svn path=/trunk/; revision=41004
2012-02-12 21:56:00 +00:00
Anders Broman 74f2ef4f76 Store drop count if present.
svn path=/trunk/; revision=40974
2012-02-11 17:31:13 +00:00
Anders Broman 8aea738cda Add the abillity to read and write option comments unedited.
This is POC we may want to have more efficient use of the frame data
structure etc. But this allows for work to be done on the GUI to actually add comments.

svn path=/trunk/; revision=40969
2012-02-11 12:34:39 +00:00
Guy Harris 357a3e2837 Revert presumably-unintentional turning on of debug messages.
svn path=/trunk/; revision=40963
2012-02-11 02:41:04 +00:00
Anders Broman 7be6e75c13 Add pcapng variables to wtap_pkthdr.
svn path=/trunk/; revision=40947
2012-02-09 22:24:00 +00:00
Alexis La Goutte 64b511f5e7 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=40909
2012-02-06 22:20:29 +00:00
Alexis La Goutte 50fe66d265 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=40908
2012-02-06 22:19:07 +00:00
Alexis La Goutte 7424e362c6 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=40907
2012-02-06 22:18:45 +00:00
Anders Broman 5f14cec8e2 From Guy Martin:
Add new linktype 243 for MPEG2-TS.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6796

svn path=/trunk/; revision=40884
2012-02-06 19:15:07 +00:00
Anders Broman 0179b7dc50 Add *.sbr files to the clean target.
svn path=/trunk/; revision=40763
2012-01-29 20:33:58 +00:00
Anders Broman 997b768069 From Tom Brezinski:
includes radio data from the capture.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6746

svn path=/trunk/; revision=40754
2012-01-28 17:10:50 +00:00
Anders Broman 6dbeabfc6f From Tobias Witek:
Allow dissectors to indicate that an ATM AAL5 frame contains SSCOP.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6717

svn path=/trunk/; revision=40750
2012-01-28 16:34:22 +00:00
Guy Harris c8854a7a5f Add a routine to Wiretap that takes a file type value and an
encapsulation value and returns a GArray containing all the file types
that could be used to save a file of that file type and that
encapsulation value (which could be WTAP_ENCAP_PER_PACKET), with the
input file type first if that can be used and pcap or pcap-ng first if
not and if one of them can be used, and with pcap and pcap-ng clustered
together if they're among the file types that can be used.

Use that routine for the GTK+ file save dialog.

svn path=/trunk/; revision=40685
2012-01-24 04:33:23 +00:00
Jeff Morriss f7e1f76659 From njtaylor0101 [AT] gmail.com via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6740 :
Fix an out-of-array-bounds warning from OpenBSD's compiler.  (Note: this is
actually a false positive since adequate memory is allocated.)

From me: some additional code simplification.

svn path=/trunk/; revision=40680
2012-01-24 02:20:46 +00:00
Guy Harris 3b1f82d063 In the table of capture file types, have:
a field that gives the default extension for the file type,
	*without* a leading "." (i.e., just the extension, not the "."
	that separates it from the rest of the file name), which is NULL
	if there are no known extensions;

	a field that gives a semicolon-separated list of *other*
	extensions, without "*." or ".", which is NULL if there are no
	known extensions or there are no known extensions other than the
	default.

Rename wtap_file_extension_default_string() to
wtap_default_file_extension() (matches the name of the field).

svn path=/trunk/; revision=40678
2012-01-23 23:17:03 +00:00
Guy Harris bb98263aa4 Have wtap_file_extension_default_string() return the extension in the
sense of "what follows the last . in the file name", i.e. not including
the ".".

svn path=/trunk/; revision=40674
2012-01-23 21:57:45 +00:00
Guy Harris ef2bf47e32 Add default extension names for all file types for which we have
extensions at all.

For file types that are plain text and that don't already have
extensions, add "txt" as the extension.

svn path=/trunk/; revision=40657
2012-01-23 02:38:56 +00:00
Guy Harris e4a193fe5e Replace wtap_file_extensions_string() with a routine that returns a
GSList of extensions for a file type, including extensions for the
compressed versions of those file types that we can read.

svn path=/trunk/; revision=40623
2012-01-21 08:59:21 +00:00
Guy Harris 020d9491da It's the Xoraya file type, not the Xoraya encapsulation, that was bogus.
svn path=/trunk/; revision=40622
2012-01-21 04:00:43 +00:00
Guy Harris 97ad2f8177 "*.*" as a pattern for a given file type is pointless, as it doesn't
select only files of that type; you might as well use "All Files (*.*)"
for that.

The default suffix is a suffix, not a pattern, so it shouldn't be
"*.{something}".

We only use the patterns on Windows, where file names are
case-insensitive, so there's no point in capital letters in suffixes.

svn path=/trunk/; revision=40621
2012-01-21 03:55:40 +00:00
Guy Harris e3712a53da Get rid of an unused file type. If somebody wants it in the official
Wireshark distribution, give us code to read it.  If somebody wants it
in their private version of Wireshark, they can manage that themselves. 
(We should support plugins for file types at some point; I think we
already have support for Lua file readers.)

svn path=/trunk/; revision=40620
2012-01-21 03:52:19 +00:00
Guy Harris 9ca4193385 Line up #define values.
svn path=/trunk/; revision=40576
2012-01-18 22:05:47 +00:00
Guy Harris e13c87acc4 Tabs are not *ipso facto* 4 spaces.
svn path=/trunk/; revision=40575
2012-01-18 22:05:01 +00:00
Alexis La Goutte cb6644ea4b From Tom Brezinski via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6746
Adding support for Network Instruments 802.11 wireless captures

Attaching very simple change to allow reading of Network Instruments Observer 802.11 wireless capture files.

svn path=/trunk/; revision=40571
2012-01-18 21:23:30 +00:00
Guy Harris 6224e81b9f wth->phdr.pkt_encap isn't set on a seek-and-read; pass the encapsulation
directly to k12text_set_pseudo_header(), so that it's passed the right
encapsulation for seek-and-read as well as for read.  Fixes the
"malformed frames when reading some K12 text files" problem for which
we're using bug 6735.

svn path=/trunk/; revision=40508
2012-01-14 20:58:41 +00:00
Guy Harris 2db032c5d5 NetMon 1.x format does *not* support per-packet encapsulation.
svn path=/trunk/; revision=40495
2012-01-14 10:31:25 +00:00
Guy Harris eb5c7d64a4 Get rid of unused WTAP_FILE_WTAP file type.
Move pcap-NG right after standard pcap in the list of file types, so
that it shows up early in the list of output file types in the "Save
As..." dialog box (if, that is, it's supported; if not, neither is pcap,
as they use the same link-layer header type values).

svn path=/trunk/; revision=40493
2012-01-14 09:12:05 +00:00
Guy Harris 37ffde4018 WTAP_ENCAP_UNKNOWN should never appear as an actual encapsulation type,
and can't be supported as an output encapsulation in any case.

svn path=/trunk/; revision=40492
2012-01-14 09:00:37 +00:00
Jörg Mayer 9781eaf0f5 Sync filelists between autofoo and cmake.
Move some dissectors that throw warnings to DIRTY_
Whitespace cleanups

svn path=/trunk/; revision=40478
2012-01-13 19:29:58 +00:00
Gerald Combs cb9725ce2b Prepend the sita_phdr fields with "sita_" to make them less
collision-prone.

svn path=/trunk/; revision=40320
2011-12-28 23:39:14 +00:00
Bill Meier 727046dc35 Tighten up format string used for date/time parse;
Use 'static' in function definitions to match function declarations;
Do minor reformatting.

svn path=/trunk/; revision=40305
2011-12-27 18:54:32 +00:00
Guy Harris 7962edcf56 The encapsulation following WTAP_ENCAP_ARCNET is
WTAP_ENCAP_ARCNET_LINUX; update various tables mapping Wiretap
encapsulations to file-type encapsulations.  Get rid of some trailing
"sorry, that's not supported" entries while we're at it.

svn path=/trunk/; revision=40274
2011-12-22 09:22:35 +00:00
Guy Harris ab910e4cff If stuff above the Wiretap library can't handle packet reported lengths
> WTAP_MAX_PACKET_SIZE, either that should be caught above the
per-file-type layer in Wiretap or should be handled by the caller.

We've recently fixed at least one problem with reported lengths > 2^31 -
1 (by clamping the length to 2^31 - 1), so let's just remove the check
from the pcap-NG reader, to squelch some complaints we're getting from
the buildbot (bug 6673 and its duplicates).

(The pcap reader uses it to cope with some of the botched libpcap
formats that changed the per-packet header without changing the magic
number; I'll look at trying to preserve those heuristics while still
allowing reported lengths > WTAP_MAX_PACKET_SIZE.)

svn path=/trunk/; revision=40207
2011-12-15 08:22:06 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
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-13 09:53:50 +00:00
Guy Harris 1df4ee9109 Crank up the maximum frame table size to 512*2^20 packets, that being a
small amount bigger than the maximum possible number of packets in a
NetMon file.

svn path=/trunk/; revision=40174
2011-12-13 06:45:16 +00:00
Guy Harris c3da1f23d3 Add missing checks for a too-large packet, so we don't blow up trying to
allocate a huge buffer.

svn path=/trunk/; revision=40170
2011-12-13 02:42:42 +00:00
Guy Harris dd92029afa Check for a bogus record size. Fixes bug 6670.
svn path=/trunk/; revision=40169
2011-12-13 02:00:41 +00:00
Guy Harris 89303e99c4 Add an arbitrary limit on the maximum size of the frame table, so that
we don't crash.  Fixes bug 6669.

svn path=/trunk/; revision=40168
2011-12-13 01:49:27 +00:00
Guy Harris c8182253c8 Add missing checks for a too-large packet, so we don't blow up trying to
allocate a huge buffer; fixes bug 6668.

Also add some other checks for invalid records.

svn path=/trunk/; revision=40167
2011-12-13 01:24:12 +00:00
Guy Harris 73a808f9bc Add missing check for a too-large packet, so we don't blow up trying to
allocate a huge buffer; fixes bug 6667.

svn path=/trunk/; revision=40166
2011-12-13 01:05:52 +00:00
Guy Harris b669a11931 Add missing check for a too-large packet, so we don't blow up trying to
allocate a huge buffer; fixes bug 6666.

svn path=/trunk/; revision=40165
2011-12-13 00:57:09 +00:00
Guy Harris a1fe0c746d Update some comments to reflect current reality (as in "a lot of stuff
is no longer available, but there's an IETF list of snoop datalink
types, at least").

svn path=/trunk/; revision=40080
2011-12-03 07:16:56 +00:00
Jaap Keuter 016bf3b0cf from Petr Sumbera:
Solaris 11 snoop files with IP over Infiniband data are not recognized.
Attached patch allows to view such data.

svn path=/trunk/; revision=40072
2011-12-02 22:23:07 +00:00
Guy Harris 7694a8659d Fail if somebody tries to write out a packet with an unsupported
encapsulation.

svn path=/trunk/; revision=39944
2011-11-18 21:39:18 +00:00
Guy Harris 680b3d3a86 Make sure pcap-ng supports a particular encapsulation type before
trying to write out an interface description block for an interface with
that type.

svn path=/trunk/; revision=39930
2011-11-18 07:13:33 +00:00
Guy Harris 9b9bd6d27b Add checks to make sure we don't overflow the maximum 32-bit file
offset.

svn path=/trunk/; revision=39915
2011-11-17 20:17:36 +00:00
Guy Harris e4658ced93 Rename pletonll() to reflect what it actually does, namely convert a
host-byte-order 64-bit integral quantity to little-endian byte order.

svn path=/trunk/; revision=39900
2011-11-17 09:24:15 +00:00
Guy Harris 31f61b75b2 A new macro needed by the WTAP_ENCAP_PER_PACKET support for writing
NetMon files.

svn path=/trunk/; revision=39899
2011-11-17 09:04:54 +00:00
Guy Harris 9dc26776e4 Add support for writing WTAP_ENCAP_PER_PACKET files; they are written
out in version 2.1 of the file format (the minimum version to support
that).

Change some data types to avoid having file offsets that are before the
beginning of the file.

Clean up some other data types and some comments.

svn path=/trunk/; revision=39898
2011-11-17 09:03:09 +00:00
Guy Harris f3a88d4084 Return *some* error if we end up trying to seek before the beginning of
the file, so you don't get weird random errors.  EINVAL is as good as
anything.

svn path=/trunk/; revision=39896
2011-11-17 06:36:32 +00:00
Guy Harris eacdf1d46f Put back the check for dates that can be represented in DOS format the
way it was *supposed* to be done, rather than backwards.

svn path=/trunk/; revision=39895
2011-11-17 02:29:26 +00:00
Chris Maynard 6f2dc712b9 Revert part of r39883 to avoid dereferencing a NULL pointer. Thanks Clang.
svn path=/trunk/; revision=39894
2011-11-17 02:17:57 +00:00
Guy Harris 8281a7d28e Support nanosecond-resolution time for NetMon 2.x format (it's only
100-nanosecond resolution, but that's still better than microsecond
resolution).

For NetMon 1.x format, only claim to support millisecond resolution, as
that's all you get.

Fix handling of negative time deltas in NetMon 2.x format.

When writing a NetMon file, trim the time of the first packet to
millisecond precision to get the capture start time, so that the start
time written to the file (which has millisecond precision) is the same
as the start time used to calculate the deltas written to the packet
headers.

svn path=/trunk/; revision=39886
2011-11-16 17:54:44 +00:00
Guy Harris 234d0b9614 OK, this should do it.
svn path=/trunk/; revision=39885
2011-11-16 17:13:37 +00:00
Guy Harris 8be474f776 Fix build on Windows.
svn path=/trunk/; revision=39884
2011-11-16 17:12:47 +00:00
Guy Harris 163edbb507 Another place where we have to protect against MSVC's time-conversion
routines blowing up if handed a too-large time_t.

While we're at it, also check for dates that can't be represented in DOS
format (pre-1980 dates).

svn path=/trunk/; revision=39883
2011-11-16 17:08:00 +00:00
Guy Harris 5ceeb22529 Another place where we have to protect against MSVC's time-conversion
routines blowing up if handed a too-large time_t.

svn path=/trunk/; revision=39882
2011-11-16 16:48:02 +00:00
Guy Harris f5d4a4c7ba Clean up white space.
Note that we don't need to set the FCS length, but might as well do so
anyway.

svn path=/trunk/; revision=39816
2011-11-13 00:04:49 +00:00
Bill Meier 3227cade47 Add entries for WTAP_ENCAP_NETANALYZER... to encap_table_base[]
svn path=/trunk/; revision=39810
2011-11-12 20:27:32 +00:00
Anders Broman af25c3e77b From Holger Pfrommer:
Enhancement of Hilscher Analyzer Dissector.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6082

svn path=/trunk/; revision=39804
2011-11-12 18:01:38 +00:00
Bill Meier d1d9cf61c7 Add (missing) "mime" entry to encap_table_base[].
svn path=/trunk/; revision=39796
2011-11-11 22:21:06 +00:00
Guy Harris bc3796b7ac Updates based on stuff seen in a new capture.
I'm leaving debug messages in, but #if 0'ed out, for now.

svn path=/trunk/; revision=39736
2011-11-04 23:59:07 +00:00
Guy Harris 42c2e1c57b It appears that the "packet" records are actually "stuff from the ISDN
link" records, including stuff that's from a G.704 PRI frame but not
from a D or H channel in that frame.  Handle them (currently, we ignore
them).

The low-order bit of the flags field for "packet" records" is "network
to user" (NT->TE), not "user to network" (TE->NT).

svn path=/trunk/; revision=39663
2011-10-28 22:57:33 +00:00
Guy Harris 83aed00fac The version string field isn't followed by 20 bytes of stuff; the last 8
bytes of what we thought was a version string appears to be an 8-byte
record of some sort in the captures we originally looked at, and appears
to be a non-8-byte record in another capture.  If we treat that as a
record, the version string field appears to be null-padded and 41 bytes
long.

svn path=/trunk/; revision=39645
2011-10-28 02:48:52 +00:00
Guy Harris c0db24bf4d Fix cut-and-pasteo that happened not to cause a problem on *P64
platforms but failed on *P32 platforms.

Remove the debugging code (the above was the problem in question).

svn path=/trunk/; revision=39628
2011-10-27 03:00:03 +00:00
Guy Harris a4e597b545 Add some debugging code; the current code doesn't work when compiled
with MSVC on Win32, and the fix will remove the debugging code as well.

svn path=/trunk/; revision=39624
2011-10-26 23:41:15 +00:00
Guy Harris 05269a7178 Put the magic number into the aethra_hdr structure, to avoid compiler
padding of the structure getting in the way (it should now not require
padding).

svn path=/trunk/; revision=39619
2011-10-26 20:53:27 +00:00
Guy Harris d7515bff87 Add the code to read Aethra files.
svn path=/trunk/; revision=39592
2011-10-26 04:31:06 +00:00
Guy Harris b4415758bf Ok, we found what appears to be the capture start time. Use it.
Also mark what appear to be strings in the file header.

svn path=/trunk/; revision=39591
2011-10-26 04:05:17 +00:00
Guy Harris 12e95e2cda It appears that the octet in the record header after the record length
might be a record type, with 0 being a "Stop Monitor" record and 1 being
a packet.  Ignore records other than packet records.

svn path=/trunk/; revision=39590
2011-10-26 03:14:21 +00:00
Guy Harris 72a96fc6a6 Avoid warnings.
svn path=/trunk/; revision=39589
2011-10-26 02:37:45 +00:00
Guy Harris e9ae3a0fd6 Initial support for .aps files from Aethra Telecommunications' PC108
software.  More work is needed:

	we don't know where the capture start time is yet;

	we aren't handling the "stop capture" record;

	we don't know where the ISDN channel is;

	there might be non-ISDN file formats;

but this at least is easier than trying to text2pcap hex dumps from that
software into pcap files.

svn path=/trunk/; revision=39588
2011-10-26 02:18:55 +00:00
Gerald Combs 666b58d408 From Huzaifa Sidhpurwala of Red Hat Security Response Team:
I found a heap-based buffer overflow, when parsing ERF file format.
The overflow seems to be controlled by the values read from the file, 
and hence seems exploitable to me.

svn path=/trunk/; revision=39508
2011-10-21 19:07:42 +00:00
Stig Bjørlykke 967b9086aa Removed newencap as it's unused.
svn path=/trunk/; revision=39419
2011-10-14 08:22:16 +00:00
Anders Broman 62ba07a8fc From Tobias Witek:
This patch extends the ATM parser so as to allow GPRS NS traffic encapsulated
in ATM AAL5.

Additionally, added support for this into the 'Meta' dissector.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6447

svn path=/trunk/; revision=39394
2011-10-12 18:57:50 +00:00
Bill Meier 59e64cff77 From Robert Bullen: Fix for: Two minor bugs in Wiretap library:
First bug: The Network Instruments Observer file format abbreviation is
incorrect. It is "niobserverv" instead of "niobserver", which is probably a
vestige from 1.4 when the abbreviation was "niobserverv9".

Second bug: The packet header magic number field is correctly swapped the first
time when reading the entire packet header. It is incorrectly swapped yet again
when reporting an invalid value. Both swaps use GUINT_FROM_LE, which is a no-op
on little-endian platforms. But the error message that is displayed to users of
big-endian platforms will contain a byte-reversed value.

svn path=/trunk/; revision=39392
2011-10-12 18:04:58 +00:00
Anders Broman 6a847b1f30 From Andrew Kampjes:
Allows the saving of packets with snapped length to ERF. Prevents the adding of
automatic CRC and rounds down to the nearest 8 bytes instead of up, adding
zeros.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6409

svn path=/trunk/; revision=39247
2011-10-04 05:27:14 +00:00
Bill Meier 781129806f Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

svn path=/trunk/; revision=39081
2011-09-21 17:49:11 +00:00
Martin Mathieson c5cfc416a1 Skip extra info if present (IP with LTE PDCP threading info).
svn path=/trunk/; revision=38983
2011-09-13 12:14:24 +00:00
Guy Harris d7af4e2037 Don't synthesize a CRC if the packet already has one.
svn path=/trunk/; revision=38905
2011-09-06 23:36:18 +00:00
Stig Bjørlykke 415533faaf Check return value from wtap_dump_file_write.
This fixes CID 1272.

svn path=/trunk/; revision=38876
2011-09-03 20:47:58 +00:00
Guy Harris 6ac265b512 Merge pcap_fill_in_pseudo_header() into pcap_read_post_process().
svn path=/trunk/; revision=38844
2011-09-01 19:58:25 +00:00
Guy Harris e9fc1b72aa Use guint8 rather than guchar for raw octets and pointers to arrays of
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-09-01 09:43:10 +00:00
Guy Harris f16a746c63 Set eth.fcs_len in the pseudo-header for Ethernet packets.
Set the pseudo-header when doing the sequential read as well as when
doing random reads.

When writing packets to a CommView file, use a slightly less contorted
way to get the year/month/day/hour/minute/second values.

commview_dump() uses the pseudo_header argument; don't mark it as
unused.

svn path=/trunk/; revision=38833
2011-09-01 04:14:54 +00:00
Guy Harris 30ec5387fa Not ideal, but OK for now - alignbytes, at that point, is < 8, so we
know it'll fit in a gint16.  (alignbytes really shouldn't need to be 64
bits, as if we have 2^63-1 bytes of alignment, We Have A Problem; fixing
that may involve calculating it differently earlier in that routine.)

svn path=/trunk/; revision=38828
2011-08-31 22:22:40 +00:00
Stig Bjørlykke ff32408b0a Try using gint64 for alignbytes.
svn path=/trunk/; revision=38827
2011-08-31 21:16:18 +00:00
Stig Bjørlykke 141a830b9f From Andrew Kampjes via bug 6260:
Added support for saving ERF files.

From me:
Use crc routines from libwsutil.

svn path=/trunk/; revision=38826
2011-08-31 20:50:15 +00:00
Guy Harris 9756ac2904 Handle multiple extension headers when calculating the pseudo-header
length, and actually write out the extension headers when writing out
the pseudo-header.

Fixes bug 6265.

svn path=/trunk/; revision=38792
2011-08-30 08:09:40 +00:00
Guy Harris 4486bb9d85 A zero snaplen means "snaplen unknown", as in "the file format from
which we read the data to be written doesn't record the snapshot
length".  A snapshot length of 0 in a pcap or pcap-ng file is not
handled well by many programs reading those files; for pcap files, we
write out WTAP_MAX_PACKET_SIZE as the snapshot length in that case, so
do so for pcap-ng files as well.

svn path=/trunk/; revision=38790
2011-08-30 06:01:44 +00:00
Jeff Morriss 339136d1d0 Based on patch from Denis Ovsienko via
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6244 :

Fix typo: s/unkown/unknown/

svn path=/trunk/; revision=38561
2011-08-16 13:16:33 +00:00
Jeff Morriss 613ddfa1cc From Hanspeter via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6229 :
If an EnhancedPacketBlock in a pcapng file contains a comment option the
content isn't displayed. Instead "Malformed packet" is displayed with the
reason Exception occurred.

The reason for the problem is a bug in the pcapng.c, where for enhanced packet
blocks, interface description blocks and interface statistics blocks the wrong
union members are used to set the comment. This way required fields in the
structures are overwritten.

The attached patch solves the problem.

svn path=/trunk/; revision=38491
2011-08-11 21:42:37 +00:00
Martin Mathieson fe28dc854a Speed up (slightly) reading of long text lines.
svn path=/trunk/; revision=37989
2011-07-12 10:49:22 +00:00
Guy Harris 4c4b8f8891 Move the definitions of LANalyzer records to lanalyzer.c.
Use LA_RecordHeaderSize rather than sizeof, to squelch some compiler
complaints.

svn path=/trunk/; revision=37956
2011-07-10 22:57:59 +00:00