Commit Graph

80222 Commits

Author SHA1 Message Date
Pascal Quantin 20720c8441 MBIM: fix some signedness warnings 2021-02-23 09:34:36 +01:00
Odysseus Yang cf14578c61 MBIM: dissect the commands of MBIM extended version 3.0
MBIM_CID_MS_DEVICE_CAP_V2
MBIM_CID_SUBSCRIBER_READY_STATUS
MBIM_CID_PACKET_SERVICE
MBIM_CID_CONNECT
MBIM_CID_IP_PACKET_FILTERS
MBIM_CID_MS_MODEM_CONFIG
MBIM_CID_MS_REGISTRATION_PARAMS
MBIM_CID_WAKE_REASON
2021-02-23 07:36:12 +00:00
Guy Harris bc3cc17bc4 Lua: add routines to return pcap/nsec pcap/pcapng file type/subtypes.
These will be backported, for the benefit of Lua scripts that want those
specific file types/subtypes (typically in order to write files of those
types); that allows those types to be fetched without having to know the
right string to hand to wslua_wtap_name_to_file_type_subtype().
2021-02-22 22:23:54 -08:00
Grzegorz Niemirowski 69ca16bdf0 ZVT: Dissect list of permitted ZVT commands 2021-02-22 21:28:55 +00:00
Guy Harris d50f712a85 wiretap: fix use of wrong index as array subscript.
"i" and "j" are too similar, so it's easy to use the wrong one if you're
using both as array indices and not easy enough to notice the mistake.

Use somewhat more meaningful names when we fix the index.

Fixes #17252.
2021-02-22 12:55:35 -08:00
Guy Harris 00d2661459 wiretap: fix dependency in CMakeLists.txt.
wtap_modules.c depends on ${WIRETAP_MODULE_FILES} rather than
${WIRETAP_NONGENERATED_FILES}.
2021-02-22 19:45:44 +00:00
Thomas Dreibholz 3a25ebbc42 Updated broken URL in headers. 2021-02-22 18:18:45 +00:00
Anders Broman 614df91e23 RTCP detect non zero padding and dont dissect zero length 2021-02-22 17:03:03 +00:00
Anders Broman d5d26679fc ZVT: Use g_ascii_strtoll instead of atol. 2021-02-22 17:03:31 +01:00
Thomas Dreibholz 2e7f2ffb7a
Added "Follow DCCP stream" feature.
This pull request includes:
* The "Follow DCCP stream" feature.
* Updated docbook documentation for the "Follow DCCP stream" feature.
* Test for the feature.
* Corresponding packet trace for the test.
2021-02-22 12:48:46 +01:00
Grzegorz Niemirowski a57a32c04e ZVT: Addedd dissection of amount, terminal ID, date and time. Registration fix. 2021-02-22 10:39:54 +01:00
Darius Davis f895014f68 reassemble: Improve perf of free_all_reassembled_fragments.
When we're walking the list of fragments to free, if we encounter
FD_VISITED_FREE, we can conclude traversal of this fragment list immediately
(and go to the next hash bucket), since everything subsequent to this point in
the list has already been processed by free_all_reassembled_fragments.  This
trims an O(n^2) hash table iteration down to O(n).

Before this change, a very ugly 1.1 GByte TFTP capture (with lots of
out-of-order and retransmitted blocks) takes 4 hours to process with
tftp.defragment=TRUE -- output completes after 1.25 hours, and then about
2.75 hours of time is spent doing repeated list traversals within
free_all_reassembled_fragments...(!)  With this change, the same test completes
in 1.25 hours, with the cleanup taking just 71 msec.

Tested also with reassemble_test under Valgrind; No issues/leaks were reported.
2021-02-22 17:00:54 +10:00
Thomas Dreibholz 297246093b Small FGP dissector improvement 2021-02-22 06:38:44 +00:00
Guy Harris 842a7cccf9 wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported.  Indicate whether "supported" means "one instance" or
"multiple instances".

"Supports" doesn't just mean "can be written", it also means "could be
read".

Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file.  Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).

Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.

Provide backwards compatibility for Lua.

