Commit Graph

82722 Commits

Author SHA1 Message Date
João Valverde f5d8d9e306 wmem: Use better names in the API 2021-11-27 19:39:27 +00:00
João Valverde fbfb4959ae dfilter: Better representation for charconst 2021-11-27 18:38:22 +00:00
John Thacker c595ecfc28 tvbuff: Use iso8601_to_nstime
Have tvb_get_string_time use iso8601_to_nstime for
ENC_ISO_8601_DATE_TIME (which seems to be the only time in a string
encoding any built in dissector actually uses, in syslog). It is
strictly superior; among other things it handles fractional seconds.

Also, tvbuff.c does not use strptime, so remove that include.
2021-11-27 17:49:49 +00:00
João Valverde 352390aa97 dfilter: Need to handle a charconst on the LHS 2021-11-27 17:19:11 +00:00
João Valverde 01a95db9b7 epan: Add binary search to introspection API 2021-11-27 14:31:53 +00:00
João Valverde f4f9bf1d9e epan: Add ipproto.h to instrospection enums 2021-11-27 12:54:32 +00:00
João Valverde c15f2aadc1 epan: Initialize wiretap
Clients of libwireshark should not be required to initialize
explicitly wiretap, if they don't use it themselves.
2021-11-27 08:41:01 +00:00
John Thacker ba85d8ef4d wustil: Fix timezone handling in iso8601_to_nstime
Convert the tm struct to nstime first, then apply the timezone
offset, because applying the offset to the hours and minutes fields
directly can require carrying or borrowing in base 24 and 60 arithmetic.
2021-11-26 22:07:11 -05:00
John Thacker 9413658b7c wsutil: Clarify NT epoch explanation in comment 2021-11-27 00:53:38 +00:00
João Valverde 6fab4cbeff epan: Add introspection API to export some constants
C is notoriously difficult to bind from other languages
without additional metadata. The C ABI does not include
enums and macros that are an essential component of the
API.

To make Wireshark instrospectable and more binding friendly
include an introspection API to export enums and integer macros.

To avoid the tedious need to manually keep the code up to date
it uses the excellent pyclibrary python package to automatically
parse C headers and extract this data.

This is not a process that should be done automatically during
the build.

This could be used for example to replace most of the wslua
make-init-lua.pl perl script, which tries to do the same thing
using regular expressions.

Besides the downside of using Perl using regular expressions
is inferior to pyclibrary in 2 ways: 1) pyclibrary understands
most of C99 grammar so it is much more powerful; 2) pyclibrary
has a specific API to extract "values" (enums and constants)
automagically. We just need to take care to use only integer
values, for our purposes.
2021-11-26 20:38:42 +00:00
John Thacker 80ebcc90bc RTMPT: Fix infinite loops harder.
Just break out of this loop if we wraparound sequence numbers in
the middle of a segment. That guarantees that the sequence of lookups
in the tree with _le will terminate at some point. This probably
makes the dissection a little worse in a few cases with sequence
number wrap around but non erroneous sequence numbers, so a more
complete fix would be ideal. Fix #17749, at least the infinite loop.
2021-11-26 13:36:26 -05:00
Huang Qiangxiong 2af95cbe1b HTTP2/GRPC: support using fake headers if first HEADERS frame is missing
Add an UAT for configuring fake headers according to the server port, stream
id and direction of the long-lived stream that we start capturing packets
after it is established. That helps to parsing the DATAs captured subsequently.
A testcase also added.

close #17691
2021-11-26 17:34:23 +00:00
Paul Tyler 9f56c07638 RTPS: Dissect PID_DEFAULT_MULTICAST_LOCATOR for vendors other than RTI 2021-11-26 17:31:34 +00:00
Joerg Mayer 3594a05ba7 CMakeLists.txt: Fix enabling the use of C++ 2017 with MSVC 2021-11-26 14:42:47 +01:00
Stig Bjørlykke 11c6ed177f at: Fix typo in cme_error_vals
Also remove a leading space in at_type_vals.
2021-11-26 13:22:04 +00:00
John Thacker 9da9c4e388 wsutil: Prevent buffer overflow in iso8601_to_nstime
Don't blindly examine the fifth byte in the input string without testing
earlier bytes.  Instead, process the year by hand before calling sscanf.

