Commit Graph

3577 Commits

Author SHA1 Message Date
Guy Harris a4ebc98fa4 iptrace: various cleanups.
Call the "iptrace X.Y" string we read in the version string, rather than
the name.

Get rid of the structures defining various parts of the file format.
Instead, have #defines for offsets.

Read the record header - the first 8 octets - first.  Check the record
length, to make sure it's large enough to include the packet information
structure, before we try to read that structure.

Note that one octet in the packet information structure is the unit
number for the interface on which the packet arrived, the field that was
called the name is the prefix of the name (in the sense that, for
example, in "en0", "en" is the prefix and "0" is the unit number), and
that what was called the "description" isn't as simple as a description
of the interface on which the packet arrived.

Pass the field that was called the "description" to
fill_in_pseudo_header(), as, for ATM PDUs, it contains, among other
things, an indication of the VPI and VCI for the PDU, as well as a
direction indication.

Change-Id: I8703b046142dd41ca96bda00c2fa3d2edb66b837
Reviewed-on: https://code.wireshark.org/review/37974
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-27 09:21:08 +00:00
Guy Harris 75c739e4b7 ISDN, LAPD: clean up the way they connect to other dissectors.
Have the ISDN dissector take the ISDN pseudo-header through its data
argument, rather than assuming it's in pinfo->pseudo_header, so it can
be used if the link-layer type of the capture isn't ISDN.

Have it add the direction to its protocol tree, so it's there for all
ISDN packets.

Have more versions of the LAPD dissector:

	one where the ISDN direction information is available through
	an ISDN pseudo-header passed as its data argument;

	one for use when the link-layer type *is* LAPD, where the ISDN
	direction information may be available through the direction
	part of the packet flags.

Pass more flags to the routine that does LAPD dissection to indicate the
direction (user->network or network->user) and whether the user or
network side is on another machine; set those appropriately in the
dissector routines that call it.  To set those flags:

	in the routine that handles WTAP_ENCAP_LAPD, check the direction
	flags in pinfo->rec->rec_header.packet_header.pack_flags;

	in the routine that handles WTAP_ENCAP_LINUX_LAPD, check the SLL
	header;

	in the routine that's called from the ISDN dissector and other
	dissectors that can supply an ISDN pseudo-header, check the
	struct isdn_phdr passed to it via the data argument;

	for the routine that's to be called from L2TP pseudowire type
	and SCTP dissector tables, pass nothing, as there's currently
	no direction indication supplied - if that information is
	available from the encapsulating protocol in some fashion, we
	should make changes to supply that information.

Have the AudioCodes Trunk trace protocol dissector call the
LAPD-with-pseudoheader dissector, handing it an ISDN pseudo-header with
a direction indication from the direction field (and a channel of 0 to
indicate the D channel).

Have the Ascend text dump reader in libwiretap use WTAP_ENCAP_ASCEND for
all packets, even Ethernet and ISDN packets, and have the Ascend text
dump dissector handle that, calling the "no FCS" version of the Ethernet
dissector and calling the LAPD-with-pseudoheader dissector with a
pseudo-header filled in with the direction (and a channel of 0).

Have the Catapult DCT 2000 text dump dissector call the
LAPD-with-pseudoheader dissector with the pseudo-header supplied by
libwireshark.

Have the V5 envelope function frame get its ISDN pseudo-header from its
data argument, and call the LAPD-with-pseudoheader dissector with that
pseudo-header.

Have the ISDN dissector treat its data argument as pointing to the ISDN
pseudo-header, rather than assuming it's the one in
pinfo->pseudo_header->isdn - the latter is the one supplied by
libwiretap, but there's no guarantee that an ISDN pseudo-header was
supplied by libwiretap, as the lowest-level protocol layer might not
have been ISDN.

Change-Id: I9f702b879bbc3fb42bcb43c28f797bfc327562c6
Reviewed-on: https://code.wireshark.org/review/37953
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-25 18:31:34 +00:00
Guy Harris 9db3ce11eb ascend: update a comment.
Change-Id: I652a033132a90b10421e763cfbe4b47ae4e6087a
Reviewed-on: https://code.wireshark.org/review/37924
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-22 07:15:10 +00:00
Guy Harris 8cf626bf16 nettl: user IDs are 32-bit in HP-UX.
Also note that the record header might have additional stuff at the end,
although not all record headers do (the header length will indicate
what's there).

Change-Id: I5a9ff1f9cd592448bcc45d18808f4b651cdb2f0d
Reviewed-on: https://code.wireshark.org/review/37921
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-21 22:48:21 +00:00
Gerald Combs 4a4c8bdfea Systemd journal: Fix timestamp conversions.
Use ws_strtou64 to convert __REALTIME_TIMESTAMP= and other timestamps,
which should work across platforms.

Bug: 16664
Change-Id: I371f2b60e1957e57dbbdbbc3ded5ad49e8eb79d1
Reviewed-on: https://code.wireshark.org/review/37849
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-14 04:02:35 +00:00
Anders Broman f0158ea131 Nettrace: Try to fix -Wpointer-sign warnings.
Change-Id: Ib2fe089939513f2fa32235312cdc70c9148cdfc3
Reviewed-on: https://code.wireshark.org/review/37723
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-06 10:40:52 +00:00
Martin Kaiser 23aa1ed679 mplog: increase the max packet length to 4096
iso14443 packets can now be up to 4k long.

Change-Id: I120e18146cc40c0e9230c654cc31072e03ad3489
Reviewed-on: https://code.wireshark.org/review/37691
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-05 12:13:48 +00:00
Guy Harris b46a554ae7 Packetlogger: check for more packet types in the libwiretap heuristics.
As we're now checking the first *few* packets of the file, we must allow
*all* Packetlogger packet types when checking whether the purported
packet type is valid.

Put a note in the Packetlogger dissector so that, if anybody adds a new
packet type, they know that they have to add it to the reader code as
well.

Bug: 16670
Change-Id: Id83493f678182fd3e1b5537f4dfa295fe26dfcb1
Reviewed-on: https://code.wireshark.org/review/37675
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-02 21:29:23 +00:00
Eelco Chaudron d96e72ee2d pcapng: add support for new Enhanced Packet Block options
Add support to read/write the new EPB options, epb_packetid,
epb_queue and epb_verdict, from/to pcap files.

In addition, it updates the packet-frame dissector to dissect
these new fields.

More details on the options can be found in the PcapNG
specification: https://github.com/pcapng/pcapng

An application using these new fields can be found here:
  https://github.com/chaudron/xdp-tools/tree/dev/pcapngII/xdp-dump

Change-Id: I761b8114b437fe573dd2c750e35586ad88494938
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-on: https://code.wireshark.org/review/37412
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-21 15:23:27 +00:00
Guy Harris 5336ae7d84 ascend: add a couple of comments.
Change-Id: I92a84087122e3997f7d2481f82f955987cf8f8dd
Reviewed-on: https://code.wireshark.org/review/37494
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-17 10:28:01 +00:00
Guy Harris 86eba21b82 Squelch a Coverity warning.
I guess Coverity gets upset because, the way GUINT32_TO_BE() works when
building with Coverity, there's at least one test done the result of
which is always the same.

Calculate the "native" value of the direction, and then put it into
big-endian order, in two separate statements.

This should squelch Coverity CID 1457345.

Change-Id: I1ccd6fd848e6abc91f16fa375c98efcab9c5bf60
Reviewed-on: https://code.wireshark.org/review/37370
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-02 23:19:29 +00:00
Minh Phan 88aec0ecd9 editcap: fix time adjustment for ERF
The erf_dump function in erf.c keeps the header intact and
ignores the adjusted time.
This adds a section for checking if the timestamp is changed
and updating the header accordingly.

Bug: 16578
Change-Id: I14468a302e746c7a84cf5619b73b94850142d930
Reviewed-on: https://code.wireshark.org/review/37301
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-01 06:51:55 +00:00
Glenden Lee a584fd9fb6 ieee80211: Add datarate for 802.11AX packets
Bug: 16255 - support HE MCS to rate conversion
Change-Id: I4a4a6c3d62c167b654d150c397047a55f287e6c8
Reviewed-on: https://code.wireshark.org/review/37255
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-27 21:45:43 +00:00
Guy Harris 7e7db3e91c sll: add support for LINKTYPE_LINUX_SLL2.
Different header, with a different size, an additional field, and with
fields being in a different order.

Distinguish between V1 and V2 by giving the version.

That means we can no longer use the "ethertype" dissector as it stands,
because the packet type field isn't at the end of the header, right
before the payload; pull the "add the type field to the protocol tree"
functionality out of the "ethertype" dissector and leave it up to the
dissector calling it.

Change-Id: I72b8a2483c0a539919fbe5d35fd7e60bff4bf75a
Reviewed-on: https://code.wireshark.org/review/37169
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-09 03:14:50 +00:00
Guy Harris 2480d9b69a Add an encapsulation table entry for WTAP_ENCAP_MP4.
Change-Id: Ia156359e68fbf543f00e8106ad76f9cf9532d3d8
Reviewed-on: https://code.wireshark.org/review/37166
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-08 19:53:41 +00:00
Guy Harris be63a17e54 wiretap: move the "fake an IDB for pcap files" code to libpcap.c.
That can just be done at the end of libpcap_open(), rather than in
wtap_open_offline() immediately after the open routine - which, in this
case, would be libpcap_open() - returns.  That's cleaner, as it puts
capture-file-type-dependent code in the capture-file-type-specific code.

Note, though, that it's a bit weird for LINKTYPE_ERF files (and it was
equally weird before this change), and that other capture file types
should be doing this as well.

Change-Id: Ida94779a2e1021c81314f82655ec1d0f2f14e960
Reviewed-on: https://code.wireshark.org/review/37022
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02 05:12:11 +00:00
Guy Harris 7d95c27de2 ERF: split wiretap/erf.h into three files.
wiretap/erf_record.h has declarations for records in ERF files and in
LINKTYPE_ERF packets in pcap and pcapng files.

wiretap/erf-common.h has declarations of routines to be called by
pcap/pcapng reader code when processing LINKTYPE_ERF packets.

wiretap/erf.h is what's left, for use by wiretap/erf.c and the code with
the tables of file readers and writers.

Change-Id: Ia982e79b14a025a80dcbc7c812fb3b2cdb9c6aaa
Reviewed-on: https://code.wireshark.org/review/37021
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02 04:24:08 +00:00
Guy Harris 9d30864607 wiretap/erf: Get rid of no-longer-used routine.
I guess the "replace" part of "TODO: Replace uses in pcapng and pcap
with erf_read_header() and/or erf_populate_interface_from_header() and
delete." has been done, so we do the "delete" part.

Change-Id: Icd691aa8c3defdd68c306ad9eaf1379a8ba6ec0f
Reviewed-on: https://code.wireshark.org/review/37020
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02 03:33:29 +00:00
Guy Harris 0e0f20bc7d wiretap: add a routine that adds a wtap_block_t for an IDB to a wtap.
Change-Id: I0a2e09bc3d1a858a304ded0c42be6bf09034812e
Reviewed-on: https://code.wireshark.org/review/37019
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02 02:50:50 +00:00
Guy Harris e548eceeac wiretap: combine common code into a common routine.
Change-Id: I7329bea02e2264ffb70515b681609bff91575267
Reviewed-on: https://code.wireshark.org/review/37012
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01 22:07:17 +00:00
Guy Harris f35865428b mpeg: make sure the presence flags are set.
The time stamps are calculated by sequential processing, not read from a
value in the packet record, so we don't supply them when reading
randomly.  Make sure the presence flags are 0 in that case (our callers
currently don't look at time stamps when reading randomly, because
some other file formats also don't supply time stamps for random reads,
but we should make it clean).

Change-Id: I494acc5bdf60e0a1de5cf002c3ea8403afce8a07
Reviewed-on: https://code.wireshark.org/review/37008
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01 21:27:41 +00:00
Guy Harris f0db07421f camins: make sure the presence flags are set.
The time stamps are calculated by sequential processing, not read from a
value in the packet record, so we don't supply them when reading
randomly.  Make sure the presence flags are 0 in that case (our callers
currently don't look at time stamps when reading randomly, because
some other file formats also don't supply time stamps for random reads,
but we should make it clean).

Change-Id: Ic035cc7d4eb36f76beefcfd98a389af09365d363
Reviewed-on: https://code.wireshark.org/review/37004
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01 21:20:05 +00:00
Guy Harris 582ad24c38 Remove some single-SHB assumptions.
Make wtap_file_get_shb() take a section number argument, and update code
that called it.  In most cases, we convert the code to iterate over
sections; in cases where a big code change would be required, we
temporarily pass it 0 and mark the code as "needs to be updated for
multiple sections".

Eliminate cf_read_section_comment(); in calls outside file.c, other code
directly calls the libwiretap routines it calls and, inside file.c, we
just transplant the code and then fix it not to assume a single SHB.

Change-Id: I85e94d0a4fc878e9d937088759be04cb004e019b
Reviewed-on: https://code.wireshark.org/review/37000
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01 19:46:42 +00:00
Guy Harris 3bb7d00d41 pcapng: have per-section interface tables rather than per-file.
This moves us closer to fixing bug 16531; it addresses the second issue
there, as the right snapslen is used for packets in the second section,
so we no longer get errors reading the file.

It still doesn't fix the *names* of the interfaces, and it doesn't - and
*shouldn't* - show the interfaces with different interface numbers, as
the numbers are per-section rather than global.

Change-Id: Ia3aa3309b75a4bcd9f229048ddce6a981b9409b1
Ping-Bug: 16531
Reviewed-on: https://code.wireshark.org/review/36985
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-30 18:10:53 +00:00
Guy Harris 07576e9f3b pcapng: clean up handling of current vs. new section.
Have pcapng_read_block() take two pointers to a section_info_t as
arguments - one for the current section, if any, and one to something to
fill in, as information for the new section, if the block is an SHB.

The first of them is null when we're trying to read the first block;
that serves as an indication that "not an SHB" means "this file isn't a
pcapng file" rather than "this pcapng file is bad".

