Commit Graph

87803 Commits

Author SHA1 Message Date
Pascal Quantin 274e67998e tshark: add support for field alias when specifying a list of fields to display
The ek/pdml/json output will display the new filter name and not the
aliased older one
2023-06-13 21:49:46 +00:00
Huang Qiangxiong aa54f33700 Reassembly: make streaming reassembly support DESEGMENT_ONE_MORE_SEGMENT
Make reassemble_streaming_data_and_call_subdissector() allow subdissector
to set pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT.
2023-06-13 21:03:43 +00:00
Nardi Ivan 7839a96040 tls-utils: add some more PQ key exchange algorithms 2023-06-13 19:18:31 +00:00
John Thacker a39c9fc9b1 ieee80211: Don't access uninitialized memory
Certain types of Data frames with the To DS and From DS
bits set don't contain a BSSID address. Check for that, and
store null data in that case to the retransmission hash table.

Fix #18648.
2023-06-13 18:46:19 +00:00
Alexis La Goutte bbe409242b GRE: Add gre.subproto table for get decode as for GRE
With Data or Ethernet for the moment...
2023-06-13 17:30:23 +00:00
Gerald Combs cf1832ae14 Lua: Add a browser SSLKEYLOG launch script
Add a script that launches Chrome or Firefox with SSLKEYLOG set.
2023-06-13 17:26:49 +00:00
David Perry 80ae370811 Allow disabling unused dissectors from PHS dialog 2023-06-13 17:12:26 +00:00
John Thacker 801554fb79 Add a capture file state for a pending read
When not updating the packet list during a capture, the capture
file structure isn't set up, but there is a pending capture.

We currently treat that as "finished reading", but that means
that other code assumes that all the structures are set up and
can crash, and also don't prompt regarding unsaved packets when
trying to close Wireshark.

Add a state for FILE_READ_PENDING that sometimes should be treated
similar to FILE_CLOSED and sometimes should be treated similar to
FILE_READ_IN_PROGRESS.

This fixes a crash when enabling "update packet list during a capture"
while a capture is in progress, as well a crash when applying a filter
while a capture is in progress but real time packet list updates are
off.

Keep track of the number of packets that the capture child has reported
that haven't been read yet, so that the capture statistics stay accurate
even if the pref is toggled. Also run the main status bar statistics at
the end, so that if any packets are processed in cf_finish_tail() they
are reported.

This also restores status bar statistics for when update packet list
during a capture is off, which 461fb517d1
accidentally disabled.

Fix #4035
2023-06-13 17:09:50 +00:00
João Valverde c58705654d CMake: User a better definition for WIRESHARK_INSTALL_CMAKEDIR
Previously this was lib/wireshark/cmake. User lib/cmake/wireshark
instead. Both are standard search paths but the second is more
conventional and inline with expected package behaviour on Unix.
2023-06-13 17:05:56 +00:00
David Perry 194b578e82 Document use of pytest with external tests
It is straightforward to run Python-based tests which are outside the
Wireshark source tree.
2023-06-13 15:31:09 +00:00
John Thacker 8fa1b097db Qt: Add hint text when selecting a field in PacketDialog
Add hint text when selecting a field in a PacketDialog like
what is added to the MainStatusBar when selecting a field.
Also restore the initial information when leaving the packet
bytes region (if hover highlighting is enabled.)

Half of #18731
2023-06-13 14:51:25 +00:00
John Thacker a76b2254a2 HART-IP: Register dissectors by name
Register the HART-IP dissectors by name so that they are available
in Lua.

A case of #5612. Fix #19064
2023-06-13 08:25:18 -04:00
Maxime Meignan 017af7dcd0 RPC_NETLOGON: Fixes parsing errors in NetrServerPasswordSet2 request/reply
* First 4 parameters of NetrServerPasswordSet2 are identical from
  NetrServerAuthenticate3
* UNICODE_STRING_512 is 512 bytes long, not 512 wchar_t long
* netlogon_dissect_netrserverpasswordset2_reply parsed the AUTHENTICATOR
  incorrectly