ISO 8601 times don't switch between Basic and Extended format in the
middle, so for the later possible buffer overflows just use the
previously determined format.
2021-11-26 13:06:27 +00:00
John Thacker a839ee1c2b wmem: Fix filename in header comment
If the name is going to be in the header, might as well spell it
correctly
2021-11-26 07:46:11 -05:00
Moshe Kaplan b031a2a470 wsar: Document prefs.h
Add @file to prefs.h so it's included
by Doxygen. Then documented the associated
functions.
2021-11-26 09:40:22 +00:00
Pascal Quantin bc566318bc Websocket: do not register proto_reg_handoff_websocket() for preference change
It is not required and fixes a "Protocol Websocket is already registered
in tcp table" warning at startup
2021-11-26 09:25:35 +00:00
Tomasz Moń e51a0cb4f4 Qt: Use QRegularExpression instead of QRegExp
Qt5 recommended to use QRegularExpression instead of QRegExp.
Qt6 deprecated QRegExp and provides it in Qt5 compatibility module.

QRegularExpression is generally faster and safer to use as the results
are returned in separate QRegularExpressionMatch instead of modifying
interal QRegExp object state.
2021-11-26 09:10:42 +00:00
Gerald Combs 0385e7448a Tools: Add our branch name to fuzz error reports. 2021-11-25 11:41:12 -08:00
Nardi Ivan 4e879c5d16 QUIC: add support for QUICv2 (draft-00)
See: https://datatracker.ietf.org/doc/html/draft-ietf-quic-v2
2021-11-25 16:47:59 +01:00
Paul Aurich 5d12847fc7 debian: libwiretap-dev headers require libwsutil-dev headers
The headers in the libwiretap-dev package require headers from the
libwsutil-dev package, so ensure they're installed.
2021-11-25 08:21:54 +00:00
John Thacker 32bb2a19ee RTMPT: Fix infinite loop
The RTMPT dissector when over TCP reuses the TCP sequence numbers, so
it needs to consider wraparound, which can occur both with the
tcp.relative_sequence_numbers preference set to FALSE, or in some
unusual cases (such as a SYN packet with a bogus sequence number so
that later packets overlap its sequence number.)

Change a sequence number comparison to use the wrap around aware
macros from packet-tcp.h Fix #17745.
2021-11-24 08:44:08 -05:00
João Valverde 9dd770fd64 Clean up PCRE2 version info 2021-11-24 12:58:39 +00:00
João Valverde 702c7f0cc8 Remove stale comment. 2021-11-24 10:45:42 +00:00
Joerg Mayer 5bb7e1606b Fix some of the compile errors when compiling with Qt6
This is basically applying c knowledge and Google to the compiler
error messages. There is basically no understanding involved into
what I was doing:
- No idea why lots of #includes needed to be added for Qt6
- No idea how to actually fix the remaining problems, but it's a start

Things that need to be done:
- The AudioDeviceInfo thingy needs to be replaced by something new (as
  an interim solution another patch disables the audio player in Qt6).
- GRegExp eventually needs to be replaced by QRegularExpression
  (available since Qt5.0, so development can be done in Qt5).
- Solutions for the other problems like some methods no longer
  being available in Qt6 that have to sort of co-exist with Qt5.
2021-11-24 10:31:16 +00:00
Joerg Mayer fe01f0109d Readd feature to make QtXMultimedia optional again
In order to be able to defer solving all Qt6 API differences at once
I tried to reactivate the QT_MULTIMEDIA_LIB feature. I managed to fix
most problems but one problem remains in both Qt5 and Qt6 builds.
Without Qt[56]Multimedia, the following error exceeds my non-existing
C++ knowledge:

jmayer/work/wireshark/git/ui/qt/rtp_player_dialog.cpp:154:18: error: out-of-line definition of 'RtpPlayerDialog' does not match any declaration in 'RtpPlayerDialog'
RtpPlayerDialog::RtpPlayerDialog(QWidget &parent, CaptureFile &cf, bool capture_running) :
                 ^~~~~~~~~~~~~~~
2021-11-24 10:31:16 +00:00
Joerg Mayer 24a364f762 Get CMake to successfully work with Qt6
Of course it still fails in the compile phase, but only for some
of the ui/qt/ files.

Wireshark with Qt5 still compiles and runs.

To do the build invoke cmake with the following settings added:
export CMAKE_PREFIX_PATH=:${MY_QT6_PREFIX}/lib/cmake
cmake -DUSE_qt6=ON ...