Change-Id: I1b0a8bfacde982b819e548847bcc9412d30788f3
Reviewed-on: https://code.wireshark.org/review/36984
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-30 09:50:59 +00:00
Guy Harris 67f6809d8b pcapng: free up the section table when closing the file.
Change-Id: Iad70785b2baf178c16d1d333479590d3909150e5
Reviewed-on: https://code.wireshark.org/review/36983
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-30 08:17:11 +00:00
Guy Harris 1e80803aa1 Support reading mixed-byte-order pcapng files.
Move the byte order - and version - fields out of the per-file pcapng_t
structure and put them in a per-section section_info_t structure that
also contains the file offset of the SHB at the beginning of the
section.

Have a GArray of section_info_t structures pointed to by the pcapng_t
structure; update it as Section Header Blocks are read sequentially,
adding new structures.

In the random read routine, search backwards through the array of
section_info_t structures, looking for the first section where the SHB
is at or before the offset from which we're reading.

Change-Id: Iad06c8d1ff10595707b73f297f073803b5a0c8e5
Ping-Bug: 15707
Reviewed-on: https://code.wireshark.org/review/36981
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-30 08:02:12 +00:00
Anders Broman 61d923da39 bison/flex: comment why we ignore deprecated directive warning.
Change-Id: Ia2c6500180f5f28c25311c4763406de4174dc223
Reviewed-on: https://code.wireshark.org/review/36970
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2020-04-30 07:57:39 +00:00
Alexis La Goutte 581e34d9e9 nettrace_3gpp_32_423(wiretap): Fix Dead Store
Fix dead store (Dead assignement/Dead increment) Warning found by Clang

Change-Id: I6316d82fec8ee87f56cabe27e269cc7ef98cedc8
Reviewed-on: https://code.wireshark.org/review/36842
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-15 04:10:18 +00:00
Dario Lombardo c2d67c0928 wiretap: don't use memset where possible.
Change-Id: Id74764242ba13fb4ed58299a475096a64e5c6b5b
Reviewed-on: https://code.wireshark.org/review/36838
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-14 06:23:00 +00:00
Guy Harris ada1a5c770 Add record length checks.
Make sure the summary record is large enough; if not, report it as a bad
file.

If it's *too* large, skip the added data.

Clean up the length check for the header records - use sizeof, as we
later use sizeof when subtracting the fixed length portion's length.

Change-Id: I70697804eaa0cbbb1fb074eadf6457d237f26876
Reviewed-on: https://code.wireshark.org/review/36814
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-12 22:44:12 +00:00
Guy Harris 1070d7b376 Fix a comment.
Change-Id: I91ba743029247c7fcfac11bdfe7fc15680ab4137
Reviewed-on: https://code.wireshark.org/review/36810
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-12 21:37:37 +00:00
Guy Harris e80592b5ce Fix previous change.
Get rid of leftover duplicate code setting up the wtap structure and
private data before we've found a summary record.

If we find no data records, break out of the loop, so we fall into the
code that sets up the wtap structure and private data.

Change-Id: I00652bb7f3cb52b6c7c2088c6dd5fe5ec9a012a7
Reviewed-on: https://code.wireshark.org/review/36806
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-12 21:05:52 +00:00
Guy Harris d8615d27b4 Fix the heuristic for checking whether it's a CAM Inspector file.
wtap_read_bytes() returns TRUE on *success*, so if we're in the loop,
the last read succeeded, and no error code was supplied.  When we *exit*
the loop, the read didn't succeed; check for the status then.  If we got
a short read, we ran out of file data, so check the heuristics (even if
it's not an integral number of 2-byte blocks, treat it as a CAM
Inspector file - it might have gotten cut short); if we got a real read
error, report that to our caller.

Bug: 16458
Change-Id: Ia1e838006744dadbc2883459aec16d0d11b732e1
Reviewed-on: https://code.wireshark.org/review/36795
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-12 04:13:25 +00:00
Guy Harris edf694393b lanalyzer: Make sure a LANalyzer file has exactly one summary record.
If it has none, we don't know what link-layer header type it has, nor do
we have a start time to use for time stamps.

If it has more than one, we don't know which one to believe.

Bug: 16459
Change-Id: I306ec45171f9de4643699a53a4d837f4f7750c69
Reviewed-on: https://code.wireshark.org/review/36791
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-12 03:17:58 +00:00
Guy Harris c4d32e8ddf Handle nanosecond-resolution pcap files.
Change-Id: I799c00822e5a815005b50b57325ac729e0d3eec2
Reviewed-on: https://code.wireshark.org/review/36515
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-03-21 06:14:53 +00:00
Anders Broman a5926fdda7 nettrace_3gpp_32_423: Improve parsing.
Change-Id: I4593154a7791355afff76f7ca823c7f786605490
Reviewed-on: https://code.wireshark.org/review/36224
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-28 15:24:37 +00:00
Martin Mathieson ce0d780c3f Some more issues spotted by PVS-Studio in bug 16335.
Trivial, mostly just redundant assignments or
format specifiers.

Change-Id: Iaf33f24d2af5a48a5e1b797e582bf936914c8daa
Reviewed-on: https://code.wireshark.org/review/36154
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-02-23 21:43:51 +00:00
Martin Mathieson 7e02165453 More issues spotted by PVS-Studio in bug 16335.
Only the change to packet-imap.c really represents a bug.

Change-Id: Ie270f97f3d94c338ea3c84a712f8f4d43ffd36f4
Reviewed-on: https://code.wireshark.org/review/36115
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-16 11:51:55 +00:00
Guy Harris a152e041fa Put various epoch time deltas into wsutil/epochs.h.
There are some deltas between the UN*X epoch and other epochs that are
used in a number of places; put them into a header.

Change-Id: Ia2d9d69b9d91352d730d97d9e4897518635b4861
Reviewed-on: https://code.wireshark.org/review/35895
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-01-21 23:37:05 +00:00
Dario Lombardo e38fea4dba netscaler: fix nstrace_ensure_buflen call.
The call must ensure enough bytes are in the buffer for subsequent
casts. Next cast is for nspr_pktracefull_v20_t.

Change-Id: I8b77aa243f528f82786af1047e8d26100f306a07
Reviewed-on: https://code.wireshark.org/review/35837
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-16 15:37:50 +00:00
Gerald Combs 116d381ea4 wiretap: Fix mp4.c compilation.
Include string.h as suggested by clang:

../wiretap/mp4.c:33:4: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
                        memcmp(magic_buf + 4, mp4_magic, sizeof (mp4_magic)))
                        ^
../wiretap/mp4.c:33:4: note: include the header <string.h> or explicitly provide a declaration for 'memcmp'

Change-Id: I2369ad140f95ca10f22c176b9e2646950b1a8f65
Reviewed-on: https://code.wireshark.org/review/35814
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-01-14 22:24:24 +00:00
Jakub Adam ce8e6e1c95 wiretap: Add MP4 reader
Allows opening MP4 (ISO/IEC 14496-12) media files in Wireshark and
viewing their structure.

Change-Id: Ie20b8b89dc69bb52d6faa890e547d90317adecf6
Reviewed-on: https://code.wireshark.org/review/35804
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-01-14 20:04:01 +00:00
Dario Lombardo 1c98b5b180 log3gpp: invert check with use of offset.
n is used to address the buffers, but the check condition
follows its use. Fix the code by inverting the two of them

Bug: 16283
Change-Id: I7cba868979982946f99cfe787a7b5f86d2db1b70
Reviewed-on: https://code.wireshark.org/review/35538
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-12-21 18:57:23 +00:00
Guy Harris 746335804b Expand the frequency range for the DMG PHY.
Apparently, at least in some regulatory domains, the DMG PHY now goes
above 66 GHz or may do so in the future; the new/future top appears to
be 71 GHz.

Change-Id: I1ee3f9cff177eed269ccc8318b5c952dbeb526ff
Reviewed-on: https://code.wireshark.org/review/35529
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-12-20 20:55:31 +00:00
Michael Mann 2925fb0850 Use g_file_open_tmp within create_tempfile
Much better to use a known library than create it ourselves.

Also remove get_tempfile_path as it's not used.

Bug: 15992
Change-Id: I17b9bd879e8bdb540f79db83c6c138f8ee724764
Reviewed-on: https://code.wireshark.org/review/34420
Reviewed-by: Tomasz Moń <desowin@gmail.com>
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-12-20 19:26:38 +00:00
Guy Harris ffabb74e2c Back up to the beginning of the file if we don't have a gzip header.
If the first byte of the file is 31, and we advance to the next byte but
find it's not 139, back up to the first byte before falling through and
treating the file as uncompressed.

Add/expand some comments while we're at it.

Bug: 16252
Change-Id: I292b51f9cc04173482a43b26b0ce73c9e7aee570
Reviewed-on: https://code.wireshark.org/review/35315
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-12-05 06:49:48 +00:00
Michal Ruprich 67ebeee251 wiretap: no "drop_count" in pcapng format
When using wiretap to create a pcapng file,
the drop_count field from the wtap_packet_header
in wiretap/wtap.h is not being dumped to the file
in pcapng_write_enhanced_packet_block function.

Bug: 16062
Change-Id: Id9b8dbd1f7406e019fab00ff7a4167ab27543f62
Reviewed-on: https://code.wireshark.org/review/34836
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-24 07:06:53 +00:00
Tomasz Moń c869b567df Increase maximum USBPcap packet size to 128 MiB
It turned out that 1 MiB is not enough as atleast the URBs sent by
Android fastbool tools are greater than 1 MiB (1 MiB payload + USBPcap
pseudoheader). Raise the maximum packet size all the way up to 128 MiB.
128 MiB is the upper bound of maximum packet that can be captured by
all official USBPcap releases.

Bug: 15985
Change-Id: Ibbf41f7efae6e0f841e36d39664394e8a8eae77d
Reviewed-on: https://code.wireshark.org/review/34793
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-18 03:42:20 +00:00
Stig Bjørlykke 241967f46e erf: Use g_get_real_time() to get real time
Use g_get_real_time() to get real time because GTimeVal and g_get_current_time()
was deprecated in glib 2.62.

Change-Id: I78fee34e2f5b634c91c6420b01915cfc070f38a4
Reviewed-on: https://code.wireshark.org/review/34468
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-09-08 06:07:52 +00:00
Guy Harris 05e39afb3f Put the year field of the timestamp out in little-endian byte order.
Change-Id: I9de300b05e8d66e71359241fddfe10d90f3f8d33
Reviewed-on: https://code.wireshark.org/review/34454
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-04 20:46:38 +00:00
Jaap Keuter d58f8f57c1 Wiretap: Write commview files with valid headers
When writing a capture as a commview file the header written is two
bytes longer than the specification. Even though we count 24, we
actually write 26. This makes the commview file corrupt, as is apparent
when reading such file, eg., after using Save As... with this format.

Replace writing 2 bytes for the last two fields in the header by 1 byte
each, as per the header specification.

Change-Id: I9436f7837b2e3617a389619884bf93ad146e95f3
Reviewed-on: https://code.wireshark.org/review/34450
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-04 20:18:29 +00:00
Guy Harris 66b868d8d1 Strengthen the PacketLogger heuristics.
Check the time stamp microseconds field; it must be < 10^6.

Check the first few packets, not just the first packet.

Change-Id: I35a58a79d48db13daee937374caae40bc320e9e7
Ping-Bug: 16031
Reviewed-on: https://code.wireshark.org/review/34437
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-03 01:05:42 +00:00
Guy Harris 45eadc049e What we're testing for is byte-swappedness, not raw endianness.
On a big-endian machine, if the upper 16 bits of the length are non-zero
and the lower 16 bits are zero, that means that the length is
*little*-endian.

What we really care about is whether the file is in the reading host's
native format, so we can just fetch integral values without swapping, or
not in that format, in which case we have to byte-swap integral values.

Rename the variable and redo the code to match.

(This may have caused the PacketLogger reader to fail on big-endian
machines.)

Change-Id: Ie1a82a7d40e2c58c0b8d482d7c95ab60061ca980
Ping-Bug: 10861
Reviewed-on: https://code.wireshark.org/review/34434
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-02 23:47:16 +00:00
Guy Harris 6d15429a84 If we get a short read on the first packet in the open, don't check any more.
There's no point in trying to read more packets to check the file type.