This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 23:18:35 +00:00
Gerald Combs b8ce02e6fb editcap: Fixup our help output.
Make sure list_capture_types prints to the designated stream so that
tools/update-tools-help.py works correctly for `editcap -F`.
2021-02-21 22:57:13 +00:00
Gerald Combs b9bdce8484 NetPerfMeter: Fix compilation on Windows.
Use guint64 instead of u_int64_t. GLib might make it easier to use
standard types at some point[1] but they haven't yet. Make our offsets
unsigned.

[1]https://gitlab.gnome.org/GNOME/glib/-/issues/1484
2021-02-21 12:57:15 -08:00
Thomas Dreibholz dc3e92f638
Added NetPerfMeter test suite. 2021-02-21 18:23:48 +01:00
Thomas Dreibholz 2fe740c00d
Removed unnecessary check for transport protocol. 2021-02-21 16:45:11 +01:00
Thomas Dreibholz cdbbf5d384 Decode time stamp field to the actual UTC time. 2021-02-21 13:57:04 +00:00
Thomas Dreibholz 115472aaf8 Now using heuristic dissector for transport over TCP, UDP and DCCP instead of port number range. 2021-02-21 13:57:04 +00:00
Thomas Dreibholz 6f6537dfba Fixed typo. 2021-02-21 13:57:04 +00:00
Thomas Dreibholz 6737430111 Added NetPerfMeter test trace. 2021-02-21 13:57:04 +00:00
Thomas Dreibholz 77343db1fe Improved NetPerfMeterProtocol dissector with detection of protocol for TCP, UDP and DCCP by payload inspection. 2021-02-21 13:57:04 +00:00
Martin Kaiser 0f0b340aa5 PacketList: mouseMoveEvent: fix memory leak
We allocate a QMimeData object at the beginning of PacketList::mouseMoveEvent.
Usually, this object is passed to a QDrag object by calling drag->setMimeData.
In this case, the QDrag object owns the mime data object and frees it when
it's no longer required.

If the mime data object contains no data that can be dragged and dropped, we
reach the end of PacketList::mouseMoveEvent without anyone taking care of
the mime object. We have to free it ourselves in this case.

The problem can be reproduced if you add a custom column for an element that
does not exist in your capture file. Left-click onto the empty column and
drag the empty column entry somewhere. An asan build will then show the
memory leak

Indirect leak of 240 byte(s) in 2 object(s) allocated from:
    #0 0x7f351e153d30 in operator new(unsigned long) (...)
    #1 0x7f3500b79802 in QMimeData::QMimeData() (...)

Indirect leak of 32 byte(s) in 2 object(s) allocated from:
    #0 0x7f351e153d30 in operator new(unsigned long) (...)
    #1 0x5635156dfbc7 in PacketList::mouseMoveEvent(QMouseEvent*) ...
    #2 0x7f3502eb94d7 in QWidget::event(QEvent*) (...)
2021-02-21 13:29:11 +00:00
Eugene Adell ba28616ff5 TCP: Conversations Statistics loyalty to connections initiators
Conversations Statistics suggested the connection initiator was
Address A because of an address/port comparison, when the packet
list says it was Address B. This behavior is changed then the
conversations statistics now suggest the real initiator. Exporting
data from these statistics allow a loyal re-processing.
Closes #16919.
2021-02-21 13:12:35 +00:00
Darius Davis ceb1db49d6 Fix reassemble_test's additional debug mode.
It has bit-rotted.

Replace a bunch of compile-out "#if 0" with runtime "if (0)", and the "#ifdef
debug" with a static const, both of which should reduce the chance of this
bit-rotting again in future by ensuring that these code paths will at least be
compiled -- even if they are not actively used.  The default is kept at FALSE,
so the behavior is unchanged, and toggling it still requires recompilation.

fd->data no longer exists; The nearest equivalent uses (dangerous!) tvb_get_ptr
to dump the address of the first byte of the tvb data, in case that is somehow
useful... I'm guessing it exists for live debugging.

We no longer have access to the structures for the hash keys.  For the time
being, let's just #ifdef out the code that tries to print those keys.  Maybe we
should move the key structures to an epan/reassemble-int.h so that we can
access them from this test code again...?