Independently of this patch there is lots of Qt-stuff in
CMakeLists.txt that needs review/cleanup:
- Some of the stuff can probably be solved in a less hacky way:
  + There seemed to be a way for QT6 to provide the required c++-standard,
    but in the end I could not find it.
  + Once we have a working Qt6 codebase, we may get rid of the USE_qt6
    flag and just test for Qt6Core first and if not present check for
    Qt5Core.
- All comments that match /qt ?[4-6]/i need reviewing/cleaning up.
- The changes in this patch have been tested to work on all machines
  that are my mac (macos 12.0.1, XCode 13.1, Intel, GPL-Qt6.2.1 with only
  the macos package selected, cmake 3.21.4)

Add ui/qt/qt6-migration-links.txt for some possibly helpful links
2021-11-24 10:31:16 +00:00
João Valverde 35ad2e85c8 dfilter: Free a scanner string 2021-11-24 10:06:19 +00:00
João Valverde eb8c3169e7 dfilter: Clean up charconst error message 2021-11-24 09:38:58 +00:00
João Valverde 943c282009 dfilter: Parse character constants in lexer
Invalid character constants should be handled in the lexical scanner.

Todo: See if some code could be shared to parse double quoted strings.

It also fixes some unintuitive type coercions to string. Character
constants should be treated as characters, or maybe integers, or
maybe even throw an invalid comparison error, but coverting to a
literal string or byte array is surprising and not particularly
useful:
  '\xFF' -> "'\xFF'" (equals)
  '\xFF' -> "FF"     (contains)

Before:

    Filter: http.request.method contains "\x63"

    Constants:
    00000 PUT_FVALUE	"c" <FT_STRING> -> reg#1
    (...)

    Filter: http.request.method contains '\x63'

    Constants:
    00000 PUT_FVALUE	"63" <FT_STRING> -> reg#1
    (...)

    Filter: http.request.method == "\x63"

    Constants:
    00000 PUT_FVALUE	"c" <FT_STRING> -> reg#1
    (...)

    Filter: http.request.method == '\x63'

    Constants:
    00000 PUT_FVALUE	"'\\x63'" <FT_STRING> -> reg#1
    (...)

After:

    Filter: http.request.method contains '\x63'

    Constants:
    00000 PUT_FVALUE	"c" <FT_STRING> -> reg#1
    (...)

    Filter: http.request.method == '\x63'

    Constants:
    00000 PUT_FVALUE	"c" <FT_STRING> -> reg#1
    (...)
2021-11-24 08:40:20 +00:00
Dr. Lars Völker 18d7afa711 MKA: Fixing misleading capability value-strings (Bugfix)
The original MACsec capability value strings do not reflect the
IEEE 802.1X specification (2010 or 2020).

For example: IEEE 802.1X says for value 2:
"‘Integrity without confidentiality’ and ‘Integrity and
confidentiality’ with a confidentiality offset of 0"

The packet-mka.c value string for 2 says:
"MACsec Integrity with no confidentiality offset"

The updated value string now shows that integrity and
integrity+confidentiality are supported.
2021-11-24 08:13:29 +00:00
Uli Heilmeier 8d03eae346 OS Version Info: Update Windows 10/11 2016/2019
Windows Server 2016 and 2019 have both dwMajorVersion==10 and dwMinorVersion==0
It seems this is the same for Windows 10 and Windows 11.

See also https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_osversioninfoexw

As we don't know if we running on 10 or 11, 2016 or 2019 we should report
both OS names.
2021-11-24 07:36:16 +00:00
John Thacker fd1c9b75ba doc: Update stats_tree README
Update README.stats_tree including the sample implementation for
changes in the API, such as the enum return value and needing to
set the node datatype as either int or float.

Also update the comments in the stats_tree header to make it clear
that abbrev and name refer to the abbreviation used in the tshark -z
option, and the name of the menu and window in the GUI for the stats
tree.
2021-11-23 22:20:16 -05:00
João Valverde 7028646f9e dfilter: Fix invalid character constant error message
This reverts commit d635ff4933.

A charconst cannot be a value string, for that reason it is not
redundant with unparsed.

Maybe character constants should be parsed in the lexical scanner
instead.

Before:
  Filter: ip.proto == '\g'
  dftest: "'\g'" cannot be found among the possible values for ip.proto.