Change-Id: Ic2c5a7692b60fab8a0022503338a40befe00d358
Ping-Bug: 16031
Reviewed-on: https://code.wireshark.org/review/34433
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-02 22:27:37 +00:00
Guy Harris cdb942944a Strengthen the I4B heuristics.
Check some more field values, and fix some tests to check against the
maximum possible value given in the i4b_trace.h file rather than against
that value + 1.  (> max, or >= max+1, are both reasonable, but > max+1
isn't.)

Check the first few packets, not just the first packet.

Make some header fields unsigned, as that's how we treat them in most
cases; that way we treat them that way by default.

Change-Id: I8c2d28af048c676a3dbae367bbb49c886e0dc566
Ping-Bug: 16031
Reviewed-on: https://code.wireshark.org/review/34432
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-02 21:40:09 +00:00
Alexis La Goutte 6d2ea2f4bb log3gpp: fix no previous prototype for function
log3gpp.c:459:10: warning: no previous prototype for function 'log3gpp_dump[|open|finish]' [-Wmissing-prototypes]

Change-Id: I1d896f90d91dc04b68b12f48ae06526556a428d4
Reviewed-on: https://code.wireshark.org/review/33963
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-26 08:18:10 +00:00
Guy Harris 303f6f1b39 Boost the maximum packet size for LINKTYPE_USBPCAP in pcap/pcapng.
Bug: 15985
Change-Id: I8e043431bbf874d640d4407335d525a44815ee73
Reviewed-on: https://code.wireshark.org/review/34327
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-08-20 04:57:17 +00:00
Tomasz Moń c4b68b4935 Wiretap: Fix temporary filename memory corruption
The pointer returned by create_tempfile() must not be freed. As the
wtap_dump_open_tempfile() callers are freeing the returned filename,
duplicate the string so it can be freed.

Bug: 15377
Change-Id: Ib0b23aaee748ef67600ef3f7d40610ebbbec721c
Reviewed-on: https://code.wireshark.org/review/34272
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-08-14 20:33:21 +00:00
Guy Harris ade3a6b658 Set tm_isdst before calling mktime().
You either have to set it to 1 or 0 if you know whether it's shifted
time or set it to -1 if you don't.

Should address Coverity CID 1452227.

Change-Id: I7d435bb6b7dd8897b44bf5103578e3db1a30379e
Reviewed-on: https://code.wireshark.org/review/34175
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-08-04 01:38:41 +00:00
Maksim Salau 9011ad1030 wiretap: Add support for Busmaster log file format
Only CAN protocol is supported. Extra information available in J1939
entries is ignored since the J1939 wireshark dissector works with
raw CAN frames and makes no use of this extra information.
The log format may also encapsulate LIN messages which are not
supported by wireshark and thus are ignored.

The only limitation is that relative timestamp format is not
supported. If a file defines relative format of timestamps, packets
are extracted, but timestamps are omitted, since random access deems
impossible without reparsing the whole file up to the packet of
interest. In order to support relative timestamps we need to parse
the whole file at once on open and either dump into a temporary
PCAP file or keep messages in a private list and provide access
to them on read()/seek_read().

The change also creates a separate header for CAN frame structure
definitions which are used by several file readers (candump and
busmaster for now).

Bug: 15939
Change-Id: I87c5555e4e5e1b142b9984b24544b2591d494fbc
Reviewed-on: https://code.wireshark.org/review/34083
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-03 15:46:08 +00:00
Guy Harris 22e7952e06 HTTPS In Even More Places, update some links.
Fall back on the Wayback Machine for some links.

Change-Id: I6a44a2caaeb4fa521c2f08196e7c36069e3bb842
Reviewed-on: https://code.wireshark.org/review/34103
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-28 04:21:18 +00:00
Guy Harris 245086eb83 HTTPS In Still More Places, update more URLs.
Microsoft reshuffled their documentation - almost all of it moved from
msdn.microsoft.com to docs.microsoft.com.  Some blogs moved to
devblogs.microsoft.com; the comments *didn't* move, so in one case we go
to the Wayback Machine - the link isn't dead, but it formats horribly,
at least on my browser, but the archived version formats OK.

Use the Wayback Machine for some URLs, and update others.

Update the sections for MS-ADTS.

Point to the HTML versions of some RFCs and I-Ds.

Change-Id: I344b20f880de63f1ae2a4e3f9ff98af78a7fe139
Reviewed-on: https://code.wireshark.org/review/34101
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-27 22:56:35 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Tomasz Moń 53fdec477d USBLL: Initial USB 2.0 Link Layer dissector
Dissect raw USB Packets. The actual USB packets to transaction conversion
(which is needed to pass the data to existing USB URB dissector) is not
implemented yet.

Ping-Bug: 15908
Change-Id: Ia75d58882d770fdd8650622d318241743069ad8f
Reviewed-on: https://code.wireshark.org/review/34006
Reviewed-by: Tomasz Moń <desowin@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-25 08:56:18 +00:00
João Valverde 6e5ba74b31 Remove ABI compliance checker code.
It's broken, unmaintained, poorly implemented and obsoleted by saner
debug-info methods.

Note: To do the compliance check properly would require much more
extensive work to clearly define public and private interfaces (without
manual bookeeping of files or symbols either, of course, because who
would want that...).

Change-Id: Ib801f3c152ca2369f95ca1f4af4d37cd8cc7c47a
Reviewed-on: https://code.wireshark.org/review/33928
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
2019-07-21 15:54:41 +00:00
Maksim Salau 40e0e5d282 wiretap: candump: Don't generate a temporary PCAP file
It's preferable to parse text files and generate packets on demand,
rather than generate a temporary PCAP file and dump all available
packets into it.

Parsing on the fly has a benefit of handling damaged files up to the
point of damage, while the approach with a temporary file doesn't
allow either to report that the original file is damaged or perform
conversion in the first place.

This version works faster than the previous one.

Command:
time ./run/tshark -r ./candump-2019-07-01_111120.log.gz > /dev/null

The test file is attached to the bug 15889

The current version:
real    0m0,597s
user    0m0,533s
sys     0m0,118s

The previous version:
real    0m2,176s
user    0m1,966s
sys     0m0,100s

Bug: 15889
Change-Id: I862ce47752531c2e9d9459f5d865c1fc08f32fea
Reviewed-on: https://code.wireshark.org/review/34007
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-20 07:29:33 +00:00
Pascal Quantin 86cb2c7858 wiretap: do not pollute debug builds with candump debug messages
Change-Id: I2f7c4c3d23d5be27c1fac704272b9e581a4de0f7
Reviewed-on: https://code.wireshark.org/review/33912
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2019-07-12 14:39:11 +00:00
Maksim Salau bd4e293b7b wiretap: candump: Reset error info and fix scanner warnings
candump_open() may be called with non-empty error code and string.
The error code is not reset upon success in run_candump_parser() which may
mislead the caller function thus affecting opening the file.

yy_fatal_error(), yy_alloc(), yy_realloc() and yy_free() make no use
of the yyscanner argument, which results in warnings on OSX.
In order to get rid of those warning we provide our own
implementations of memory allocation functions and hack
YY_EXIT_FAILURE macro in order to pretend using the argument.

Change-Id: I672d374b26970b2699b9d789b6118e97ba660bdf
Reviewed-on: https://code.wireshark.org/review/33892
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-07-11 17:44:50 +00:00
Uli Heilmeier 3589de9b5a Candump_parser: fix implicit declaration warning
Include string.h to fix implicitly declaring library function
'memcpy' with type 'void *(void *, const void *, unsigned long)'

Change-Id: Ia6796f1966db606f946e0935ed0e5b70702c88c9
Reviewed-on: https://code.wireshark.org/review/33891
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-11 08:34:58 +00:00
Maksim Salau 8bb5320cb2 wiretap: Add support of candump logs
The change adds ability to import text logs produced by the candump
tool.

E.g.: candump -L can0 -or- candump -l can0

The whole file is read and converted into a temporary PCAPNG file with
Exported PDU packets containing SocketCAN frames.

Bug: 15889
Change-Id: I5ad93dca96d6e955a4b21cf624f0553e60f060f6
Reviewed-on: https://code.wireshark.org/review/33800
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-11 04:44:00 +00:00
Anders Broman d8ad7a6863 wiretap: Add a phone log reader.
Change-Id: I0b290df4783616f1eb15e6ad35fbd6d2b4c3dbdd
Reviewed-on: https://code.wireshark.org/review/33865
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-08 11:41:05 +00:00
Guy Harris 58cc932d2f Pass the correct value to ascendlex_destroy().
It takes a yyscan_t as an argument, not a pointer to a yyscan_t; a
yyscan_t is a pointer to the scanner state.  (A pointer to it is passed
to the init routine so that it can be set to point to the allocated
state, not because it's a structure itself.)

Change-Id: If80ca1caaa07d8a966df8d07f989b722869ac58b
Reviewed-on: https://code.wireshark.org/review/33814
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-01 19:27:46 +00:00
Maksim Salau bd5ba2ba7a wiretap: ascend: Destroy lexer state after parsing
Lexer private structure is initialized but never destroyed or reused.

Change-Id: I61d43b4cb14a2d3b3706267eb393e4562adb00f9
Reviewed-on: https://code.wireshark.org/review/33809
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-01 19:05:02 +00:00
Guy Harris d6472862c5 Fix error message for an unknown pcapng version number.
We were using fields in the pcapng_t that weren't set yet to report the
version number in question; use the variables we were checking.

Change-Id: Ib03bafe62d8c7b1aa54b2ef22640e3b00722142a
Ping-Bug: 15862
Reviewed-on: https://code.wireshark.org/review/33671
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-06-19 23:58:34 +00:00
Peter Wu 94b211977a Add support for embedding WireGuard keys in a pcapng file
pcapng spec update is here: https://github.com/pcapng/pcapng/pull/62

Bug: 15571
Change-Id: I2f1921b1da70ac0bab8c38dd5138a9dfe7843fea
Reviewed-on: https://code.wireshark.org/review/33300
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-17 00:48:29 +00:00
Richard Sharpe 2b916d6424 wtap: Add support for 802.11ah and 802.11ax PHYs.
There may need to be more of these.

Bug: 15740
Change-Id: I5d3a97ed50d66dfcb85df0ab7053e8a44c531134
Reviewed-on: https://code.wireshark.org/review/33280
Petri-Dish: Richard Sharpe <realrichardsharpe@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-05-20 19:06:59 +00:00
Dario Lombardo 3e53ec5e11 pcapng: fix the magic when bytes are swapped.
This value is used when checking if the file was generated on a
machine with different endianess. The error message changes from

"Unrecognized pcapng format or not pcapng data."

to

"dumpcap: Interface 0 is big endian but we're little endian."

Fix dumpcap.c and pcapio.c.

Ping-Bug: 15754
Change-Id: I3a31f873f01bcb3f1324410e70f29f285e56c715
Reviewed-on: https://code.wireshark.org/review/33274
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-05-20 18:06:25 +00:00
Anders Broman 075fc13d7a 3gpp_32_423: Fix dissection of changeTime.
Change-Id: I8d86f92a918044763a02d0ba9856ea97c3937bf1
Reviewed-on: https://code.wireshark.org/review/33240
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-17 10:43:01 +00:00
Guy Harris 576f33fffd In pcapng_open(), don't use the local pcapng_t once we know it's a pcapng file.
Use the local one *only* while we're trying to determine whether we have
a pcapng file or not; once we know we have a pcapng file, and have
allocated a pcapng_t and attached it to the wtap structure, pass *that*
one to pcapng_read_block(), so if it changes anything in the pcapng_t,
it changes the one we're using.

Change-Id: I53b32595276be97957a0b6056171471878fa40c4
Reviewed-on: https://code.wireshark.org/review/33226
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-16 18:27:06 +00:00
Dario Lombardo 0aafbe7017 wtap: remove unneeded check (CID: 1441486).
wth has been already checked in line 315.

Change-Id: Ib620e0b1e9262e5344feb934b024f7817cfda6fd
Reviewed-on: https://code.wireshark.org/review/33178
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-16 03:40:07 +00:00
Guy Harris f8ac57a2c4 Keep and use per-interface, not per-file, FCS length information.
There is no FCS length information for a pcapng file; there's FCS length
information for each interface.

Change-Id: I3abb1a35b28475aa3ad6f126060140d0a524bbca
Reviewed-on: https://code.wireshark.org/review/33215
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-16 03:06:30 +00:00
Guy Harris 16ca1b5aca Fill in the packet flags for *Peek classic and tagged files.
Change-Id: I0f075c5bc7bb177a23be11e23e3701a7412a6e3d
Reviewed-on: https://code.wireshark.org/review/33153
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-10 23:14:44 +00:00
Guy Harris 26968f911b Set packet flags for some link layers.
Change-Id: Ia46a639b241dcbd983205ee0118c51abf5604a15
Reviewed-on: https://code.wireshark.org/review/33124
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-09 01:22:46 +00:00
Guy Harris 937ec02581 1514 is a better initial Buffer size than 1500.
Ethernet packets without the CRC are 1514 bytes long, not 1500 bytes
long; using 1514 bytes will avoid a reallocation for a full-sized
Ethernet packet.

Change-Id: Ie8da3f13bf3df07e23e4478b7dcf84f06dec6a9d
Reviewed-on: https://code.wireshark.org/review/32761
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-06 21:04:02 +00:00
Guy Harris 8a5b26efb1 Have wtap_read() fill in a wtap_rec and Buffer.
That makes it - and the routines that implement it - work more like the
seek-read routine.

Change-Id: I0cace2d0e4c9ebfc21ac98fd1af1ec70f60a240d
Reviewed-on: https://code.wireshark.org/review/32727
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05 02:49:43 +00:00
Dario Lombardo b39a736e91 iseries: ensure the buffer is null terminated.
Check buflen to prevent wrong scanf call as well.

Bug: 15614
Change-Id: I58a2855d8b1beda067bf9b2d724229ab20249228
Reviewed-on: https://code.wireshark.org/review/32573
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2019-04-04 06:17:22 +00:00
Dario Lombardo ea39ed7410 iseries: fix wrong indentation.
Change-Id: I4d6e145412037e4a3a40688139b12ada0f36e413
Reviewed-on: https://code.wireshark.org/review/32556
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2019-03-24 22:15:22 +00:00
Guy Harris c1fd0194f4 Revert "iseries: stop scanning a unicode string when the null terminator is hit."
This reverts commit c599e49028.

Reason for revert: This completely fails to recognize Unicode iSeries dumps.

Change-Id: Ie31141879b1bc3608a5dfdcba6887bb6f0018a47
Reviewed-on: https://code.wireshark.org/review/32568
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-24 21:23:36 +00:00
Dario Lombardo c599e49028 iseries: stop scanning a unicode string when the null terminator is hit.
Bug: 15614
Change-Id: I1df4992dcd10e7d9a66fc88a0269b70fc065b079
Reviewed-on: https://code.wireshark.org/review/32514
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2019-03-24 19:25:46 +00:00
Guy Harris ed23cfba22 Clean up IPMB/I2C link-layer header types.
209 is LINKTYPE_IPMB_LINUX; add _LINUX/_linux to the WTAP_ENCAP_ name
and function/structure names, to clarify that it's not I2C in general,
it's I2C with a particular pseudo-header.

199 is now LINKTYPE_IPMB_KONTRON, not LINKTYPE_IPMB, as it doesn't have
raw I2C packets, it has I2C packets with a pseudo-header.  Change the
WTAP_ENCAP_ name, and add a dissector for it.

Change-Id: Ie097f4317b03d2b2adfd9b81a4b11caf6268399e
Reviewed-on: https://code.wireshark.org/review/32539
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-23 20:30:00 +00:00
Guy Harris a3de3fbec9 Treat erf_timestamp_t's as integral values.
That's what they are, and that's how other code in erf_open() treats
them; just use assignment to initialize prevts and to set prevts to ts.

Maybe this will keep the Clang static analyzer from calling prevts a
garbage value when compared with ts.

Change-Id: I2ee2376ced5c3efa6beab34276009a3177c94416
Reviewed-on: https://code.wireshark.org/review/32455
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-17 16:19:51 +00:00
Guy Harris 1660f74371 Remove incorrectly-inserted "return FALSE;".
That made PACKET_DESCRIBE() do nothing, causing warnings from the Clang
Static Humiliator.

Change-Id: I6f433cd193b6398d89038e95c7bf5deb24aa186d
Reviewed-on: https://code.wireshark.org/review/32437
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-16 18:48:21 +00:00
Guy Harris c0839e2e2a Fix up the checks in nspm_signature_version().
Move the read out of nspm_signature_version(), to make it a bit clearer
what file I/O we do in the open process; have nspm_signature_version()
just look for a signature in a single page.

In the loop in nspm_signature_version(), make sure we have enough of the
record header to look at the type and length fields in that header
before looking at them and, when we can look at them, make sure the
length of the record 1) fits in what remains of the page we're looking
at and 2) is big enough to be the length of a signature record.

