aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2016-02-11Make file indices consistently unsigned in the merge code.Guy Harris2-7/+7
Change-Id: Ie531e5c24c32ca86abbe0c2b5d3526014e5fb831 Reviewed-on: https://code.wireshark.org/review/13897 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-11Avoid undefined behavior in overflow checkMichael McConville1-1/+1
Signed overflow is undefined, so testing for overflow with "if (i + 1 < i)" is itself undefined. Because this instance is an increment, we can just test against G_MAXINT. Change-Id: Ib8b7c23ec362d5637125fcf6457ea9423fedf0e1 Reviewed-on: https://code.wireshark.org/review/13896 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-29No need for a routine to return a GSList of extensions for compressed files.Guy Harris3-73/+26
Just use the table - or an empty table if we're not including the compressed file extensions. Change-Id: I0b3ef3987e1986953f2957c27c84b2ee59b90bc0 Reviewed-on: https://code.wireshark.org/review/13611 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-29Add A-MPDU reassembly information to the radio metadata.Guy Harris1-0/+9
Change-Id: I338e7fb60ff62d1d26ca0b32468ada4294d52d8d Reviewed-on: https://code.wireshark.org/review/13594 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-28autotools: Don't use "user variables" to set build flagsJoão Valverde1-13/+4
GNU coding standards recommend against it and automake is designed around it. This allows overriding the global build flags using AM_CFLAGS, etc., or per object flags, something that is difficult or impossible currently because of automake precedence rules. Change-Id: I3f1ea12e560af5a46b2f04b342b1882bbf123f12 Reviewed-on: https://code.wireshark.org/review/13455 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-01-25phdr->pkt_encap and phdr->pkt_tsprec need to be set for seek-read too.Guy Harris1-0/+13
We set them to the file's values in wtap_read(), but we weren't setting them in wtap_seek_read(); set them in both places. Change-Id: Id604b1c7d27d4cee6600249e9435c49d02f8dd61 Reviewed-on: https://code.wireshark.org/review/13531 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-20Note that using file_gets() for UCS-2 files is a bit of a hack.Guy Harris1-0/+4
Change-Id: I09cb8c8ea86c83f079c0882ca2f28e2f7c338b51 Reviewed-on: https://code.wireshark.org/review/13429 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-20Fix indentation.Guy Harris1-31/+31
Change-Id: I9fc0b8f98439ac37d4356e742d8c411e2dce473f Reviewed-on: https://code.wireshark.org/review/13425 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-17Fix build [-Werror=maybe-uninitialized]João Valverde1-0/+2
Found building with GCC 5.3.0 and CFLAGS="-g -Og". Change-Id: I5bc29b6e91cc98332a513c9d03b02d2f6906608d Reviewed-on: https://code.wireshark.org/review/13362 Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-01-17[iseries] fix iseries_check_file_type()Martin Kaiser1-6/+15
check that we have a line that contains OBJECT PROTOCOL ETHERNET (at the moment, we fail if there's a line containing OBJECT PROTOCOL but not ETHERNET and succeed otherwise -> a file with some random lines will be identified as iseries) initialize our line buffer with 0s to make sure we don't access uninitialized data while parsing don't set wth->priv unless the file is really an iseries file free the iseries struct if the file is not our type Bug: 11985 Change-Id: I0ac7003c047f54ca025d02e59b56d1ff4e2a6be7 Reviewed-on: https://code.wireshark.org/review/13360 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-01-17[iseries] return WTAP_OPEN_ERROR if file_seek() failsMartin Kaiser1-1/+1
like it's done for the other file types Change-Id: I8caa360b9c527ea642ee6b5102759ad341ad0030 Reviewed-on: https://code.wireshark.org/review/13359 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-01-16Add WTAP_ENCAP_NFC_LLCP to the list of types require a pseudo-header.Guy Harris1-13/+15
Discovered by changing wtap_encap_requires_phdr() to use a switch statement and comparing the case arms. Change-Id: I2a23b86ddfbc88c1b3251a0e97f7f00ee93f630e Reviewed-on: https://code.wireshark.org/review/13341 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-16Improve Error messages when failing to load pcapng filesMichael Mann1-20/+23
Include the pcapng block name in every error message to give user a better hint as to where the error is Bug: 8798 Change-Id: Idd80a8541ac37a42b9bd2e988fa8da1ce7bc91a0 Reviewed-on: https://code.wireshark.org/review/13310 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-13Move structure definition outside another structure definition.Guy Harris1-4/+6
I guess the ability to define a structure inside another structure is a C-ism discarded by C++, so it causes warnings if you disallow stuff that can't be handled by a C++ compiler, as we do. Change-Id: I8cf52af0424708eb663ab6dbfecbf317fe3bccdb Reviewed-on: https://code.wireshark.org/review/13257 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-13Get rid of debugging printouts.Guy Harris1-5/+0
Change-Id: I78fd79ebf915e9066f9e2548dcceb3c9e6440551 Reviewed-on: https://code.wireshark.org/review/13255 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-13Clean up handling of the data before the Ethernet packet in ERF files.Guy Harris4-14/+32
The data before the Ethernet packet isn't a 16-bit little-endian integer, it's two bytes, one byte of offset and one byte of padding. Change-Id: I327b88f058dda184b79d3c2c6cf0dea52c0d28b1 Reviewed-on: https://code.wireshark.org/review/13254 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-13Fix issue with dumping to logcat_text from UPPER_PDUmichal.orynicz1-0/+11
When using UPPER_PDU to wrap logcat text data it was not possible to dump underlying data to logcat textfiles. Add ability to write it down properly. Change-Id: Ia20142cc340f34d80de93e213084cf1df83099d6 Reviewed-on: https://code.wireshark.org/review/13230 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-13Dissect the MC and AAL2 headers as 32-bit words.Guy Harris3-1/+20
That's how they're extracted in the libwiretap module, and that's how they're shown in the ERF spec. This gets rid of some compiler warnings about type-punning. Merge some reserved bit fields to match what's in the ERF spec. Renumber others. Process the AAL2 and MC headers differently; yes, they're both big-endian 32-bit values, but that makes the code a bit clearer, and, heck, the optimizer may well combine the two sequences of code. Change-Id: Ief7f976e77e8f2fba1685ad5a50ee677a8070ae7 Reviewed-on: https://code.wireshark.org/review/13251 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-13Assorted cleanups.Guy Harris1-13/+13
Fix indentation. Just directly assign values to elements in the packet buffer; no need to convert them to numbers and note the value as a comment. Give more detail in the comment for null-terminating buffers. Terminate packet_buf[] once we're finished reading into it, to make it a bit clearer what's being done. Make the magic number buffer 513 bytes, so we have 512 bytes plus a terminating null. Change-Id: Ie182d93393cc55835b24075e908393c386c85c24 Reviewed-on: https://code.wireshark.org/review/13250 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-13nettrace_3gpp_32_423 Protect from buffer overun.AndersBroman1-1/+5
Bug: 11982 Change-Id: Ib704d9128ab6427751edbf3a33f4b8fd14902562 Reviewed-on: https://code.wireshark.org/review/13233 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-13Use g_ntoh* rather than g_hton*.Guy Harris1-5/+5
Stuff in an ERF file is big-endian, except for timestamps, so we want to convert from big-endian to host format. (The two functions do the same thing; this just makes it clearer what we're doing.) Change-Id: I28e27857dcf299085e8a55747ffd45ad8313789b Reviewed-on: https://code.wireshark.org/review/13248 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-08Note that sometimes the packet time stamps are relative to the start time.Guy Harris1-2/+7
Change-Id: Ie248559cd924db611190a73e3f043e047421ab7f Reviewed-on: https://code.wireshark.org/review/13117 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-08Improve an error message.Guy Harris1-1/+1
Change-Id: I9c406bbd146ef525e5348f620c606d1296d3bd10 Reviewed-on: https://code.wireshark.org/review/13116 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-05GFP: Add support for Generic Framing Procedure (ITU-T G.7041/Y.1303)John A. Thacker3-4/+12
Add support for Generic Framing Procedure. Generic Framing Procedure (GFP) is used to map octet-aligned variable length payloads (e.g. Ethernet, MPLS, octet-aligned PPP, IP) into octet-synchronous signals such as SONET/SDH (ITU-T G.707) and OTN (ITU-T G.709). GFP is a telecommunications industry standard defined in ITU-T G.7041/Y.1303. (https://www.itu.int/rec/T-REC-G.7041/) Bug: 11961 Change-Id: Idf5b311e82b051b1ee65bde5149b3de405537b02 Reviewed-on: https://code.wireshark.org/review/13043 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-31Don't cast away constness.Guy Harris1-11/+51
Change-Id: I529d37e57b12fa7515f2bd18a013618b50300231 Reviewed-on: https://code.wireshark.org/review/12974 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-24Refactor 802.11 radio flags.Simon Barber9-187/+142
The use of a flag field here is aesthetically unpleasing when the flags are referred to frequently. Convert these into bitfield entries. Change-Id: I6f47e31558439dfd343ec7f856d04480366a1237 Reviewed-on: https://code.wireshark.org/review/12511 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21Squelch another warning.Guy Harris1-1/+1
Change-Id: I7340954d9ca2fd11a6db2aa7cd5493d870181e23 Reviewed-on: https://code.wireshark.org/review/12765 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21Squelch some compiler warnings.Guy Harris1-3/+3
Change-Id: Iee46c43498f42e19dfab0178e80743d35d843d2d Reviewed-on: https://code.wireshark.org/review/12762 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-21Rename some variables to make it a bit clearer what they are.Guy Harris1-31/+31
rec_length_remaining is the amount of data we haven't already read from the record; it starts out as the record length and gets decreased. It is not the length of data in the packet. Change-Id: I46cd78e29aee13a686f1f6c8efbe258277e15686 Reviewed-on: https://code.wireshark.org/review/12759 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-20Add bounds checks and fix a length argument.Guy Harris1-15/+34
Before reading the record header of a REC_FRAME{2,4,6} record, make sure the record length is >= the length of that header. Whe calling fix_pseudo_header(), pass the actual length of the packet data, not the remaining length of the record (which may include padding), so we don't read past the end of the packet data. Bug: 11827 Change-Id: I1c63a4cb014c4616ffdd202660e68c576f266872 Reviewed-on: https://code.wireshark.org/review/12756 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-19Add missing ERF types, mention another missing type, mention reserved space.Guy Harris2-0/+9
Add the TYPE_COLOR_HASH_POS and TYPE_COLOR_HASH_ETH types, note that type 26 has no #define, mention that types 28 through 31 are reserved for future record types. Change-Id: Ic828254599599c6bd7399d4682f9a3d4bff1f0f7 Reviewed-on: https://code.wireshark.org/review/12728 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-19ERF: Add basic no-break support for ERF_TYPE_META.Anthony Coddington2-5/+21
Update erf_open heuristic to not break when ERF_TYPE_META records are present. Remove check for maximum non-pad ERF type and add defines for reserved types. No dissection in this commit beyond record type name, this will come later. Change-Id: Ib64e450e26b2878b5519fb6afeafa2ce9477ac85 Reviewed-on: https://code.wireshark.org/review/12708 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-18Removed local definitions of offsetof().Stig Bjørlykke1-4/+2
The offsetof() macro is an ANSI C library feature. Change-Id: I2ac91b0b4c94c6f6baf14133b076fdc5ed2e182b Reviewed-on: https://code.wireshark.org/review/12707 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-16Make zlib API constness-aware, take 2.Guy Harris2-5/+17
ZLIB_CONST must be defined before including zlib.h to expose z_const, *AND* z_const shouldn't be used unless it's defined, because older versions of zlib don't define it even if you define ZLIB_CONST. While we're at it, throw in some DIAG_OFF(cast-qual)/DIAG_ON(cast-qual) pairs to suppress unavoidable "cast throws away const qualification" warnings. The original "make zlib constness-aware" change also removed an unnecessary include of <zlib.h> from wiretap/wtap.c, so we do that as well. Change-Id: I3c5269a8fbc54bbbb4d316544cc7b8fa30614c19 Reviewed-on: https://code.wireshark.org/review/12675 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-16Revert "Make zlib API constness-aware"Guy Harris2-3/+10
This reverts commit fb0246c6fd7cd34b820558f75eb48bba6326b768. That commit assumes that if you define Z_CONST, z_const will be defined; that is *not* the case with older versions of zlib, which don't define z_const under any circumstances. Change-Id: I6f9b7ea18922799b1aaf94dc2c63120128f2550a Reviewed-on: https://code.wireshark.org/review/12671 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-16Make zlib API constness-awareJoão Valverde2-10/+3
ZLIB_CONST must be defined before including zlib.h to expose 'z_const'. Change-Id: Ic0dbd59ed3c760dd84ef4546f6ff4d5d3db91519 Reviewed-on: https://code.wireshark.org/review/12547 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-06Get rid of a bunch of unused variables.Guy Harris3-9/+1
("Unused" includes "set but not used".) Change-Id: Id67859b366e8caa50262f8530630ec4e8ef1507a Reviewed-on: https://code.wireshark.org/review/12457 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-05Revert "Build Flex-generated files with "warnings are errors"."Guy Harris3-16/+29
This reverts commit b56f53884be3bab935058b2bbbb4da0b8bbbe7f6. Sadly, we *do* get warnings at this point with older versions of Flex, such as the one on the 32-bit OS X buildbot. Change-Id: I9aec1a16e9f2e1bbcfaac3dffdabdd89af5815e3 Reviewed-on: https://code.wireshark.org/review/12443 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-05Build Flex-generated files with "warnings are errors".Guy Harris3-29/+16
We shouldn't be getting warnings at this point. Change-Id: I363a48546cb8d916425f42962ae1697d52ed9a29 Reviewed-on: https://code.wireshark.org/review/12436 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-05Use noyywrap rather than defining our own yywrap functions.Guy Harris2-22/+10
Tweak lemonflex-tail.inc to fix an issue this reveals. It appears that, at least on the buildbots, the Visual Studio compiler no longer issues warnings for the code generated with %option noyywrap. Change-Id: Id64d56f1ae8a79d0336488a4a50518da1f511497 Reviewed-on: https://code.wireshark.org/review/12433 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-03[MP2T] Reading buffer should have MP2T_SIZE+TRAILER_LEN_MAX space to give ↵Michael Mann1-1/+1
room for non-zero trailer. Bug: 11820 Change-Id: I7e0a603c20ca0c524399beb3d89e14c45dc3a06e Reviewed-on: https://code.wireshark.org/review/12393 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-02Move the bitrate test against 0 to mp2t_bits_per_second().Guy Harris1-18/+26
As the comment says, that routine "[ensures] there is a valid bitrate", and a bitrate of 0, which comes from truncating a fractional bitrate, is not a valid bitrate (an MPEG-2 Transport Stream with a bitrate less than 1 bit per second is not going to carrry any sensible audio/video stream). Make the "first" argument unsigned; it can never be negative. Restructure the code and change some data types to make it more obvious that it can't. Change-Id: Idd4d073dc558bb31271318e14b2f74292cd16a2b Reviewed-on: https://code.wireshark.org/review/12352 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-01autotools: Fix g212f2f1João Valverde1-1/+1
Change-Id: If7185885faea2319fdce4d89a7a9bf40312bcfa6 Reviewed-on: https://code.wireshark.org/review/12346 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-01[MP2T] Prevent divide by zero.Michael Mann1-0/+5
Bug: 11821 Change-Id: I3243c837d84ccbce7d377810a5f381e906aeb1eb Reviewed-on: https://code.wireshark.org/review/12323 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-01autotools: Clean abi-check with maintainer-cleanJoão Valverde1-1/+8
Change-Id: Ia2ce54592485d2995bcfd56bd127a2fedb1a7d07 Reviewed-on: https://code.wireshark.org/review/12293 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-30Handle Date: headers differently from other headers.Guy Harris1-43/+81
Handle Date: outside the "loop over magic strings" loop; that way, we don't have to compare against "Date:" twice. Don't use strlen() on constant strings - sizeof string - 1 lets us calculate the length at compile time. Change-Id: I7e4ff2f9762f96749a39609efa76430e5915d4f4 Reviewed-on: https://code.wireshark.org/review/12302 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-30Add some comments explaining what some code is doing.Guy Harris1-1/+26
Change-Id: Ib229fcf4d14fd3c01755f868789f430496c23ded Reviewed-on: https://code.wireshark.org/review/12300 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-30Treat invalid (negative or too-large) values in the packet header as errors.Guy Harris1-1/+61
Change-Id: I86564c485aacd3fcba3f3d8d9da492e0100155e8 Reviewed-on: https://code.wireshark.org/review/12299 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-30Fix out-of-bounds read in ascend_seek.Michael Mann1-0/+1
Bug: 11794 Change-Id: I74517806b119729ae6d9780bbd4bb094701ff05e Reviewed-on: https://code.wireshark.org/review/12266 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-29Add bounds checking to find_signature.Michael Mann1-2/+2
Bug: 11791 Change-Id: Ibaa2c16229c1b78818283ba5f954b09f3894dc60 Reviewed-on: https://code.wireshark.org/review/12270 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>