After:
  Filter: ip.proto == '\g'
  dftest: "'\g'" isn't a valid character constant.
2021-11-23 17:35:40 +00:00
João Valverde b657396d44 plugins.example: Add missing header
Fixes 9bdccce574.
2021-11-23 17:16:27 +00:00
João Valverde 72c5efea1b dfilter: Reject invalid character escape sequences
For double quoted strings. This is consistent with single quote
character constants and the C standard. It also avoids common
mistakes where the superfluous backslash is silently suppressed.
2021-11-23 16:48:02 +00:00
João Valverde bbaa144b3c dfilter: Remove reference to GRegex 2021-11-23 14:08:06 +00:00
Nan Xiao 8883788423 EVS: Fix bug in decoding LP-CNG SID BW value 2021-11-22 11:53:06 +00:00
Joerg Mayer 769be50d76 Remove last remnants of Qt5MacExtras
MacExtras has been both obsoleted by Qt5 and unused by Wireshark code.
https://doc.qt.io/qt-5/qtmac-obsolete.html
2021-11-22 09:31:23 +00:00
Dr. Lars Völker 56d100d6ea MKA: Adding Announcement TLV parsing and Cipher Suite
This patch adds support to parse the Announcement TLV in MKA and the
Cipher Suite announcement within it.
2021-11-21 20:18:56 +01:00
Gerald Combs 730a4c0b85 Docs: Update our supported macOS version information. 2021-11-21 18:36:57 +00:00
Uli Heilmeier 3c73fa5d55 Revert "tests: fix test fails on Ubuntu, fix #17730"
This reverts commit 78067deb89.
Commit d5ba1fe2 unsets XDG_CONFIG_HOME when setting up the environment.

Related to #17730
2021-11-21 17:47:32 +00:00
Gerald Combs 92045d98c0 [Automatic update for 2021-11-21]
Update manuf, services enterprise numbers, translations, and other items.
2021-11-21 16:24:28 +00:00
John Thacker ca71d1624c gryphon: Create pkt_info if it doesn't exist
Try to retrieve the per packet info data first, and create it if
it doesn't exist, rather than assuming it is there on the second
pass. Prevents segfaults in cases with strange TCP sequence issues
(that still show up as bugs in the TCP dissector.) Fix #17737.
2021-11-21 09:23:07 -05:00
Dr. Lars Völker abf9ed5f11 MKA: Adding support for Announcement TLV padding (Bugfix) 2021-11-21 14:04:41 +00:00
John Thacker b5917d0182 wmem: Add a multimap
A number of protocols have IDs that can be reused that are used as
lookup keys. In most cases the frame number should be used as well
to differentiate repeat appearances of an ID. For response/request
matching, it is frequently useful to find the most recent frame number
(greatest value less than or equal to the current one) that contained
an ID.

We can achieve that by using a multimap that stores values with a given
ID in a tree keyed with the frame number. This works better than using
a map or a tree alone:

1) A map isn't ordered, so doesn't allow for less than or equal comparison.
2) Using a tree requires an ordering on all the ID components, and then
   having to test all the components other than the frame number separately
   for equality after retrieval.

Currently the multimap does not support inserting items without specifying
the tree key (and having the multimap generate a key), because the total
capacity of trees (including deleted nodes) is not tracked. If other use
cases are needed, this could be added later along with more generic
multimap support.

Use a multimap in ANSI MAP, ANSI TCAP, and GSM SMS, all of which need to
match lookup IDs that can be reused. Fix #7653.
2021-11-21 07:16:55 -05:00
Gerald Combs e2703507c2 Update a bunch of GLib documentation links.
Change our developer.gnome.org/glib URLs to
developer-old.gnome.org/glib. The official documentation for GLib
appears to be at https://docs.gtk.org/glib/, but it has a different
layout than the gnome.org content (and is surprisingly resistant to
exploration IMHO). We can switch to developer-old.gnome.org using a
simple substitution and it still seems to be updated, so do that for
now.
2021-11-20 21:33:17 +00:00
Stig Bjørlykke a8643ab254 Qt: Fix column validation in columnString()
The column parameter in PacketListRecord::columnString() must be
below cap_file->cinfo.num_cols to be valid. An issue with this check
may be triggered when switching profile.
2021-11-20 17:22:33 +00:00