Change-Id: I7d625859136e6f39c40b166067fc7efea806d9b0
Reviewed-on: https://code.wireshark.org/review/32426
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-16 07:43:25 +00:00
Dario Lombardo 134a513dd5 netscaler: add more sanity checks.
Fix more crashes found in the provided bug report.

Bug: 15497
Change-Id: If84498fa879ad56c8677f8c1442a8dc0e5906003
Reviewed-on: https://code.wireshark.org/review/32333
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-15 15:38:23 +00:00
Guy Harris 306ead40b6 Ask, in a comment, whether we should do an exact match on signatures.
Change-Id: I3c6e904a2e8cc843687b69f633fd0dfbf0ec7937
Reviewed-on: https://code.wireshark.org/review/32407
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-14 10:51:57 +00:00
Guy Harris f18bd4bd68 Fix the test for a NetScaler trace file.
When testing the signature field against a given version's signature:

	we require that the signature field's size (size, not C
	null-terminated string length) be at least the size of the
	signature string (otherwise, it can't possibly match);

	we check to make sure that the first N bytes of the signature
	field, where N is the size of the version's signature string
	(not including any terminating '\0' in that string), match the
	version's signature string.

I.e., we require that the version's signature string is a prefix of the
signature string in the file.

This does not require that the signature string in the file be
null-terminated.

It also doesn't allow the file's signature string to be a substring of
the version's signature string, as that's *NOT* sufficient to identify
the file as a NetScaler trace file, especially if we forcibly
null-terminate the file's signature string and we trucate it to be
zero-length, as, in that case, it's *always* a prefix of the version's
signature string, and the file is incorrectly identified as a NetScaler
trace file.

(While we're at it, we make the nspm_signature_isvXXX() routines return
true if it *is* and false if it *isn't*, rather than the reverse; having
a routine with a name containing "is", and not "isnt", return true if it
*isn't* is confusing.)

Change-Id: I3694773a71b8b63d280e42f146698c82a0f0c332
Ping-Bug: 15601
Reviewed-on: https://code.wireshark.org/review/32403
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-14 10:48:29 +00:00
Guy Harris fd7ff6916c Ask in a comment whether we should test HAVE_STRUCT_STAT_ST_BLKSIZE.
We're defining it now based on whether there's an st_blksize member of
struct stat.  We're currently testing _STATBUF_ST_BLKSIZE, but that's
not guaranteed to be defined on platforms that have an st_blksize member
of struct stat (it's not defined on macOS, for example).

Change-Id: I4e6011a7668da94cf1ca6328e29c50924dd1d8b0
Reviewed-on: https://code.wireshark.org/review/32381
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-10 18:12:42 +00:00
Guy Harris c84f69f748 Discard the upper bits of the "network" field in the file header.
Libpcap's done that for a while; we should do so as well.

(Ideally, we should use those bits, but there's an issue with pcapng,
where the FCS length in the IDB is described as being in units of bits,
but where we're treating it as being in units of bytes, that I'd like to
resolve first.)

Change-Id: Ibcb82f1dcaa8baae5bba55636cea8852a6af814e
Reviewed-on: https://code.wireshark.org/review/32303
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-03 23:46:37 +00:00
Guy Harris a5b5f649ff Say what short name already exists, to help the developer somewhat.
That tells then what name they *can't* use for their file-type plugin,
because it's already a built-in file type name in Wireshark.

Change-Id: Ibbbfda21e1109cf46275008a46b8ea65c8fcf4b5
Reviewed-on: https://code.wireshark.org/review/32291
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-03 04:15:43 +00:00
Alexis La Goutte 712d94fa78 vwr: fix Uninitialized argument value found by Clang (Analyzer)
Change-Id: Ic4b5c2d34eafccaa115256e8d3e0a5518621ba76
Reviewed-on: https://code.wireshark.org/review/32288
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-02 07:03:19 +00:00
James Ko 6ce7509223 Add IEEE 802.15.4 TAP link type
New link type for IEEE 802.15.4 with pseudo-header and optional
meta-data TLVs, PHY payload exactly as it appears in the spec (no
padding, no nothing), and FCS if specified by FCS Type TLV.
Specification at https://github.com/jkcko/ieee802.15.4-tap

Bug: 15429
Change-Id: I67bd154891ad5818be9a1630aa5cbb863b55509a
Reviewed-on: https://code.wireshark.org/review/32141
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-02-28 17:55:14 +00:00
Dario Lombardo 07bb974bcd netscaler: fix multiple out-of-bounds reads.
Multiple bugs have been found in the provided bug. Some of them have
been fixed in gefe920a, others here. The main problem is when malformed
files give wrong lenghts to the code, that casts and dereference it
without checking, causing oob reads. The fix introduces a check function
that prevents to go beyond the limits, early returning with a malformed
file message.

Other bugs have been fixed by forcing the string terminator that allows
the use of strlen() and MIN() that prevent wrong reads.

Bug: 15497
Change-Id: I8411208b5ea0f1a0720a17b882f704d03296d1c4
Reviewed-on: https://code.wireshark.org/review/32194
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-02-26 19:41:02 +00:00
Alexis La Goutte e391819e8d vcwr: fix Uninitialized argument value found by Clang (Analyzer)
Change-Id: Id0b1f4815e66fa5ef6b120099546a3d018164c99
Reviewed-on: https://code.wireshark.org/review/32134
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-21 11:45:51 +00:00
Dario Lombardo efe920af3a netscaler: fix crash when reading malformed packets.
When reading a malformed packet, it can occur that we go close to
the end of the buffer. We need to check if we have 2 bytes before
reading a uint16.

Bug: 15497
Change-Id: I2b00f44933ca11b925ffbf05b9855684feebcda5
Reviewed-on: https://code.wireshark.org/review/32028
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-20 04:17:29 +00:00
Guy Harris 28f49a0a9a Add --discard-all-secrets to remove decryption secrets.
Bug: 15435
Change-Id: I78503c9c31ab3eda39908b91dca3ef3fb9af34bf
Reviewed-on: https://code.wireshark.org/review/32100
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-02-19 09:57:52 +00:00
Guy Harris b5036134c2 Add macros for the pack_flags field.
Add macros to extract the direction, reception type, and FCS length
fields of the pack_flags field, and add definitions for different
directions and reception types.

Add a macro to construct a pack_flags field value from subfields; this
is for use by non-pcapng file readers (the pack_flags field is just a
copy of the EPB flags option, so that's not needed for pcapng).

Move some #defines for that field from packet-frame.c to wtap.h, and
rename them to match the new macros.

Use the macros rather than rolling our own code.

Fix a variable name in text2pcap.c that apparently had the wrong name,
given the value that was being tested.

Change-Id: Ia788ca4e9f5fabd8d24e6ead5ff1817509f54827
Reviewed-on: https://code.wireshark.org/review/32010
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-02-13 18:43:27 +00:00
Peter Wu 80587eb063 logcat-text: set G_REGEX_RAW to fix potential crashes
No UTF-8 patterns are in use. To avoid potential crashes on invalid
input, treat all lines as binary data in the dissector to match wiretap.

Change-Id: I10735c2246536fb4b2fdb9236cdbf7917d2e816c
Ping-Bug: 14905
Reviewed-on: https://code.wireshark.org/review/31938
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-02-10 16:12:09 +00:00
João Valverde c2eddffb84 CMake: Fix DOCDIR on Unix
User guides are installed to doc/Wireshark. Use doc/wireshark instead.

Remove leftover variable CPACK_PACKAGE_NAME.

Change-Id: I9a1d6bdc7d8f0b48c61e43679285d5ba83904a63
Reviewed-on: https://code.wireshark.org/review/31851
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2019-02-02 16:53:49 +00:00
Guy Harris b5817dbda7 Also check whether we have nothing but DLCI bytes.
The two failure modes are 1) no byte has the low-order bit set, so we
didn't even find the end of the DLCI or 2) the byte at the end of the
packet has the low-order bit set, so that it's all DLCI with no control
byte after it.

Expand a comment.

Bug: 15463
Change-Id: Ib76686391213dd56c06d665aa87a188621fe6816
Reviewed-on: https://code.wireshark.org/review/31828
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-31 08:59:41 +00:00
Guy Harris 498b64c95c Check whether you've hit the end of the packet data before going further.
If we found no bytes with the low-order bit set in the packet data,
there's no point in checking the non-existent "next" byte to see if it's
a HDLC-style UI control byte (0x03).

Bug: 15463
Change-Id: Ibfd186e5b81d8ce229362e23f00b31a27900831a
Reviewed-on: https://code.wireshark.org/review/31824
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-31 07:40:32 +00:00
Dario Lombardo 58698a7de3 ngsniffer: fix comment.
Change-Id: Ia25ce4841ee3831f995d1fa7cd2cb8a850f1c01e
Reviewed-on: https://code.wireshark.org/review/31818
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-30 21:38:15 +00:00
Peter Wu 31aba351e2 wiretap: fix memleaks with wtap_rec::opt_comment
The memory ownership of wtap_rec::opt_comment was not clear. Users of
wtap were leaking memory (editcap.c). wtap readers were not sure about
freeing old comments (erf) or simply ignored memleaks (pcapng).

To fix this, ensure opt_comment is owned by wtap_rec and free it with
wtap_rec_cleanup. The erf issue was already addressed since
cf_get_packet_comment properly duplicates wth.opt_comment memory.

- wtap file formats (readers):
  - Should allocate memory for new comments.
  - Should free a comment from an earlier read before writing a new one.
- Users of wth:
  - Can only assume that opt_comment remains valid until the next read.
  - Can assume that wtap_dump does not modify the comment.
  - For random access (wtap_seek_read): should call wtap_rec_cleanup
    to free the comment.

The test_tshark_z_expert_comment and test_text2pcap_sip_pcapng tests now
pass when built with ASAN.

This change was created by carefully looking at all users opt
"opt_comment" and cf_get_packet_comment. Thanks to Vasil Velichkov for
an initial patch which helped validating this version.

Bug: 7515
Change-Id: If3152d1391e7e0d9860f04f3bc2ec41a1f6cc54b
Reviewed-on: https://code.wireshark.org/review/31713
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-25 04:53:10 +00:00
Peter Wu 9d5ab21163 wiretap: fix leak of options_buf and document memory handling
Manually checked all callers of wtap_seek_read to ensure that
wtap_rec_cleanup is called. Added missing wtap_rec_cleanup to:
- Completion of sequential read: wtap_sequential_close
- Callers of wtap_seek_read:
  - users of cf_read_record_r:
    - PacketListRecord::dissect

This fixes one of the two ASAN memleak reports while running
test_tshark_z_expert_comment and test_text2pcap_sip_pcapng (the other is
about opt_comment which is still unfixed).

Vasil Velichkov also found this issue and came up with a similar fix.

Change-Id: I54a6aa70bfdb42a816d03ad4861d0ad821d0ef88
Reviewed-on: https://code.wireshark.org/review/31709
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-24 04:21:23 +00:00
Peter Wu 1fcb321487 nettrace: fix potential buffer overflow in time parsing
sscanf can consume less than 19 characters (e.g. given time format
1-1-1T1:1:1), be sure to reject such input. Fix some dead store warning
while at it.

Change-Id: I6148599048f1e89ea7aafdbdd6450574a97b22fd
Fixes: v2.9.1rc0-372-gd38f6025b0 ("nettrace: Handle beginTime with fractions of seconds.")
Reviewed-on: https://code.wireshark.org/review/31699
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-23 16:38:46 +00:00
João Valverde 4f46a2af88 CMake: Set a direct rpath for libraries
Instead of using "$ORIGIN/../lib" just use "$ORIGIN".

Also be explicit in configuring the relative RPATH. We don't want
to assume a default relative path, in case more targets are addded,
out of caution.

Change-Id: I3b7f5e8de7be8bb30aca3b433212113d876c4163
Reviewed-on: https://code.wireshark.org/review/31647
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-22 00:55:40 +00:00
João Valverde a3991874eb CMake: Replace PACKAGELIST magic
This is more explicit and easier to read with slightly better locality
while using less code.

Also less awkward when the package doesn't fit the narrow package list
expectations.

The ws_find_package() macro doesn't include all the status messages. The
choice was to rely on standard find_package() and feature_summary() output
and be less verbose.

Avoid polluting the CLI build interface. Per target include paths and
macro definitions are preferred.

Because this patch intentionally removes the global CMAKE_*_FLAGS
and include_directories() usage in favor of target properties, some
untested build configurations may inadvertently break because of
missing ${PACKAGE}_INCLUDE_DIRS or ${PACKAGE}_DEFINITIONS. This
required a manual review of dependencies that might have been
incomplete.

${PACKAGE_VAR}_LINK_FLAGS seems to be unused.

Changing the CMake Qt code to use more modern CMake component syntax
is left as future work.

Change-Id: I3ed75252189a6e05a23ed6e619088f519cd7ed78
Reviewed-on: https://code.wireshark.org/review/31496
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-20 11:50:10 +00:00
Peter Wu 7e7caaddf8 vwr: fix -Werror=maybe-uninitialized with GCC 8.2.1+20181127-1
Change-Id: I58d61d29719facb5d639bdbd7e3d790096f69486
Reviewed-on: https://code.wireshark.org/review/31599
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-19 07:04:55 +00:00
Pantar Ana 0e151f3987 ebhscr: increasing ebhscr snaplen
Change-Id: Ie033196c099927912b1e7849299e786dc8416923
Reviewed-on: https://code.wireshark.org/review/31554
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18 07:50:54 +00:00
Peter Wu e8f9ac3352 wiretap,file.c: ensure DSBs are reapplied on redissection
After redissection, the TLS dissector did not remember the DSB secrets
anymore. Since the secrets callback is only invoked on the sequential
read in wtap, be sure to reapply the existing DSBs to the new session.

Bug: 15252
Change-Id: I125f095acb8d577c2439a10e3e65c8b3cfd976b9
Reviewed-on: https://code.wireshark.org/review/31584
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18 06:10:17 +00:00
Dave Barach abd64c9ea2 VPP: add vpp graph dispatch trace dissector
Add a dissector for http://fd.io vpp graph dispatch traces. The file
format is described in detail here:
       https://fdio-vpp.readthedocs.io/en/latest/gettingstarted\
               /developers/vnet.html#graph-dispatcher-pcap-tracing

Fuzz-tested with good results.

Bug: 15411
Change-Id: I3b040bb072ce43fb2fb646a9e473c5486654906a
Signed-off-by: Dave Barach <dave@barachs.net>
Reviewed-on: https://code.wireshark.org/review/31466
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-17 11:31:27 +00:00
Anders Broman d38f6025b0 nettrace: Handle beginTime with fractions of seconds.
Change-Id: If12f5430e816a373c084996a6e55846ce825a4de
Reviewed-on: https://code.wireshark.org/review/31539
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-14 14:23:50 +00:00
Peter Wu fd8ddbabab wiretap: remove dependency on version_info
Avoid including the precise version string in the pcapng file that is
created for 3GPP TS 32.423 formats. This avoids unnecessarily relinking
of applications depending on wiretap.

Change-Id: Ida1f3c0c998d811cbf85734bd83438bcbfc39cf4
Reviewed-on: https://code.wireshark.org/review/31513
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-12 20:45:18 +00:00
Peter Wu 5cc461490d CMake: use object libraries to avoid redundant builds
Some source files are duplicated via add_executable. Assuming that these
are not affected by target-specific preprocessor macros, they can be
built only once and shared among executables.

In one configuration, this reduces the number of object files by 55
(cli_main.c and version_info.c alone were built 15 times each).

Removes the version dependency from each target since the 'version_info'
target can now declare this dependency. Remove CLEAN_C_FILES from extcap
since it is not used to set -Werror. Due to removing some files from
wireshark_FILES (and others), these are no longer part of checkAPIs
though. Hopefully that is acceptable.

Change-Id: I0a3f1ffb950e70a6176c96d867f694fbc6476f58
Reviewed-on: https://code.wireshark.org/review/31509
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-12 18:20:44 +00:00
Anders Broman a58dd11ba0 nettrace: Fix missing tag length for IPV4_DST.
Change-Id: I00564adaef2922ff991887f0ee5c04a3c7307019
Reviewed-on: https://code.wireshark.org/review/31488
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-11 14:22:56 +00:00
Guy Harris fd93f5490c Clarify the name and description for a link-layer encapsulation type.
What we were calling the "name" is actually a description to show to
users; what were calling the "short name" is just the name to use on the
command line.

Rename some routines and structure members, and put the name first and
description second in the table.

Expand some descriptions to give more details (e.g., to be more than
just a capitalized version of the name).

Fix the CamelCase capitalization of InfiniBand.

Change-Id: I060b8bd86573880efd0fab044401b449469563eb
Reviewed-on: https://code.wireshark.org/review/31472
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-09 21:21:56 +00:00
Alexis La Goutte 0f638f84b9 nettrace_3gpp_32_423: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: I9f59b5ae6fe34d124b6930fa759c7c76c38aa213
Reviewed-on: https://code.wireshark.org/review/31412
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-06 19:36:55 +00:00
Dario Lombardo 905d87a28f wiretap: fix code according to clang-tidy.
Change-Id: I7f539968e9dce3a49112b7aeaa052b8cdb7501a6
Reviewed-on: https://code.wireshark.org/review/31364
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-04 14:15:58 +00:00
Peter Wu 53d8e6dcf8 Lua: fix crash in reloading Lua plugins that use FileHandler
Reloading Lua plugins did not actually remove registered FileHandler
instances which resulted in a use-after-free of lua_State. Fix this by
tracking instances and release them in wslua_deregister_filehandlers.

Other required fixes to allow reregistration after reloading:
- Fix END_FILEHANDLER_ROUTINE not to block all new registrations.
- wtap file subtypes are apparently persistent, even after
  "unregistering". Fix this by looking up the previous subtype that
  matches the FileHandler short name. Add a small sanity check to
  wtap_register_file_type_subtypes to prevent internal handlers from
  being overwritten.

This patch creates a potential memleak of registered_file_handlers as
wslua_deregister_filehandlers is not called on program exit (yet?).

Bug: 13264
Change-Id: I4f5935cde6ff8dc4de333359bad3efca96d4fb9b
Reviewed-on: https://code.wireshark.org/review/31068
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-29 10:38:13 +00:00
Pantar Ana eb8c996108 ebhscr: fixing WTAP_ENCAP_EBHSCR
Change-Id: Ie5ab56f1ee80d14032969cbe7f31e086fb2b4b91
Reviewed-on: https://code.wireshark.org/review/31159
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-12-27 22:32:44 +00:00
Gerald Combs 25e1e2c848 CMake: Don't bundle our libraries at compile time.
Setting LIBRARY_OUTPUT_DIRECTORY to Wireshark.app/Contents/Frameworks
for each of our libraries ends up installing a fully versioned .dylib
along with soversion and unversioned symlinks, which is more than we
want and which wastes disk space when osx-app.sh dsymifies our
libraries.

Leave LIBRARY_OUTPUT_DIRECTORY unset and depend on osx-app.sh to copy
our libraries into place.

Bug: 15361
Change-Id: If0fbaa796b4be806e2aa13887e511a330fe55df5
Reviewed-on: https://code.wireshark.org/review/31139
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-12-20 20:34:39 +00:00
Anthony Coddington f1d8b22fec erf: Add support for attribute and sensor Provenance tags
Add temperature and power tags, represented using millidegrees/milliwatts.
Add attribute tag, allows generic reprsentation of dynamic path like key-value pairs in the format namespace.path.to.name=value where value can be a JSON-escaped string or an integer/float number.
Also fix a few implicit floating point conversions (confirmed values are the same).

Change-Id: Id8a858abfa8a56b44e9e7200b11adc562e67fb3b
Reviewed-on: https://code.wireshark.org/review/31136
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-20 05:13:44 +00:00
Jaap Keuter 74bd75baa5 wiretap: use appropriate extension for temporary files
With the change from Wireshark's default capture file format from
pcap to pcapng the suffix of the temporary file created in wiretap
was also changed from .pcap to .pcapng. This irrespective of the
actual file type requested. This change retrieves the registered
extension for the requested file type (in its uncompressed form)
and used that for the suffix. File types without a defined default
extension will get .tmp as suffix.

Change-Id: If809fef4325e483072c1fa4ee962125d991a197e
Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-on: https://code.wireshark.org/review/31065
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-17 05:19:09 +00:00
Guy Harris 43dfd45faa Move more version-info-related stuff to version_info.c.
Have a ws_init_version_info() routine that, given an application name
string:

	constructs the app-name-and-version-information string, and
	saves it;

	adds the initial crash information on platforms that support it,
	and saves it.

Have show_version() use the saved information and take no arguments.

Add a show_help_header() routine to print the header for --help
command-line options, given a description of the application; it prints
the application name and version information, the description, and the
"See {wireshark.org URL}" line.

Use those routines in various places, including providing the
"application name" string in pcapng SHBs.

Change-Id: I0042a8fcc91aa919ad5c381a8b8674a007ce66df
Reviewed-on: https://code.wireshark.org/review/31029
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-13 03:16:13 +00:00
Gerald Combs 8c22c5bade Fix some spelling errors found by Lintian.
Change-Id: If6fc3aab7ad4fc634567121f7b9541bc6f6c5766
Reviewed-on: https://code.wireshark.org/review/30926
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-05 18:58:19 +00:00
João Valverde 40352d75cd CMake: Fix some transitive link dependencies
libwireshark and libwiretap have their INTERFACE link dependencies
changed to the required set.

libwsutil keeps a default public visibility. Further work may
show some unneeded link requirements.

The executable dependencies are adjusted accordingly.

Change-Id: I3a534f72403819cac136ae47a3d80acee76e0fb3
Reviewed-on: https://code.wireshark.org/review/30815
Reviewed-by: João Valverde <j@v6e.pt>
2018-11-29 02:21:51 +00:00
Gerald Combs 332df929a9 IxVeriWave: Fix a buffer boundary.
Pass the correct buffer size to find_signature so that we don't read
past it.

Bug: 15279
Change-Id: I822ed0fe8b48196dadd9c0062ed53fa1c4f6f404
Reviewed-on: https://code.wireshark.org/review/30809
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-11-27 22:23:44 +00:00
João Valverde afd4216327 CMake: Fix runtime destination for our libraries
Ping-Bug: 15301
Change-Id: I7d461c696ce096b7687f71277a33295eb43ff8fc
Reviewed-on: https://code.wireshark.org/review/30792
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2018-11-26 02:51:42 +00:00
João Valverde 65c13f9b90 Install development headers on all platforms
Install headers to support plugins development on Windows.

Change-Id: I3161bd2f730edf62ab44fee6ce4fedbb9aee0d31
Reviewed-on: https://code.wireshark.org/review/30776
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2018-11-24 13:48:16 +00:00
Anders Broman feb1801f89 nettrace: Put address parsing in a separate routine.
Change-Id: Ia223585986c6c8ad51fba36aa16c5780fc372f70
Reviewed-on: https://code.wireshark.org/review/30714
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20 11:23:19 +00:00
Guy Harris 0f30473661 Explicitly say "no extensions, no entry in this table".
Change-Id: Idd4d5143a75b7f2282460408b2f61d0d8aa3e66a
Reviewed-on: https://code.wireshark.org/review/30736
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-20 08:00:34 +00:00
Guy Harris 5d740afff1 Don't put file types without extensions into the file_type_extensions_base table.
As the comment says, this is a table of "File types that can be
identified by file extensions."; a file type that doesn't have an
extension that's used for files with that format obviously *can't* be
identified by a file extension and thus *doesn't* belong in this table.

Change-Id: Ic14dc55e6d9dbad4651e535cdf44293f8b449659
Reviewed-on: https://code.wireshark.org/review/30735
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-20 07:20:40 +00:00
Peter Wu df7af28f39 Add new Secrets API and allow TLS to use pcapng decryption secrets
Add a new secrets API to the core, one that can outlive the lifetime of
a single capture file. Expose decryption secrets from wiretap through a
callback and let the secrets API route it to a dissector.

Bug: 15252
Change-Id: Ie2f1867bdfd265bad11fc58f1e8d8e7295c0d1e7
Reviewed-on: https://code.wireshark.org/review/30705
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20 05:14:35 +00:00
Peter Wu 52a6671439 wiretap: add read/write support for Decryption Secrets Block (DSB)
Support reading and writing pcapng files with DSBs. A DSB may occur
multiple times but should appear before packets that need those
decryption secrets (so it cannot be moved to the end like NRB). The TLS
dissector will be updated in the future to make use of these secrets.
pcapng spec update: https://github.com/pcapng/pcapng/pull/54

As DSBs may be interleaved with packets, do not even try to read it in
pcapng_open (as is done for IDBs). Instead process them during the
sequential read, appending them to the 'wtap::dsbs' array.

Writing is more complicated, secrets may initially not be available when
'wtap_dumper' is created. As they may become available in 'wtap::dsbs'
as more packets are read, allow 'wtap_dumper::dsbs_growing' to reference
this array. This saves every user from checking/dumping DSBs.

If the wtap user needs to insert extra DSBs (while preserving existing
DSBs), they can set the 'wtap_dumper::dsbs_initial' field.

The test file was creating using a patched editcap (future patch) and
combined using mergecap (which required a change to preserve the DSBs).

Change-Id: I74e4ee3171bd852a89ea0f6fbae9e0f65ed6eda9
Ping-Bug: 15252
Reviewed-on: https://code.wireshark.org/review/30692
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20 05:12:37 +00:00
Peter Wu fb9c6905ef wsutil: rename some wsjson functions
Rename wsjson_unescape_json_string to json_decode_string_inplace
(inspired by the g_base64_decode_inplace name). Rename
wsjson_is_valid_json to json_validate (inspired by g_unichar_validate).

Ideally json_parse is inlined with its user (sharkd_session.c), but that
requires exporting the jsmn_init and jsmn_parse functions... Hence the
dependency on jsmn.h remains in wsjson.h.

Change-Id: I7ecfe3565f15516e9115cbd7e025362df2da5416
Reviewed-on: https://code.wireshark.org/review/30731
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20 05:03:26 +00:00
Guy Harris ba34545293 Add an API to get a list of compressed-file extensions, and use it.
Move all the compressed-file type stuff to wiretap/file_wrappers.c.

Rename wtap_compressed_file_extension() to
wtap_compression_type_extension() for consistency with the other
compression-type-extension routine names.

Move the declarations of the compression-type-extension routines in the
header file.

wtap_compression_type_extension() now returns NULL for
WTAP_UNCOMPRESSED; there's no need to special-case it.

Get rid of the now-unused wtap_compression_type_supported() and
WTAP_NUM_COMPRESSION_TYPES.

Change-Id: Ib93874079bea669a0c87104513dba0d21390455a
Reviewed-on: https://code.wireshark.org/review/30729
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-20 03:11:10 +00:00
Jaap Keuter 3653e23097 Convert enum increment into int increment
Using an enum type with the increment operator causes the following
error to be emitted by newer compilers:
"increment of enumeration value is invalid in C++ [-Werror=c++-compat]"
Numerical operations seem only allowed when taking their integer value.
Convert the loops involved to use integer and cast back to
wtap_compression_type when needed.

Change-Id: Ic96a6350c7d4db9ba2ba99df8b922649924c0e7a
Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-on: https://code.wireshark.org/review/30722
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-19 21:31:16 +00:00
Joerg Mayer 94ae9324d3 wtap.h: Fix documentation warnings
Change-Id: Ib0b5ae47047d3f574bd35cab045cefb8fcb8778d
Reviewed-on: https://code.wireshark.org/review/30710
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2018-11-19 10:23:31 +00:00
Guy Harris bf9286e554 Add an API to get the file extension for a compression type, and use it.
Add wtap_compressed_file_extension(), which returns NULL for
WTAP_UNCOMPRESSED and the appropriate file extension for other
compression types.

Add wtap_compression_type_supported(), which returns TRUE for
WTAP_UNCOMPRESSED and all supported compression types and FALSE
otherwise.  ("Supported" means "the code can decompmress files in that
compression format and can write files in that compression format", so
WTAP_GAIP_COMPRESSED is supported iff libwiretap is built with zlib.)

In MainWindow::fileAddExtension, instead of checking for
WTAP_GZIP_COMPRESSED and using ".gz" as the extension, use the extension
returned by wtap_compressed_file_extension() for the compression type.

Change-Id: I47cb0eca8c887ada3562df30b54e76509008180f
Reviewed-on: https://code.wireshark.org/review/30707
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-18 22:10:42 +00:00
Peter Wu 204dc92717 wiretap/merge.c: consolidate three similar merge_files routines
The three merge_files routines (filename, tempfile, stdout) have exactly
the same code except for a single wtap_dump_open routine. Reduce code
duplication to ease further improvements to this file.

Change-Id: I4fa890730d54c11b3614e56cf4d3d3da1ae9f5fd
Reviewed-on: https://code.wireshark.org/review/30678
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-17 20:51:22 +00:00
Anders Broman 377f5d0de7 nettrace: Handle failure to parse IPv6.
Reading of Address needs refacoring.

Change-Id: Icca094a50bda4314bda72005bfc0d722e3d185d2
Reviewed-on: https://code.wireshark.org/review/30672
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16 15:40:23 +00:00
Guy Harris b894c53d5e Add an API to get a description of a compression type, and use it.
Add wtap_compression_type_description(), which returns NULL for
WTAP_UNCOMPRESSED and a descriptive string for other compression types.

Instead of checking for WTAP_GZIP_COMPRESSED and appending "(gzip
compressed)", just pass the compression type to
wtap_compression_type_description() and, if the result is non-null,
append its result, wrapped in parentheses, with a space before the left
parenthesis.

Change-Id: I79a999c7838a883953795d5cbab009966e14b65e
Reviewed-on: https://code.wireshark.org/review/30666
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-16 12:21:00 +00:00
Dario Lombardo 76b80712ee nettrace: fix var init.
Error:
../wiretap/nettrace_3gpp_32_423.c:745:47: error: missing field 'src_ip' initializer [-Werror,-Wmissing-field-initializers]
        exported_pdu_info_t  exported_pdu_info = { 0 };
                                                     ^
1 error generated.
ninja: build stopped: subcommand failed.

Change-Id: I6c083b474854ea062f0a1c9f94e83af83574fc91
Reviewed-on: https://code.wireshark.org/review/30661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16 09:55:46 +00:00
Guy Harris a1372f6d01 Use an enum for compression types in various interfaces.
This:

1) means that we don't have to flag the compression argument with a
comment to indicate what it means (FALSE doesn't obviously say "not
compressed", WTAP_UNCOMPRESSED does);

2) leaves space in the interfaces in question for additional compression
types.

(No, this is not part 1 of an implementation of additional compression
types, it's just an API cleanup.  Implementing additional compression
types involves significant work in libwiretap, as well as UI changes to
replace "compress the file" checkboxes with something to indicate *how*
to compress the file, or to always use some other form of compression).

Change-Id: I1d23dc720be10158e6b34f97baa247ba8a537abf
Reviewed-on: https://code.wireshark.org/review/30660
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-16 09:20:36 +00:00
Guy Harris 4e17bd6229 Use the dump parameters structure for non-pcapng-specific stuff.
Use it for all the per-file information, including the per-file
link-layer type and the per-file snapshot length.

Change-Id: Id75687c7faa6418a2bfcf7f8198206a9f95db629
Reviewed-on: https://code.wireshark.org/review/30616
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-16 02:18:26 +00:00
Guy Harris c82c60136d Don't set anything in *wth until we've decided it's a Peek classic file.
Change-Id: I8b6f5b46cc578a65eec3e255d468d3841f9b0197
Reviewed-on: https://code.wireshark.org/review/30652
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-15 17:52:40 +00:00
Anders Broman e6c6f99e87 nettrace: Parse IPv6 addresses.
Change-Id: Iad583c39605ed2dd7a1c64f3729500c6b8a31fd3
Reviewed-on: https://code.wireshark.org/review/30650
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-15 15:22:24 +00:00
Guy Harris 58fade6c63 Simplify code.
Just directly set wth->file_encap.

Change-Id: I9fb3d34d3d46d9bef6b7206e25ba72049d9b12f1
Reviewed-on: https://code.wireshark.org/review/30648
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-15 08:37:00 +00:00
Guy Harris dd538c4170 Always use the file header to set the encapsulation type for Peek classic.
The information given by the person who provided the change to do so for
V7 files seems to indicate that 1) V5 and V6 files have the same file
header and 2) the protoNum field shouldn't be used for this purpose.