And zap an extra comma which snuck into a table... Clearly this code hasn't
been compiled in a while.

Tested with debug=FALSE and debug=TRUE, under Valgrind as well as natively, on
a Linux host.
2021-02-21 12:55:58 +00:00
Gerald Combs daf4e3cafe [Automatic update for 2021-02-21]
Update manuf, services enterprise numbers, translations, and other items.
2021-02-21 11:42:59 +00:00
Martin Kaiser 3ee6eb0be3 dvb-ci: afs resource: dissect file req / ack
The file request and file acknowledge APDUs of the auxiliary file system
resource are exactly the same as in the application mmi resource.

We already have a function that dissects file acknowledge. Move the
dissection of file request into a separate function as well.

Call the two functions for both ami and afs resources.
2021-02-21 10:35:41 +00:00
naf 95f3d1b075 QT ByteViewText: calculate string widths consistently to prevent clipping
For QT >5.11, stringWidth() uses horizontalAdvance, which gives different
(longer) widths than the old boundingRect().width() method.

Other locations use the boundRect().width() method directly, resulting
in underestimating line widths and clipping the last characters in
the byte view window.

Fix by forcing all width calculations to use stringWidth().
Closes #17087.
2021-02-21 10:17:07 +00:00
Martin Mathieson cd77e5aa5f Some more spelling fixes.
Also add more words to dictionary file.
2021-02-21 09:59:04 +00:00
Alex Nik bddd034186 added the description for the exporting TLS session keys dialog
applied the SME suggestions

implemented the SME suggestions

minor fix
2021-02-20 22:45:41 +00:00
John Thacker 94488fc509 macos-setup: Require Qt 5.6 or later and macOS 10.8 or later
The minimum required version of Qt is now 5.6, and thus the minimum
required version of macOS is 10.8. Reflect that in macos-setup, and
remove version checks and older packages installed to support
Snow Leopard and Lion.
2021-02-20 19:17:31 +00:00
Martin Mathieson f3bc71c44f Make some more vars and functions static. 2021-02-20 16:34:24 +00:00
João Valverde 4d793fdd7a sharkd: squelch redundant decl warnings
In file included from ../sharkd_daemon.c:31:
../wsutil/wsgetopt.h:38:21: warning: redundant redeclaration of ‘optarg’ [-Wredundant-decls]
   38 | WS_DLL_PUBLIC char *optarg;
      |                     ^~~~~~
In file included from /usr/include/bits/getopt_posix.h:27,
                 from /usr/include/unistd.h:883,
                 from ../wsutil/socket.h:33,
                 from ../sharkd_daemon.c:28:
/usr/include/bits/getopt_core.h:36:14: note: previous declaration of ‘optarg’ was here
   36 | extern char *optarg;
      |              ^~~~~~
In file included from ../sharkd_daemon.c:31:
../wsutil/wsgetopt.h:52:19: warning: redundant redeclaration of ‘optind’ [-Wredundant-decls]
   52 | WS_DLL_PUBLIC int optind;
      |                   ^~~~~~
In file included from /usr/include/bits/getopt_posix.h:27,
                 from /usr/include/unistd.h:883,
                 from ../wsutil/socket.h:33,
                 from ../sharkd_daemon.c:28:
/usr/include/bits/getopt_core.h:50:12: note: previous declaration of ‘optind’ was here
   50 | extern int optind;
      |            ^~~~~~
In file included from ../sharkd_daemon.c:31:
../wsutil/wsgetopt.h:57:19: warning: redundant redeclaration of ‘opterr’ [-Wredundant-decls]
   57 | WS_DLL_PUBLIC int opterr;
      |                   ^~~~~~
In file included from /usr/include/bits/getopt_posix.h:27,
                 from /usr/include/unistd.h:883,
                 from ../wsutil/socket.h:33,
                 from ../sharkd_daemon.c:28:
/usr/include/bits/getopt_core.h:55:12: note: previous declaration of ‘opterr’ was here
   55 | extern int opterr;
      |            ^~~~~~