2023-06-13 12:06:22 +00:00
Joakim Karlsson 0b1c7569f0 debian: add missing symbols 2023-06-13 12:04:56 +00:00
Stig Bjørlykke 56c53ea776 http: Add a field for Range and Content-Range 2023-06-13 11:33:50 +00:00
João Valverde 5a63a543cf Github: Fix Windows build
Replace deprecated and now removed 'cinst' command.
2023-06-13 10:55:04 +00:00
João Valverde 6bf84fe876 CMake: Fix Lua52 URL 2023-06-13 11:36:17 +01:00
Roman-Koshelev 3bc885f746 TURN: Remove dead code 2023-06-13 06:39:24 +00:00
John Thacker e2da052757 wiretap: Don't close an already closed file descriptor
Don't try to close a file descriptor that's invalid (because
it's already been closed.)

Fix #18679.
2023-06-12 23:02:12 -04:00
Johnathan Raymond a605d7ac8c Revert sharkd newline processing changes
This reverts commits:
    812f40e470,
    6522999276,
    c9e91d7290

The changes merged as part of !6493 prevent the sharkd command from
processing either until the input buffer is full or the client sends an
EOF, by convention closing the connection. This renders sharkd unusable
for most applications.

The intended behavior from #17823 is to parse character by character
until a matching set of braces (`{}`) is detected. Until that behavior
can be implemented, reverting to the prior behavior.
2023-06-12 16:41:08 -07:00
Danielle Church 1fea6aaf7a Fix lua FieldInfo sort ordering
Left and right were swapped in the __le and __lt functions, fixed.
Also, since start+length points to the byte *after* the end of the
field, changed the operator in __lt to a <= instead of a <.

This is technically a breaking change, but it does bring the behavior
into line with the documentation.
2023-06-12 23:07:31 +00:00
Trevor Bergeron afff4e026d Lua: DNS: Fix Fields for multi-question queries
`my_field().display` uses the first FieldInfo in the multival, so all
question trees would display the type and class from the first question.

Queries with more than one question aren't used on the modern internet,
but let's handle it correctly anyway in the example code.
2023-06-12 22:53:46 +00:00
Trevor Bergeron ce476f79b4 Lua: Fix root zone queries in DNS example
Queries for the root zone (e.g. `dig -t NS`) produce a name of only `\x00`,
which would cause the query parser to fail.
2023-06-12 22:53:46 +00:00
Nan Xiao 15013ab136 RTP Analysis:Fix nominal and arrival times calculation
Previously, the nominal and arrival times are calculated based on first packet
in the RTP stream, but there is a corner case: if the stream codec changes in the
middle, e.g., from AMR-WB to AMR, the nominal time will be calculated using the
current codec frequency, and it is not correct and will affect diff and jitter.

This fix will calculate nominal and arrival times based on previous in-sequence
RTP packet.
2023-06-12 22:20:30 +00:00
Hiddencodes Sec 3c944de9df Fix SMB1 SMB_COM_SESSION_SETUP_ANDX (0x73) parsing failure. 2023-06-12 21:31:27 +00:00
Huang Qiangxiong cd3275c1b5 Reassembly: add helper macros
Add REASSEMBLE_ITEMS_DEFINE, REASSEMBLE_INIT_HF_ITEMS
 and REASSEMBLE_INIT_ETT_ITEMS helper macros to define and
 initialize hf and ett items of reassembly much easier.

Make packet-http.c to use these macros.
2023-06-12 21:22:04 +00:00
Chuck Craft d7eedba8e2 editcap: if verbose print Total selected for output
Ours is not to reason why...
https://ask.wireshark.org/question/27919/
Allow user to create an empty output file but remind them that is
what they asked for.
2023-06-12 21:05:25 +00:00
kirstenv 6a8bdf192c E212: switch MCC and MNC fields from uint to string
Storing MCC and MNC as uint can cause loss of info when they are prefixed with 0's.
E.G. MNC=007 or MNC=01 (Prefixed 0's are lost). Storing them as a string fixes this.

Fixes #19114
2023-06-12 18:17:03 +00:00
Pascal Quantin 52e8c21924 JSON 3GPP: fix a typo in hf name 2023-06-12 17:40:41 +00:00
Gerald Combs 591f89d785 Add a script to convert GLib types to their C equivalents
Convert wsutil/802_11-utils.[ch] as a test.

Update some of our documentation.

Ping #19116
2023-06-12 17:32:56 +00:00
Nicolás Alvarez 0f71aa256c Remove unnecessary null check in SequenceDialog
SequenceDialog::diagramClicked is checking whether the 'event' argument is
null, but later it dereferences 'event' outside the conditional, so if it
was null it would crash anyway. It doesn't seem possible for the event
argument to actually be null, so this commit removes the redundant check
here and in mouseMoved. I'm also adding an assert to document the non-null
assumption.

Bug found by clang static analyzer.

Fixes #17426.
2023-06-12 17:24:31 +00:00
Gerald Combs 7c04f38022 CMake+Windows: Use "x64" instead of "win64"
Use "x64" to refer to "Windows running on 64-bit Intel processors". Get
rid of WIRESHARK_TARGET_PROCESSOR_ARCHITECTURE in favor of
WIRESHARK_TARGET_PLATFORM because the latter is shorter.
2023-06-12 17:18:05 +00:00
John Thacker e0f1f8dbf3 TLS: Fix TLS tunneled within TLS
In order to retrieve the correct set of TLS information, previously
pinfo->curr_layer_num was used. However, this is not a stable
identifier between the first and later passes, as subdissectors that
couldn't dissect data due to fragmentation on the first pass aren't
called on later passes.

To fix issue #16109, the layer number wasn't used at all, which did
break TLS over TLS.

We now have pinfo->curr_proto_layer_num which specifically counts
the number of layers of the current protocol instead of the total
number of layers; using that instead fixes TLS within TLS (in most
situations; some very rare cases, e.g. DVB baseband frames with
multiple TCP PDUs, which might be from the same or from different
TCP connections, might not work, but those don't work currently either)
while not reopening #16109.

Add tests for both cases, the one fixed by the other workaround and
for TLS over TLS.

As noted in the comments to #16109, there are other dissectors that
use curr_layer_num that might break in some cases because it's not stable.

Fix #17977.
2023-06-12 17:09:09 +00:00
Joakim Karlsson 001930e1e5 file: fix might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] 2023-06-12 17:03:11 +00:00
Stig Bjørlykke 97ae7cdf2f Qt: Position selected packet at center
Position selected packet at center after setCurrentIndex() when
Go To Packet, after redissect packets and after moving column.

This is better than position at bottom in most cases.
2023-06-12 17:00:46 +00:00
Ismael Mendez Matamoros 3b6164918c RTPS: Change the description of SRTPS Prefix Vendor-Specific Content flag
The description of new SRTPS Prefix flag (0x80) currently says
Transport-Specific Message. In the process of standardization,
this use case broadened and it must be reflected in the flag’s
name. The new description of the flag is Vendor-Specific Content.
2023-06-12 16:59:14 +00:00
Pascal Quantin edaece6aa8 JSON 3GPP: use http2_get_header_value() to fetch HTTP2 path 2023-06-12 18:11:54 +02:00
João Valverde 7f0874b1f9 MSYS2: Use Lua 5.2 and update documentation 2023-06-12 15:21:48 +01:00
João Valverde f21288593e WSDG: Move a line to the proper place 2023-06-12 15:15:30 +01:00
João Valverde ae87a9983a WSDG: Add cross-compilation instructions for Arch Linux 2023-06-12 14:52:44 +01:00
Hiddencodes Sec 7837cec8f4 Use dataoffset in SMB_Parameter to access the data in SMB_COM_WRITE_ANDX 2023-06-12 11:57:24 +00:00
Albert Chuang 877a1e1120 ieee80211: Add EHT Trigger frame dissector and add new fields in some elements 2023-06-12 10:33:02 +00:00
João Valverde 5cf217a44a CMake: Improve repository configuration 2023-06-12 08:42:25 +00:00
João Valverde 04fe30ade7 CMake: Fix Qt configuration
Fixes f8f85cb9ad.
2023-06-12 08:41:50 +00:00
João Valverde 053e691931 mingw-rpm-setup: Add cmake
[skip ci]
2023-06-12 09:32:53 +01:00
João Valverde a8ccf08aa7 mingw-rpm-setup: Install git and patch 2023-06-12 08:41:51 +01:00
João Valverde a6b7a7c4a3 Gitlab CI: Enable FETCH_lua for MinGW-w64 builds
Download and build Lua with the MinGW-w64 job. Use a mirror
link to avoid taxing the upstream FTP server.
2023-06-12 06:35:59 +00:00
João Valverde 687b24d5b3 CMake: Add option to download and build Lua
This adds a FETCH_lua CMake option to download and build a static
lua library as part of Wireshark's build, using CMake's
ExternalProject.

This is useful to avoid having to add a MinGW Lua 5.2 binary package
for every distribution one might want to support for cross-compilation,
for an easy to build project like Lua that was designed specifically
for embedding.

This is opt-in and should be useful for every platform where Lua 5.2
is not packaged (and there are many).

Tested using Arch Linux with cross and non-cross builds using GCC.
2023-06-12 06:35:59 +00:00
John Thacker bb9e66aea7 Qt: Fix PacketDialog secondary data sources crash after closing file
The first data source tvb associated with a packet is always freed,
along with its data, at the same time as the associated pinfo->pool
scoped data and the tree, if any, in epan_dissect_cleanup() or
epan_dissect_reset().

Not so for secondary data sources; while the vast majority of data
source tvbs are chained to the first data source and so also freed
at the same time, and almost all of the others are never freed and
just leak (sometimes because of an exception before being set as a
child), it's not uncommon to have a tvb whose real data is at file
scope, with the assumption that this will outlive any packet scope.
(Note that the real data is not copied, for speed and memory usage.)

This is, for example, how epan/reassemble.c works, with the data
freed when a file is closed (although it is not managed by wmem.)

When a PacketDialog persists after the capture file closes, this
assumption is falsified. As we do not have a perfect way to detect
the scope of the real data (we could introduce a function to check
if the free_cb is NULL, which would be suggestive but not absolute),
deep copy the data for secondary data sources when the parent
PacketDialog indicates that the capture file is about to close.
Also, avoid calling API functions thacker examine the real data.
Looking at the offsets is OK, as proto_find_field_from_offset() does.

While it could be possible to clone the data source tvbs located in
edt->pi.data_src, the pointers would need to be updated in each of
the field_infos in the edt's tree as well.

Currently no dissectors (or other code) attach data source tvbs where
the tvb itself, not just the real data, is freed with a file is closed.
If they did, that could still cause a crash.

Fix #14363
2023-06-11 23:54:23 +00:00
Gerald Combs fedcf129fc CMake: Update a sanity check 2023-06-11 16:31:50 -07:00