It also provided information about the bits in the flags and status
field, so add that.

The first three of those bits appear to match the first three bits of
the flags field in Peek tagged files, so note that in the Peek tagged
reader, in case the other bits also match.

Change-Id: I492afd594676efc14b487b3030c861bf5feb2d23
Reviewed-on: https://code.wireshark.org/review/30647
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-15 02:30:34 +00:00
Anders Broman db7653fd2c nettrace_3gpp_32_423: Don't crash on error and improve error output.
Change-Id: I4ea7ccf51321d6ce316456bde24aa37880ea52ed
Reviewed-on: https://code.wireshark.org/review/30627
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-14 13:58:47 +00:00
Guy Harris 0e1b78c22a All Veriwave files and packets use WTAP_ENCAP_IXVERIWAVE.
We set the file encapsulation to WTAP_ENCAP_IXVERIWAVE when we open the
file; we don't need to update it when we read packets. and we don't need
to set the per-packet encapsulation because it's set to the file
encapsulation for us by wtap_read() and wtap_seek_read().

Change-Id: I2f123e3fb0d505334f3451685290bdbae77a598b
Reviewed-on: https://code.wireshark.org/review/30622
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-14 07:02:11 +00:00
Guy Harris 68c0002584 Fix whitespace.
Change-Id: I4e1ca2bcefbaf8bb04e26bed0c668c43b1a6f788
Reviewed-on: https://code.wireshark.org/review/30621
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-14 05:29:42 +00:00
Guy Harris 13eefba79c Fail more cleanly if the file has no records.
If we have no records, we can't determine the link-layer type.