In file included from ../sharkd_daemon.c:31:
../wsutil/wsgetopt.h:61:19: warning: redundant redeclaration of ‘optopt’ [-Wredundant-decls]
   61 | WS_DLL_PUBLIC int optopt;
      |                   ^~~~~~
In file included from /usr/include/bits/getopt_posix.h:27,
                 from /usr/include/unistd.h:883,
                 from ../wsutil/socket.h:33,
                 from ../sharkd_daemon.c:28:
/usr/include/bits/getopt_core.h:59:12: note: previous declaration of ‘optopt’ was here
   59 | extern int optopt;
      |            ^~~~~~
In file included from ../sharkd_daemon.c:31:
../wsutil/wsgetopt.h:131:19: warning: redundant redeclaration of ‘getopt’ [-Wredundant-decls]
  131 | WS_DLL_PUBLIC int getopt (int ___argc, char *const *___argv, const char *__shortopts)
      |                   ^~~~~~
In file included from /usr/include/bits/getopt_posix.h:27,
                 from /usr/include/unistd.h:883,
                 from ../wsutil/socket.h:33,
                 from ../sharkd_daemon.c:28:
/usr/include/bits/getopt_core.h:91:12: note: previous declaration of ‘getopt’ was here
   91 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
      |            ^~~~~~
2021-02-20 15:46:35 +00:00
Jim Young 166dcae76f sharkd_daemon: squelch unused parameter warning.
Commit 69df23fc40 refactored sharkd_loop()
making the use of argv[] dependent on the #define _WIN32. Add _U_ for
the #ifndef _WIN32 case.

Suppresses:

> [2005/2398] Building C object CMakeFiles/sharkd.dir/sharkd_daemon.c.o
> /projects/wireshark/sharkd_daemon.c:357:33: warning: unused parameter 'argv' [-Wunused-parameter]
> sharkd_loop(int argc _U_, char* argv[])
>                                 ^
> 1 warning generated.
2021-02-20 15:26:21 +00:00
John Thacker ddd8f0ab61 tests: Look for softhsm2 in more places
Fedora and RHEL/CentOS put libsofthsm2.so in a different location
than Debian/Ubuntu, so look there too. This causes test_tls_pkcs11
to pass instead of being skipped (if softhsm2 and the other
prerequisites are installed.)
2021-02-20 15:07:49 +00:00
Guy Harris 1f595c435c BER: get rid of WTAP_FILE_TYPE_SUBTYPE_BER.
Save a copy of the pathname used to open a file in the wtap structure.
This allows the BER file reader to put a pointer to it in the
pseudo-header; it also would allow file readers to attempt to read
"associated" files that have the same name as the file, but with a
different extension.

Instead of having cf_open() special-case BER files, and calling a
routine in the BER dissector to specify the file name to the dissector,
have separate dissectors for "dissect packet payload as BER" and
"dissect a file as BER", and have the latter get the pathname of the
file from the pseudo-header and determine the ASN.1 syntax from that.

(Side-effect - this means that you can now dissect a BER file, and have
the syntax be determined by the file extension, in TShark as well; the
above cf_open() special-casing was *not* done in TShark, so it didn't
work before.  Now the application code doesn't need to do any of that,
so it works in TShark as well as Wireshark.)
2021-02-20 01:36:26 -08:00
Guy Harris c80c16759b wiretap: eliminate two WTAP_FILE_TYPE_SUBTYPE_ values.
Eliminate WTAP_FILE_TYPE_SUBTYPE_ERF and
WTAP_FILE_TYPE_SUBTYPE_SYSTEMD_JOURNAL - instead, fetch the values by
name, using wtap_name_to_file_type_subtype().

This requires that wtap_init() be called before epan_init(); that's
currently the case, but put in comments to indicate why it must continue
to be the case.
2021-02-19 23:20:24 +00:00
Gerald Combs abf9e027fc Require Qt 5.6 or later.
Increase the minimum required version of Qt from 5.3 to 5.6. The various
Linux distribution versions that shipped with earlier Qt versions (RHEL
6, Fedora 23, openSUSE 13.2, Debian jessie, Ubuntu 16.04) have either
reached end of support or will do so soon.

The official Qt 5.6 releases for macOS require 10.8, so make that the
minimum macOS version.