Also:

Use more signed values, and do more sanity checks on the file header and
TLVs to make sure we don't run into the first packet.

When writing the file header, accumulate the header length/first packet
offset in a 32-bit variable, and stuff it into the
offset-to-first-packet fields (plural) once we're done.

Change-Id: I3aeb5258bc16ddd8cf0ec86ef379287d0c4b351a
Reviewed-on: https://code.wireshark.org/review/30620
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-14 05:28:16 +00:00
Guy Harris 3aec5e1a28 Catch attempts to write multiple encapsulation types if unsupported.
If, in the process of opening the input file, we determine that it has
packets of more than one link-layer type, we can catch attempts to write
that file to a file of a format that doesn't support more than one
link-layer type at the time we try to open the output file.

If, however, we don't discover that the file has more than one
link-layer type until we've already created the output file - for
example, if we have a pcapng file with a new IDB, with a different
link-layer type from previous IDBs, after packet blocks for the earlier
interfces - we can't catch that until we try to write the packet.

Currently, that causes the packet's data to be written out as is, so the
output file claims it's of the file's link-layer type, causing programs
reading the file to misdissect the packet.

Report WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED on the write attempt
instead, and have a nicer error message for
WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED on a write.

Change-Id: Ic41f2e4367cfe5667eb30c88cc6d3bfe422462f6
Reviewed-on: https://code.wireshark.org/review/30617
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-14 03:38:45 +00:00
Guy Harris 8cd89b3bac Fix function name in comment.
Change-Id: Ice41094e6cc91df7e1f8286f35d49e1a20a89cc7
Reviewed-on: https://code.wireshark.org/review/30598
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-13 07:27:36 +00:00
Guy Harris 3faa45d4ec Don't have _ng versions of the dumper open routines.
Have the routines always take a parameters pointer; pass either null or
a pointer to an initialized-to-nothing structure in cases where we were
calling the non-_ng versions.

Change-Id: I23b779d87f3fbd29306ebe1df568852be113d3b2
Reviewed-on: https://code.wireshark.org/review/30590
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-13 03:37:29 +00:00
Guy Harris f070ad2c1e Use the Wayback Machine for a page that currently isn't working.
It loads, but displays nothing (either in Safari 12, or a presumably
recent Chrome, on my Mac).

Change-Id: I4a5530007ddf3c14a5fd349998318d5868da5d5c
Reviewed-on: https://code.wireshark.org/review/30588
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-12 23:15:44 +00:00
Peter Wu 1e76e1355a wiretap: refactor common parameters for pcapng dump routines
Four variants of wtap_dump_open_ng exists, each of them take the same
three parameters for the SHB, IDB and NRB blocks that has to be written
before packets are even written. Similarly, a lot of tools always create
these arguments based on an existing capture file session (wth).

Address the former duplication by creating a new data structure to hold
the arguments. Address the second issue by creating new helper functions
to initialize the parameters based on a wth. This refactoring should
make it easier to add the new Decryption Secrets Block (DSB).

No functional change intended.

Change-Id: I42c019dc1d48a476773459212ca213de91a55684
Reviewed-on: https://code.wireshark.org/review/30578
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-12 23:00:44 +00:00
Peter Wu 961f1388e4 wiretap: fix truncated reads while reading compressed file formats
A lot of file dissectors (pcapng, json, etc.) assumed that the packet
size is equal to the file size. This is not true if the file was
compressed and could result in silently truncating reads or failing to
open a file (if the compressed file is larger than the actual data).

Observe that a lot of file dissectors are simply copies of each other.
Move the fixed implementation to wtap.c and reuse the methods everywhere
else. While at it, avoid an unnecessary large allocation/read in
ruby_marshal.

Change-Id: I8e9cd0af9c4d1bd37789a3b509146ae2182a5379
Reviewed-on: https://code.wireshark.org/review/30570
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-11-10 23:24:05 +00:00
Guy Harris 6177f0eb42 The signal strength and noise in dB from an arbitrary reference are unsigned.
The radiotap spec says "dB antenna signal" and "dB antenna noise" are
unsigned.  Make it universally so.

Change-Id: Iea2c5360d7352ca5e84862ea338d1fc689272191
Reviewed-on: https://code.wireshark.org/review/30410
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-29 22:23:12 +00:00
Guy Harris 9867591633 Handle signal/noise in dB from an arbitrary point in the 802.11 radio dissector.
While we're at it, only set the RSSI column once - no need to do it at
the beginning and later when we're setting fields.

Change-Id: Ia729019e5e6dfbe1cdad61f1f8397b0a3a171996
Reviewed-on: https://code.wireshark.org/review/30405
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-29 18:49:15 +00:00
Guy Harris f71f968438 Clean up some things.
Rename ascend_seek() to ascend_find_next_packet(), to indicate what it
does; it doesn't seek to an arbitrary place, it tries to find the
starting offset of the next packet when reading sequentially.

Don't have it set the header type - that's the job of the parser.

Don't set the "next packet seek start" when doing random access I/O -
that field is only for sequential I/O, and we don't want random I/O
happening at the same time (which can happen in Wireshark) interfering.

Clean up comments.

Change-Id: I2808479eeec074afa16945ffb577b91d8cb356f7
Reviewed-on: https://code.wireshark.org/review/29975
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-02 11:20:57 +00:00
Guy Harris 5df87a5ad7 Don't return TRUE with *err or *err_info set.
Read and seek-read routines shouldn't do that; it causes TShark to
report an error when there was no error.

Change-Id: If564348fa01dce83c6a2317ac56ac8716d514bf7
Reviewed-on: https://code.wireshark.org/review/29972
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-02 11:06:23 +00:00
Guy Harris 5428e8ddbe Fix handling of some ISDN calls.
There's no guarantee that there will be two digits after PRI-XMIT or
PRI-RCV; the capture file in bug 3535, for exmaple, has "PRI-XMIT-0/1"
and "PRI-RCV-0".

Require a minimum of 1, not 2, non-{/(:} characters.  Leave the maximum
of 20 in place.

Change-Id: Ie8f8f4ff5eb04baf0ee61bf28015e59a1fa43948
Reviewed-on: https://code.wireshark.org/review/29947
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-01 19:58:49 +00:00
Gerald Combs fac429cf99 pcapng: Fix a buffer length.
In pcapng_read_systemd_journal_export_block, increase our buffer length
before appending to it.

Change-Id: I7e0f695c9bf1a6f80bc7e65661bfd5c70cda7d31
Reviewed-on: https://code.wireshark.org/review/29964
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-10-01 18:16:15 +00:00
Peter Wu 2359523b1a wtap: fix regression in wtap_read_packet_bytes
The "first_free" pointer is currently only increaseed by
ws_buffer_increase_length (unused) and ws_buffer_append (for writes).
Reading into the buffer should not reduce the available space. Otherwise
the next wtap_read_packet_bytes call will reallocate the buffer.

This reallocation is unexpected by some users of cf_read_record and
results in a use-after-free crash following these steps:
1. Open packet capture.
2. Ignore packet.
3. Open context menu, twice.

This crashes because the ByteViewText class points to the buffer which
is reallocated after calling PacketList::getFilterFromRowAndColumn.

Change-Id: I4f1264a406a28c79491dcd77c552193bf3cdf62d
Fixes: v2.9.0rc0-2001-g123bcb0362 ("Make systemd journal entries events.")
Reviewed-on: https://code.wireshark.org/review/29915
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-01 10:55:55 +00:00
Gerald Combs f69108b84e Add a systemd Journal Export extcap.
Add an sdjournal extcap, which reads journal entries using the
sd-journal API and dumps them as journal Export Format records.

Change-Id: I17ccfa88ab5d053c16c869cd26e580d84022502e
Reviewed-on: https://code.wireshark.org/review/29479
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-01 08:58:13 +00:00
Guy Harris 92e2858fb1 Put the FILE_T first in the arguments to parse_dbs_etherwatch_packet().
That puts the two arguments to fill in - the wtap_rec and the Buffer -
together.

Change-Id: I8850a7aaccc98e5acd292e3cebc1f37cee8a6ce7
Reviewed-on: https://code.wireshark.org/review/29946
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-01 00:58:11 +00:00
Guy Harris 9a0008f841 Remove unnecessary clearing of *err.
wtap_read() clears it for you.

Change-Id: I736509d54ff385e5b80e9393aeb91c6473b02824
Reviewed-on: https://code.wireshark.org/review/29939
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-30 19:41:34 +00:00
Guy Harris de97adecfb Small cleanup of the sequential read routine.
There's no need to set *err to 0; it's set by stanag4607_read_file().

There's no need for an intermediate variable to hold the current file
offset; just assign it directly to *data_offset.

Change-Id: I24bd1c349dd48576a65cc36228a680134427bba5
Reviewed-on: https://code.wireshark.org/review/29938
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-30 19:06:09 +00:00
Peter Wu 62de3e6a44 wiretap: remove redundant ws_buffer_assure_space
wtap_read_packet_bytes already calls ws_buffer_assure_space.

Change-Id: Ib5c9f7d05ee9f7ba5faa716e941e4c999aa9704f
Reviewed-on: https://code.wireshark.org/review/29916
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-29 17:20:25 +00:00
Gerald Combs 04ce1078e3 pcapng: Fix a copy/paste error.
We shouldn't set any rec_header.syscall_header fields in
pcapng_read_systemd_journal_export_block.

Change-Id: I920accdbcdcdbf6d71324c8d9d6d562511f6a9d1
Reviewed-on: https://code.wireshark.org/review/29895
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-09-28 00:05:04 +00:00
Gerald Combs 123bcb0362 Make systemd journal entries events.
Treat systemd journal entries filetype-specific events instead of
packets.

Add support for reading and writing systemd journal entries to pcapng.
Note that pcapng IDBs should be optional.

Add support for REC_TYPE_FT_SPECIFIC_EVENT where needed.

Change-Id: Ided999b1732108f480c6c75323a0769a9d9ef09f
Reviewed-on: https://code.wireshark.org/review/29611
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-09-26 21:31:13 +00:00
Guy Harris 854cfe53ef Make the ERF code in pcap_get_phdr_size() more like the reading code.
Change-Id: I6cd17b1ed4b3ed2aa2cc88b3cbae354d36dafead
Reviewed-on: https://code.wireshark.org/review/29880
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 20:05:09 +00:00
Guy Harris ad335a52d8 Get rid of unnecessary check.
Either pcap_process_pseudo_header() returns -1, in which case we fail,
or it returns the exact same value as pcap_get_phdr_size().  If we don't
fail, don't bother to check whether the values are the same.

Change-Id: I18191cc3de2a1c2144ca9b508ed17b2f593fc835
Reviewed-on: https://code.wireshark.org/review/29879
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 19:58:27 +00:00
Guy Harris c7f4badb8c Sort the pseudo-header routines in the order of the switch statements.
Change-Id: Ia590e90930bbb355900a6d87b22a0418174bbc11
Reviewed-on: https://code.wireshark.org/review/29878
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 19:43:31 +00:00
Guy Harris a1818692aa pcapng: Free option_content on error
Change-Id: If95c6858370fdff795f5e568d0300fedb1a611ea
Reviewed-on: https://code.wireshark.org/review/29874
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 19:15:00 +00:00
Guy Harris 275a6e4c36 Move wtap_encap_requires_phdr() amongs the other switch statement routines.
Keeping them together might increase the likelihood that all of them get
updated when a new pcap/pcapng link-layer type whose pseudo-header is
first processed here rather than by a dissector.

Change-Id: Ia6f45c38e9530b7c6a53d006fbc01b3040e9a014
Reviewed-on: https://code.wireshark.org/review/29868
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 18:55:11 +00:00
Stig Bjørlykke 65a422e235 pcapng: Free option_content on error
Change-Id: I5a406ecf4e495d0224473d01af4144479ceaf9c3
Reviewed-on: https://code.wireshark.org/review/29863
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-09-26 18:52:26 +00:00
Guy Harris 0a19ec761d Sort cases in pcap_get_phdr_size(), add a missing one for WTAP_ENCAP_NFC_LLCP.
Sort the cases to match the order in other routines.

That turned up a missing case for WTAP_ENCAP_NFC_LLCP, so add it.

Change-Id: I500731322ae93c6d2efc368f16cf468f589910f3
Reviewed-on: https://code.wireshark.org/review/29858
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 17:53:02 +00:00
Guy Harris 514ce6d6bb Don't update a variable that's not used at that point.
Change-Id: I978caa84f31fa39d4538f73b8c6788c5592b3228
Reviewed-on: https://code.wireshark.org/review/29848
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 07:55:37 +00:00
Guy Harris 6b904030f6 Put ERF pseudo-header reading and writing into single routines.
Have pcap_read_erf_pseudoheader() do all the work of reading an ERF
pseudo-header.

Add pcap_write_erf_pseudoheader() as a routine to do all the work of
writing an ERF pseudo-header.

Change-Id: If53ae50fcee35a45113ca0f0c64f69848e044cbd
Reviewed-on: https://code.wireshark.org/review/29847
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 07:46:08 +00:00
Guy Harris 9795af4488 Get rid of bogus copied-and-pasted comment.
Change-Id: If9b17b6e05a1bd6a3fcf2348f81837a6ed16761c
Reviewed-on: https://code.wireshark.org/review/29844
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 03:26:28 +00:00
Guy Harris 1302cdb27c Sort cases in pcap_write_phdr() - and add missing NFC LLCP case.
Put the cases in pcap_write_phdr() into the same order as the cases in
pcap_process_pseudo_header().

Doing so revealed that there wasn't a case for WTAP_ENCAP_NFC_LLCP in
pcap_write_phdr(), so NFC LLCP captures wouldn't be saved correctly.
Add pcap_write_llcp_pseudoheader() and use it.

Change-Id: I2728a96e63d2e0606ae0bb480f97fe124ab48d17
Reviewed-on: https://code.wireshark.org/review/29841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 03:02:36 +00:00
Guy Harris 3ddc3b0761 Put the code for writing pseudo-headers into individual routines.
For each pseudo-header type, put a routine to write the pseudo-header
after the routine to read it.

Change-Id: Iffc010c1bf97acc5eb834a388e328ad3c2310351
Reviewed-on: https://code.wireshark.org/review/29840
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 02:47:54 +00:00
Guy Harris 7e928c8a51 In LINKTYPE_PPP_WITH_DIR files, any non-zero direction value means "sent".
It's not as if 0 means received, 1 means sent, and anything else is
invalid; treat all non-zero values as meaning "sent" when reading, and
write out 1 for "sent".

Change-Id: Iaf5eb327a6b87b893a203475c8730452c51a38e9
Reviewed-on: https://code.wireshark.org/review/29839
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 02:26:42 +00:00
Guy Harris 80160d6181 Shuffle pseudo-header definitions to just before the reader function.
Put all the #defines and structure declarations for a particular
pseudo-header before the function to read the pseudo-header.

Change-Id: I11013ff99d72832f49e9bea56dbc07f5cd8618f3
Reviewed-on: https://code.wireshark.org/review/29838
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 02:19:20 +00:00
Guy Harris ad2d241277 Put the pseudo-header length checks into the pseudo-header read routines.
That centralizes knowledge of the particular pseudo-header into its read
routine.

Change-Id: I4931d03a20a1b648af3ab6b92a034659c55d1ba3
Reviewed-on: https://code.wireshark.org/review/29837
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 02:10:33 +00:00
Guy Harris 6c810f9cdd The sent field of the p2p pseudo-header is a Boolean.
Either it's TRUE, meaning sent, or it's FALSE, meaning received.  Make
it a gboolean and get rid of the #defines for it.  ("Unknown" is handled
by the WTAP_ENCAP_ value not *having* a p2p pseudo-header.)

Change-Id: I650d7213523b49e7531d9555a98cde1be519a294
Reviewed-on: https://code.wireshark.org/review/29836
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 01:42:43 +00:00
Guy Harris 5773f2bbca Only use "libpcap" to refer to the library.
For file formats, say "pcap/pcapng" or "pcap and pcapng" instead; this
code handles both formats.  Use just "pcap_" in structure types.

Change-Id: I2c0e096855ac3736bbfd72480ed4221b3a2f25d1
Reviewed-on: https://code.wireshark.org/review/29835
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 00:34:06 +00:00
Guy Harris c9f19e4af7 Rename the pseudo-header for X.25, V.120, and Frame Relay.
It's not just for X.25, it's for anything that has the notion of Data
Terminal Equipment and Data Communications Equipment; call it "dte_dce",
not "x25".

Change-Id: I3d51fec8b424e91ffd6d59895f50fc5ece791b08
Reviewed-on: https://code.wireshark.org/review/29834
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 00:15:26 +00:00
Guy Harris f9129721b2 Get rid of unused flag argument.
We always tell pcap_process_pseudo_header() to check to make sure the
pseudo-header isn't bigger than the captured data; no need for a flag
argument to tell it to do so.

Change-Id: I8310bb06a390a7f4a7a232ad140ae07955d52da1
Reviewed-on: https://code.wireshark.org/review/29833
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-25 23:20:39 +00:00
AndersBroman 3b34b286ab nettrace: Improve error printout at parse error.
Change-Id: I193301cb041ad2d513baa2806fd2168b95b17a3f
Reviewed-on: https://code.wireshark.org/review/29804
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-24 13:39:03 +00:00
Gerald Combs 8f08a4e74e Try to discourage the use of APIs via counting.
Add the ability to specify maximum function counts for each group to
checkAPIs. Add maximum counts for the "termoutput" and "abort" groups
where needed. Show summaries in various checkAPI targets.

Switch uses of ws_g_warning back to plain g_warning.

Change-Id: I5cbddc8c671729e424eed8551f69116d16491976
Reviewed-on: https://code.wireshark.org/review/29721
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-19 16:07:03 +00:00
Guy Harris 53ac86f8af Make the maximum block size big enough for max-size D-Bus packets.
Change-Id: I352db07084294629160f16f6cf1e07f902a2844f
Reviewed-on: https://code.wireshark.org/review/29711
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-17 22:21:45 +00:00
Gerald Combs 4c9cbcd5ac systemd Journal: Add a cast.
Fixes compilation on 32-bit Windows.

Change-Id: I03241d305569c1719f100950bbcabee01b6f192c
Reviewed-on: https://code.wireshark.org/review/29475
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-09-07 20:06:13 +00:00
Gerald Combs 50b9da7bc2 Add a systemd Journal Export Format parser and dissector.
Add a file parser and dissector that can handle the output of
`journalctl -o export`. From here we can add a systemd journal extcap
and possibly support for the JSON and binary formats.

Change-Id: I01576959b2c347ce7ac9aa57cdb5c119c81d61e9
Reviewed-on: https://code.wireshark.org/review/29311
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-31 05:20:27 +00:00
João Valverde d0b97a420d CMake: Modernize config-file package support
A CMake config-file package provides support for downstreams using
CMake and Wireshark libraries to easily configure the libwireshark
dependency with:
  find_package(Wireshark CONFIG [REQUIRED])
  target_link_libraries(foo epan)

The FindWireshark.cmake file is no longer needed.

See cmake-package(7) for more details on CMake's package system.

Change-Id: Ie8af1d44417a99dd08d37959f7b2ffca88572ec2
Reviewed-on: https://code.wireshark.org/review/29208
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2018-08-25 18:07:21 +00:00
Guy Harris 08cbe559b3 Add support for reading and writing the new if_hardware IDB option.
Support for writing it in live captures will come later; this change,
but not that one, will be backported so older versions of Wireshark
won't remove it when writing a file out.

Change-Id: I9fd4067991acfd2d18c03d0a373ce8337a9f3a76
Reviewed-on: https://code.wireshark.org/review/29064
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-11 02:09:15 +00:00
Guy Harris f543d4a2fd "It's not a valid text line" means "it's not an RFC 7468 file", not "it's bad".
Don't return an error unless we get a read error.  If the line could be
read, but isn't a valid text line, that just means it's not an RFC 7468
text file.

Change-Id: I04f48294cac213cf61b8dcb851b99dc6dd776df8
Reviewed-on: https://code.wireshark.org/review/29039
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-09 10:04:56 +00:00
Guy Harris 5e2e9de930 Pass zero-length PSDU type information to the radio dissector.
We call that dissector even for zero-length PSDUs, so the radio
information is shown.  We also show the zero-length PSDU type.

We don't call the 802.11 dissector for zero-length PSDU frames.

That way, you don't have to open up the radiotap information to find out
about zero-length PSDU frames, we can support zero-length PSDU
information for other pseudo-headers and file types if they support it,
and taps using the radio information can get zero-length PSDU frame
information.

Change-Id: I7d5da4ea978d8ca4889fc76160f11e3416b4d036
Reviewed-on: https://code.wireshark.org/review/29034
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-09 02:26:17 +00:00
Guy Harris 8d6e8f6498 RFC 7468 is PEM-inspired, but it's not PEM.
Do some renaming.

Change-Id: If8fa85370014f9618df38d97048dd1c52a4c389f
Reviewed-on: https://code.wireshark.org/review/28918
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-01 07:02:34 +00:00
Guy Harris 940775b948 Do most of the RFC 7468 file processing in the dissector.
Have the Wiretap code just do a heuristic test to see if the file looks
like a RFC 7468 file and just had the entire blob of raw file data to
the caller, with an encapsulation type of WTAP_ENCAP_RFC7468.

Have a file-rfc7468.c dissector that processes the lines of the file,
displaying all of them.  Have it extract the label from the
pre-encapsulation boundary line, and, after it's decoded the
base64-encoded data lines into a blob of data, try handing the tvbuff
with the blob to dissectors that have registered in the
"pem.preeb_label" dissector table with the appropriate label value, and
hand it to the raw BER dissector only if that fails.

This allows some files to have the content dissected as more than just a
raw blob of BER-encoded data.

Change-Id: I98db9f0beb86e5694fb8e886005a2df4fc96ba71
Reviewed-on: https://code.wireshark.org/review/28914
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-01 04:58:43 +00:00
Stephen Donnelly ead3d6b8c5 Relax ERF heuristic
Allow forward timestamp deltas up to 1 year, up from 7 days.
Surprisingly this was overly restrictive in some real cases.

Change-Id: I8a4bd1ca791b978aa5d2be40f7f8dd8e23db8837
Reviewed-on: https://code.wireshark.org/review/28882
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-31 04:32:17 +00:00
Guy Harris 933a48bc6b Add WTAP_ENCAP_RUBY_MARSHAL to the table of encapsulation names.
Change-Id: If7362bc4e1da3c3dc22df08b52c7cadcd43d3b81
Reviewed-on: https://code.wireshark.org/review/28886
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-30 22:29:51 +00:00
Guy Harris 5d8a5fb866 If we have fseek/ftell variants with 64-bit offsets, use them.
Or, at least, use them in the libwiretap file-writing code; we can
change other places to use them as appropriate.