Remove a bunch of no-longer-needed version checks.
2021-02-19 13:49:10 -08:00
Gerald Combs b620a5e535 VJC: Fixup some proto_tree_add_expert calls.
Make sure we add expert items to a valid tree. Fixes

** (process:11088): WARNING **: 17:45:42.159: Dissector bug, protocol VJC, in packet 12: "Text item" - "text" tfi->tree_type: -1 invalid (../epan/proto.c:5885)
2021-02-19 10:11:24 -08:00
David Perry 72c9b4b1e8 Add bounds checks to VJ compression [#17243]
When handling uncompressed packets:

* Add bounds checks before allocating or reading memory.
* Limit amount of memory allocated to the size of the IP header plus the
  maximum needed size of the TCP header, not entire packet contents.
* Check for IPv4 before processing.
* Use more constant macros for easier reading and review.

When handling compressed packets:

* Add bounds checks when calculating size of compression header.

General:

* Add extra comments.
* Use reported length instead of captured length for calculating
  syn+ack values (since that's what the sender would use).
2021-02-19 17:51:35 +00:00
Thomas Dreibholz 81cc0ad06c Added missing dccpservicecodes.h to epan/CMakeLists.txt. 2021-02-19 15:08:32 +01:00
Thomas Dreibholz b82d08ab18 Added IANA-assigned DCCP Service Codes.
Changes:
* Added list of IANA-assigned DCCP Service Codes.
* Added decoding of DCCP Service Codes into DCCP dissector.
2021-02-19 13:50:35 +01:00
Timmy Brolin 06a65f121f mPacket dissection improvements
* Added support for dissecting mPackets with arbitrary preamble length,
  in accordance with IEEE 802.3br-2016
  Changed fpp.preamble type from FT_UINT64 to FT_BYTES

* Allowed for capture device to signal non-integer preamble length by padding with zero.
  Added fpp.preamble.pad to indicate any alignment padding bits

* Added missing printouts of SMD types
  i.e. SMD-E, SMD-V, SMD-R, SMD-S0, ...

* Added missing printouts of decoded fragment numbers
  i.e. 0, 1, 2, 3
2021-02-19 09:53:08 +00:00
Joey Salazar a443d60b1c git: Factor out dissect_pkt_line helper
Add dissect_pkt_line helper that dissects a single pkt-line and
simplifies the pre-existing dissect_git_pdu().

A later patch will make use of this same helper for HTTP support.

Part of #17093
2021-02-19 08:46:29 +00:00
Gerald Combs 313a6e9274 CI: Don't run xcode-select.
Changing the developer directory shouldn't be necessary after the include
path fixups in 270c8ed746.
2021-02-18 13:54:47 +00:00
Adam Mitz 61d53b74c9 RTPS: update dissection of discovery PID 0x77 to match spec 2021-02-18 13:36:22 +00:00
Anders Broman 32d4af0ed9 NAS-5GS: Dissect Extended rejected NSSAI IE 2021-02-18 12:02:11 +01:00
Darius Davis a814a95007 arinc615a: Avoid calling g_str_has_suffix(NULL, ...).
Testing with tftpConversationError.pcapng attached to issue 10305 revealed this
warning on the console:

   GLib-CRITICAL **: 16:47:08.092: g_str_has_suffix: assertion 'str != NULL' failed

The cause is that the filename retrieved from the tftpinfo struct could
potentially be NULL when dissect_a615a_heur is called, for instance if the TFTP
RRQ/WRQ was not captured or not associated with the same conversation as the
DATA packet.

It's interesting that this condition arises from this capture
file... Perhaps the conversation tracking is amiss?  To be investigated.

Without knowing the filename, there appears to be no way to meaningfully
dissect the protocol beyond just dissecting just the file length and the
protocol version; For simplicity, I opted to maintain the present behavior and
have the heuristic test fail if the filename is not known.
2021-02-18 18:43:24 +10:00
Guy Harris 8b775000bc wiretap: register BUSMASTER log and candump file formats.
*Don't* use WTAP_FILE_TYPE_SUBTYPE_UNKNOWN for the file type/subtype.
2021-02-18 07:48:11 +00:00