Change-Id: I63af2267a22a158ee23f3359b043913dac0e285b
Reviewed-on: https://code.wireshark.org/review/28783
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-20 23:13:08 +00:00
Guy Harris aab5ad074e Fix the calculation of a file's "basename".
Strip off only extensions that correspond to file types we know about;
QFileInfo::baseName() strips off *all* extensions, where "extension" is
"anything preceded by a .", so it turns foo.bar.pcap.gz into foo, not
foo.bar.  We don't want that; instead, we strip off only those
extensions that correspond to file types we know how to read, so we'd
strip off .pcap.gz in foo.bar.pcap.gz, and strip off .pcap in
foo.bar.pcap, leaving foo.bar in both cases.

Change-Id: I5385921ad2f0fef815d52e9902fef15735fd9dae
Reviewed-on: https://code.wireshark.org/review/28636
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-06 09:07:52 +00:00
Guy Harris a277a520fc The "Ethernet offset" is 16 bits in the file; make it so in the pseudo-header.
This should squelch warnings from Ida7b98af8c44a52ddac2c4ab0702db2519a0c4af.

Change-Id: I6803001981c63ddf76a735341ab2cc8dccdb8ab0
Reviewed-on: https://code.wireshark.org/review/28573
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-03 02:33:03 +00:00
Guy Harris 8304f69fd7 Add macros to initialize nstime_t values and use them.
This allows code to initialize them without having to know the details
of the structure; the initializes should, and will, be changed if the
members of the structure are changed.

Change-Id: I93e6ebfcde9ceca17df696fcba4e8410c5afb175
Reviewed-on: https://code.wireshark.org/review/28501
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-28 03:39:54 +00:00
Guy Harris 590d0a483e Declare lead_surrogate only in the block where it's used.
That makes it a bit clearer that we don't need to initialize it to zero
before the loop.

This fixes a Dead Store (Dead assignement/Dead increment) Warning found
by Clang.

Change-Id: Iabfc4b47a3c6300814492c37ccfb321afd0c54ea
Reviewed-on: https://code.wireshark.org/review/28374
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-22 07:44:58 +00:00
David Kreitschmann 11ba10dd4b Fix build paths for cmake's Xcode project generator on macOS.
Multi-configuration generators (such as Xcode or VS) append the current build configuration to most paths (eg. Debug/Release). Currently this results in inconsistent paths for the application bundle and the included command line tools. This commit sets the correct path information for multi-configuration generators for macOS application bundles. The standard Makefile behaviour is untouched.

One Windows specific configuration was changed, as it was conflicting with these changes. This needs to be checked before merging.

Additionally the wrapper scripts are omitted for Xcode, as the path to the binaries depends on the configuration chosen in Xcode. Therefore it is not viable to create these scripts in the cmake run.

Bug: 11816

Change-Id: Ib43d82eb04600a0e2f2b020afb44b579ffc7a7c9
Reviewed-on: https://code.wireshark.org/review/28291
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-21 03:33:03 +00:00
Guy Harris 08ef8f1326 Just extract the title length once.
Extract it into title_length before checking it, and then check the
value of title_length.

Change-Id: I7f2c334dbce5eeaa12cd5d8bb8e289852fd15c4f
Reviewed-on: https://code.wireshark.org/review/28282
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-15 04:08:24 +00:00
Guy Harris 1e84591f4f Fix some "bad file" messages.
The number being compared against is the amount of data *remaining* in
the comment information, not the *size* of the comment information.

And it's unsigned, so format it with %u.

Change-Id: I5f02302ad4acbc3b27655ff5518e6e56d464020d
Reviewed-on: https://code.wireshark.org/review/28280
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-15 04:03:07 +00:00
Guy Harris 7f3d7199fb Convert NetMon comment titles to UTF-8 when reading the file.
Fix indentation, and note that the comment "description" (contents) are
RTF (as opposed to plain text).

Change-Id: I668a08c06e39a32318454d2ee73933083c5cb516
Reviewed-on: https://code.wireshark.org/review/28279
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-15 01:22:12 +00:00
Guy Harris 92412335d1 No need to check for a UTF-16 string's length being a multiple of 2.
utf_16_to_utf_8() just ignores the extra octet.

Change-Id: I7bf003b674e5d9b0fb0265b0e8c6c142107084e3
Reviewed-on: https://code.wireshark.org/review/28277
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-15 00:39:30 +00:00
Guy Harris 3df05f3ec8 Fix indentation.
Change-Id: I6a3db704c9046ff696820ce157423c5867c2c2e8
Reviewed-on: https://code.wireshark.org/review/28275
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-14 22:10:26 +00:00
Guy Harris 58d211dc7f Fix the handling of paths in the process information.
Pathnames are not limited to 260 characters in recent versions of
Windows; boost the limit to handle up to 32767 UTF-16 octet pairs worth
of path.

The pathname is in UTF-16-encoded Unicode; convert it to UTF-8 for our
internal use.

Bug: 14876
Change-Id: I4ef19fd47c7dbdd74dcaf31a7a80f432d57dbb0d
Reviewed-on: https://code.wireshark.org/review/28273
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-14 21:59:28 +00:00
Dario Lombardo 24713511eb wiretap: add support for ruby marshal object files.
Change-Id: Iefba3b15c907966bb0b8d5c0ff9b6bb7097d326e
Reviewed-on: https://code.wireshark.org/review/27763
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-07 04:54:49 +00:00
Gerald Combs 9031281672 CMake: Get rid of FULL_SO_VERSION
gd2e0724afc moved our library versions into their own variables named
FULL_SO_VERSION. They're no longer used and interfere with
tools/release-update-debian-soversions.sh so remove them.

Fix some shellcheck warnings in release-update-debian-soversions.sh
while we're here.

Bug: 14778
Change-Id: I0eb0bb4ab4c482bdb8a94f8c18aa04c6c83c781b
Reviewed-on: https://code.wireshark.org/review/28068
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-07 04:01:37 +00:00
Jaap Keuter 79b12ab071 Use proper unsigned constant for bit shift
Shifting (signed) '1' 31 bits is undefined. Make it unsigned.

Change-Id: Iff300493907c53b47bb116a0282846955e0f2429
Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-on: https://code.wireshark.org/review/27981
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-06-04 09:18:26 +00:00
Guy Harris 93e6ab8eb9 Fix problem building on NetBSD 7.1.
The version of Berkeley YACC that comes with NetBSD 7.1 puts a
declaration of ascendlval into ascend.h, even when we're building a
reentrant parser.  That causes a shadowing warning.

Suppress some diagnostics before we include ascend.h.

Change-Id: I190f0439c36b48c7dfb19a2fe6cef0eb1e96f198
Reviewed-on: https://code.wireshark.org/review/27917
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-30 23:16:33 +00:00
Martin Kaiser bf886df8b6 wiretap: camins: add support for timestamps
A CAM inspector file maintains a global time counter in units of
1us. Set the correct resolution for the packet timestamps.

Keep track of the time counter when the file is loaded and we walk
through the file from start to end. Process timestamp blocks in the
file. Each of those blocks updates a part of the overall time counter.

Change-Id: I138cd8fb287e591b078babc2403a599287df1397
Reviewed-on: https://code.wireshark.org/review/27904
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-30 04:25:08 +00:00
Dirk Eibach bf8590326a dpa400: Fix wiretap data packet len
Increment the packet size whenn adding the from_source field.

Change-Id: I380305d763df40b2cf1f2209643d05dfde12a716
Reviewed-on: https://code.wireshark.org/review/27811
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-25 19:31:35 +00:00
Роман Донченко 1d2b0d91e3 pem: validate the base64 lines
g_base64_decode_step will ignore all non-base64 characters, so make sure
we catch such characters ourselves. Otherwise, if we encounter any
non-conforming syntax, we'll parse it as base64 text, and consequently
the BER dissector will receive nonsensical input.

Change-Id: I38294141134626a3d98b5b12837d887492b18102
Reviewed-on: https://code.wireshark.org/review/27653
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-23 11:08:38 +00:00
Dario Lombardo 95082052da json: fix typo.
Change-Id: I36c4d0e15dae2f3cbf0efe1f3e1b0e82433cc3cd
Reviewed-on: https://code.wireshark.org/review/27681
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-21 09:31:55 +00:00
Guy Harris 3f794bb2bb Make the two names for Unigraf DPA-400 captures the same.
Change-Id: I8ec41233e78e9ec5fa1d1f56c45ef2936e95467d
Reviewed-on: https://code.wireshark.org/review/27680
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-20 21:46:46 +00:00
Guy Harris 544aba3263 Make the two file type descriptions for WTAP_FILE_TYPE_SUBTYPE_MPLOG the same.
Change-Id: Id800bf9ea0617398d1eaede1fbacfa61ed8ebe8c
Reviewed-on: https://code.wireshark.org/review/27674
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-20 21:40:41 +00:00
Guy Harris 033a1be4ab Add an entry for WTAP_ENCAP_DPAUXMON.
Change-Id: Ie9a7816023c02222e624b16bcdf6e90ff7678343
Reviewed-on: https://code.wireshark.org/review/27673
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-20 21:35:40 +00:00
Guy Harris 040b70364d Add entries for two WTAP_ENCAP_ types, and clean up another entry.
We didn't have entries for WTAP_ENCAP_JUNIPER_ST or
WTAP_ENCAP_ETHERNET_MPACKET; add them.

The entry for WTAP_ENCAP_DOCSIS31_XRA31 just called it "DOCSIS31 XRA31",
not "DOCSIS with Excentis XRA pseudo-header", which is a more complete
description.  (That field is supposed to be a descriptive word or
phrase, not just a short protocol name.)

Change-Id: Ib2b30fccce2339a12d216466831a1786e14178b7
Reviewed-on: https://code.wireshark.org/review/27671
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-20 21:30:55 +00:00
Alexis La Goutte cf85fd13bc dpa400: fix no previous prototype for function 'dpa400_open' [-Wmissing-prototypes]
Change-Id: Ie10cd7bfffa5ef2fe888ade3250c873750eb18a9
Reviewed-on: https://code.wireshark.org/review/27608
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-17 06:35:26 +00:00
Guy Harris d08d0a87c5 Eliminate some unneeded header checks.
sys/stat.h and sys/types.h date back to V7 UNIX, so they should be
present on all UN*Xes, and we're assuming they're available on Windows,
so, unless and until we ever support platforms that are neither UN*Xes
nor Windows, we don't need to check for them.

Remove the CMake checks for them, remove the HAVE_ values from
cmakeconfig.h.in, and remove all tests for the HAVE_ values.

Change-Id: I90bb2aab37958553673b03b52f4931d3b304b9d0
Reviewed-on: https://code.wireshark.org/review/27603
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-16 22:03:09 +00:00
Роман Донченко 3ba56ce586 wiretap: Add a reader for files in the PEM-like format specified by RFC 7468
Change-Id: I8109025120d01c915f3a9d5550aa9272ec83893a
Reviewed-on: https://code.wireshark.org/review/27334
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-05-15 12:47:06 +00:00
Guy Harris 3a1bf2b87e Use ws_g_warning() for plugin registration errors.
Those should always be reported, as they indicate that a block type
plugin is trying to do something we don't allow.

We should probably have a mechanism by which ws_g_warning() messages are
logged to the standard error for command-line programs, logged to an
error message window for GUI programs, and logged to some form of system
log for daemons.  For now, it's a good way to log non-fatal errors that
should always be shown in *some* fashion, as well as to mark messages
that should be handled in the form described in the previous sentence.

Change-Id: Ieedf87fc2dd3184a4466ae69af01f799165c1b70
Reviewed-on: https://code.wireshark.org/review/27519
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-14 06:07:05 +00:00
Dario Lombardo 6dedca3ece wiretap: use pcapng_debug instead of g_warning.
Change-Id: Ibbfe3d1db8b4a7515e7eda194a76d3b0a624542e
Reviewed-on: https://code.wireshark.org/review/27383
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-05-14 05:42:53 +00:00
Dirk Eibach c430645b4d wiretap: DPA-400 logfile support
Wiretap support for reading the Unigraf DPA-400 DisplayPort
AUX channel monitor logfiles.

Bug: 14651
Change-Id: Ia8714a72a9439dd566ef604e001ebf45ecaab76d
Reviewed-on: https://code.wireshark.org/review/27415
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-10 22:33:24 +00:00
Dirk Eibach bfd51199e7 DisplayPort AUX channel protocol dissector
Dissector for the VESA DisplayPort AUX channel protocol.

Bug: 14651
Change-Id: I5c0c7668bda969086d9d6e5069aad87e929f6340
Reviewed-on: https://code.wireshark.org/review/27311
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-10 20:27:36 +00:00
Dario Lombardo 695fdaba95 nettrace: add g_assert in write_packet_data (CID 1435482).
proto_col_str could have been nulled by line 409, but in that case
EXP_PDU_TAG_COL_PROT_BIT is not set, then strlen doesn't get called in
line 432. Coverity raised a false positive and g_assert will pacify it.

Change-Id: Ib22868a549319913c9c2a25ede0b63fed3af6eb0
Reviewed-on: https://code.wireshark.org/review/27424
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-05-10 10:10:12 +00:00
Guy Harris e7d24c606c Always explicitly set tm_isdst before calling mktime().
Except in rare cases, we want to set it to -1 so that we let mktime()
determine whether DST/Summer Time was in effect at the given date and
time rather than pretending that we know whether it's in effect or not.

Change-Id: I0ea75317dd308a515cedf4d1260b583e1592cc9b
Reviewed-on: https://code.wireshark.org/review/27431
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-09 16:33:21 +00:00
Роман Донченко 76a29d7855 wiretap: make open_info_base[] const
Change-Id: I1e0099d5301f08ee500f17529d6cc3733d3c9a4f
Reviewed-on: https://code.wireshark.org/review/27392
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-08 04:51:56 +00:00
Guy Harris 6e9c3438bc Revert "wiretap: DPA-400 logfile support"
This reverts commit dfd6eb5d68.

This change cannot be submitted without change I5c0c7668bda969086d9d6e5069aad87e929f6340.

Change-Id: Ieb22f4e9afa1742db861a291202a2790a4784e1b
Reviewed-on: https://code.wireshark.org/review/27387
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-07 17:46:35 +00:00