Commit Graph

86725 Commits

Author SHA1 Message Date
João Valverde a66b5080c3 Make wmem and wsutil a single logical library
We want to do more sophisticated processing of UTF-8 in wmem and
for that we want to use the unicode utility functions in wsutil.

We also want to use wmem scoped memory in wsutil unicode utility
functions.

This introduces a circular dependency. Fix that by making both
the same library and removing the sanitary cordon separating
them.

We still need to be mindful of public header  depencies of wmem on
wsutil because wmem.h is included in wireshark.h and we want to
be parsimonious with the use of global includes.
2023-02-08 11:21:19 +00:00
ismaelrti 53d51d1421 RTPS: Clean diplicated entity_kind_vals value
Removed incorrect value ENTITYID_OBJECT_NORMAL_META_CST_READER in
entity_kind_vals value_string
2023-02-08 11:15:39 +01:00
Donatas Abraitis 525161bb59 Add BGP Software Version Capability decoding
GoBGP, FRRouting, and Flockd already have this draft implemented.

https://datatracker.ietf.org/doc/html/draft-abraitis-bgp-version-capability

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-08 07:19:11 +00:00
João Valverde 84f963dfa2 Move ui/version_info.[ch] to wsutil 2023-02-07 23:17:37 +00:00
Gerald Combs 3e07c0dc01 macOS: Forget our ChmodBPF package when uninstalling
Add `pkgutil --forget org.wireshark.ChmodBPF.pkg` to the "Uninstall
ChmodBPF" postinstall script. The `pkgutil` man page says

    --forget package-id
        Discard all receipt data about package-id, but do not touch the
        installed files.  DO NOT use this command from an installer package
        script to fix broken package design.

but Homebrew's Wireshark cask does this, and it should help to work
around issue #18734.

Add `pkgutil --forget org.wireshark.path_helper.pkg` to the "Remove
Wireshark from the system path" postinstall script.
2023-02-07 21:24:34 +00:00
David Perry 71a77a4a5d Correct function signatures for buffer functions 2023-02-07 19:52:37 +00:00
John Thacker 4818778df2 tshark: Preserve options when dissecting packets and writing
epan_dissect_run_* and epan_dissect_reset unreference the packet
block that is part of the record, which frees it if the ref count
drops to zero. However, tshark needs the block later to, e.g.,
copy the options. process_cap_file_[single|second]_pass still
unreference and free the block with wtap_rec_reset() at the end
of each packet loop.

Fix #18693
2023-02-07 18:27:12 +00:00
David Perry c01f860867 Update comments in `wiretap/file_access.c` 2023-02-07 18:24:28 +00:00
John Thacker ca230a59e0 wiretap, pcapng: Distinguish WTAP_ENCAP_UNKNOWN and _NONE
WTAP_ENCAP_UNKNOWN is used for two different cases:
1. Encapsulation type values that are unsupported by libwiretap or
bogus values (and thus "unknown" to libwiretap).

2. An initial state where the encapsulation type is "not yet" known
for a file type like pcapng without a single encapsulation type in the
header, before any packets or interfaces that set the encapsulation type
have been read. (If the file has no packets, this may be the value after
the file is entirely read in.) This can be the value when an output file
is written out simultaneously with reading an input file, rather than
reading the entire input file first, and, e.g., there is a custom block
before any IDBs.

The first case can never be handled when writing out a file, but the
second case can possibly be handled, so long as (for pcapng) IDBs
are available to write when they become necessary, or (for file
types like pcap with a single link-layer type in the header) the
writer waits until a link-layer type is seen to create the output
header. (It is possible, of course, that writing would fail in the
middle if an unsupported encapsulation type appears, or if the
encapsulation becomes per-packet for file types that don't support that,
but that is an unavoidable risk when writing without reading the entire
input file(s).)

Introduce WTAP_ENCAP_NONE for the second case, and use it for pcapng,
where we guarantee that any necessary IDBs will be passed along.
Continue to use WTAP_ENCAP_UNKNOWN for the first case.

Allow pcapng files to open a file for writing with WTAP_ENCAP_NONE.

There are some other file types that support per-packet link-types,
and could also use WTAP_ENCAP_NONE, but they require more work to
generate IDBs. (Note that all of them currently are impossible to
write to pcapng when they have multiple encapsulations, even if
the encapsulations are all supported by pcapng, because they don't
properly generate IDBs.)

Remove the workaround in ef43fd48b4
for tshark writing to pcapng when the source file is WTAP_ENCAP_UNKNOWN,
since now such files will be WTAP_ENCAP_NONE and work properly (and
also work in editcap, mergcap, etc.)

Along with 8cddc32d35, fix #18449.
2023-02-07 13:33:20 +00:00
John Thacker e8db896c62 PROFINET: Add strings with proto_tree_add_item
Add strings with proto_tree_add_item instead of tvb_memcpy,
appending a null, and a proto_tree_add_string so that the
strings are validated for encoding, trailing nulls, etc.

Fix #18847
2023-02-07 07:20:27 -05:00
João Valverde c62aa67d2c Move ui/exit_codes.h to include/ 2023-02-07 10:12:08 +00:00
Dr. Lars Völker 25cf3e2e98 TECMP: Improve usability of lifecycle field
This patch adds more human readable information for the lifecycle field.
2023-02-07 06:51:06 +00:00
Gerald Combs e1db561aa2 macOS: Fixup our signature identifiers
Pass a prefix to `codesign` so that our signature identifier is
"org.wireshark.foo" instead of "foo" for our command line utilities,
libraries, and ChmodBPF.
2023-02-07 01:43:13 +00:00
John Thacker fd183cb40b Qt: Add ability to cancel sorting
Add the ability to cancel sorting. Since we now parse user inputs
during the sort, test and set the capture file read lock. Try to
sort in PacketList::captureFileReadFinished, since now sorting during
thawing won't happen if it's in the middle of a rescan.

Fix #17640
2023-02-07 00:03:24 +00:00
Jan Romann 252e667218 CoAP: update Observe option doc comment 2023-02-06 20:47:12 +00:00
Jan Romann be591c150a CoAP: add support for additional options 2023-02-06 20:47:12 +00:00
João Valverde 7c156d9ac4 Add a #define HAVE_MSYSTEM and use it
In certain situations using __MINGW64__ is not correct.
We want to have the condition apply using MinGW-w64 but also
using MSYS2, which the __MINGW64__ condition alone does not
capture.

Add a HAVE_MSYSTEM C define and use it where appropriate.
2023-02-06 19:39:33 +00:00
João Valverde 66bd99f1a8 wsutil/filesystem: Fix potential memory leak
We now use the 'install_prefix' variable on multiple platforms,
not just MSYS2.
2023-02-06 19:39:33 +00:00
João Valverde d9353d1684 Fix MSYS2 build
Fix:

```
FAILED: run/extcap/randpktdump.exe
cmd.exe /C "cd . && D:\a\_temp\msys64\ucrt64\bin\gcc.exe -fvisibility=hidden  -Wall -Wextra -Wpointer-arith -Wformat-security -fno-strict-overflow -fexcess-precision=fast -Wvla -Wattributes -Wpragmas -Wredundant-decls -Wunreachable-code -Wlogical-op -Wno-error=stringop-overflow= -Wno-error=deprecated-declarations -Wframe-larger-than=32768 -Wno-format-truncation -fdiagnostics-color=always -Wshadow -Wold-style-definition -Wstrict-prototypes -Wno-pointer-sign -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fmacro-prefix-map=D:/a/wireshark/wireshark/build/src/wireshark/= -fmacro-prefix-map=D:/a/wireshark/wireshark/build/src/build-UCRT64/= -O3 -DNDEBUG -pipe     -Wl,--as-needed  -municode CMakeFiles/cli_main.dir/cli_main.c.obj extcap/CMakeFiles/extcap-base.dir/extcap-base.c.obj extcap/CMakeFiles/randpktdump.dir/randpktdump.c.obj extcap/CMakeFiles/randpktdump.dir/__/resources/randpktdump.rc.obj -o run\extcap\randpktdump.exe -Wl,--out-implib,run\librandpktdump.dll.a -Wl,--major-image-version,0,--minor-image-version,0  run/librandpkt_core.a  run/libwiretap.dll.a  -lws2_32  run/libui.a  run/libwsutil.dll.a  D:/a/_temp/msys64/ucrt64/lib/libglib-2.0.dll.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:/a/_temp/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: run/libui.a(failure_message.c.obj):failure_messag:(.text+0x129): undefined reference to `__imp_wtap_strerror'
```

After this change:

```
[2177/2600] Linking C executable run/dumpcap
Warning: Unused direct dependencies:
	/usr/lib/libnl-route-3.so.200
	/home/jpv/code/wireshark/devel/build/run/libwiretap.so.0
```
2023-02-06 19:35:43 +00:00
j.novak@netsystem.cz 0c0f731c92 extcap: Fix of handling default values 2023-02-06 18:29:25 +00:00
João Valverde 02238edf92 Do not require using wsgcrypt.h
The reason to use wsgcrypt.h was to wrap it around DIAG_OFF()
macros and that should no longer be necessary.
2023-02-06 15:52:10 +00:00
João Valverde 71cfbd81b3 Remove wspcap.h and use config.h instead
Forcing the use of a dedicated header to replace pcap.h is
unnecessary code and mental overhead in this case. We can
use config.h instead for the same purpose of defining a
macro symbol before including pcap.h.
2023-02-06 15:05:36 +00:00
João Valverde ab0d190450 CMake: Fix libnl unused link dependencies 2023-02-06 15:04:46 +00:00
João Valverde d70e174ca0 Remove wsutil/netlink.h workaround 2023-02-06 15:04:46 +00:00
João Valverde b07ab25a1c CMake: Cleanup unnecessary linking with shared libraries 2023-02-06 15:04:46 +00:00
João Valverde 2855c8ec46 Convert unicode-utils.[ch] to 4-space indentation 2023-02-06 15:03:49 +00:00
João Valverde 7a33d04056 wiretap: Fix pcapng UTF-8 validation
g_utf_8_make_valid() replaces embedded NULs with unicode
replacement characters and this behaviour does not match
the pcapng spec; the first NULL should terminate the string
instead.

Use ws_utf8_make_valid() which provides the correct behaviour.
2023-02-06 15:03:49 +00:00
João Valverde 9feb85ce4d Move get_utf_8_string() to wsutil 2023-02-06 15:03:49 +00:00
David Perry 9b797e97a2 generate-dissector.py: allow creating plugin
Tweak the script used for creating a new skeleton dissector, to allow it
to create the dissector in `plugins/epan/PROTOSHORTNAME` instead of in
`epan/dissectors`. Handles modifying the appropriate CMake file in the
appropriate way, and generates the plugin's `CMakeLists.txt` if needed.
2023-02-06 14:32:55 +00:00
Martin Mathieson c331e17bea Ignore or fix more warnings (check_typed_item_calls) 2023-02-06 09:24:26 +00:00
Jan Romann 0dbf8c8e6c CoAP: Add support for more Content-Formats 2023-02-05 20:41:18 +00:00
Tomasz Moń 071eca97ad
USBLL: Update global data pointer only on first pass
Do not modify global data pointer when redissecting packets. This fixes
transient incorrect packet sequence errors when user navigates packet
list when live capture is in progress.
2023-02-05 19:38:29 +01:00
Gerald Combs 754ec536e5 [Automatic update for 2023-02-05]
Update manuf, services enterprise numbers, translations, and other items.
2023-02-05 16:47:29 +00:00
John Thacker 4bb43d5986 RTP Stream Dialog: Actually sort on packet loss
The packet loss column has been sorting on a private variable
that is never set(?!) and also is unsigned whereas the actual
lost number is signed. Get the calculated packet loss number
and sort by that. (Should this be sorting by the total number or
the percentage, since the column displays both? Total number is
first so let's use that.)

This should probably be some kind of Model/View instead.

Fix #16785.
2023-02-04 22:15:25 -05:00
John Thacker 8cddc32d35 cli: Process IDBs after the final packet record
Process IDBs that are read after the final packet record
returned by wtap_read() in tshark, editcap, and mergecap.

Ping #18449
2023-02-04 13:40:00 +00:00
John Thacker 3aa44ba6aa merge: Check if each encapsulation type is supported
Just because a file type supports per packet encapsulation does
not mean it can write every encapsulation type.

When determining what file-level encapsulation to write the merged
file, check each file's encapsulation to see if it is writable by
the output file type.  If any are not, report _UNKNOWN so that the
merge will fail early with an appropriate error message, instead of
always reporting WTAP_ENCAP_PER_PACKET.

This prevents confusing errors when trying to merge, e.g., a JSON
file and a normal packet file into a pcapng.
2023-02-04 08:04:16 -05:00
David Perry 3ade136df7 HTTP dissector memory management tweaks 2023-02-04 12:28:11 +00:00
Dr. Lars Völker b4c784805c ISO15765/ISO10681 memory corruption bugfix
Fixes a situation in which the code wrote behind the frag_id_high array
and corrupted memory.

Closes #18839
2023-02-04 10:25:58 +00:00
ismaelrti b0a615075c RTPS Removed the limit to the datatype number of elements
The DataType must be parsed completely due to nested types. Putting a
limit on it might create issues when dissecting the user data samples.
2023-02-04 09:47:03 +00:00
Gerald Combs a3232592b0 GitLab CI: Run our macOS tests in parallel. 2023-02-03 23:55:57 +00:00
ismaelrti 0c08995012 RTPS: Add support to new instance state request/response
Dissected new requests/response structure about instance state petitions.
2023-02-03 20:48:03 +00:00
Guy Harris c788b6b079 tshark: clean up indentation. 2023-02-03 11:36:30 -08:00
Gerald Combs c237cfb76b GitLab CI: macOS MR builds are wireshark/wireshark only for now
Access to macOS SaaS builders are limited to beta program participants.
2023-02-03 19:24:41 +00:00
Gerald Combs 577fe5781b Tools: Update macos-setup-brew.sh
Intitialize some environment variables using `brew shellenv`.

Speexdsp is required. Make some variable names match their respective
command line flags.
2023-02-03 10:45:01 -08:00
Chuck Craft 373c8f616d github: call reworked macos-setup-brew.sh with options 2023-02-03 10:47:12 -06:00
John Thacker d2067aea8d RTP: Add a "Multiplexed as in RFC 7983" default preference setting
RTP is commonly multiplexed on the same UDP 5-tuple with STUN, DTLS, and
other protocols including ZRTP.  RFC 7983 gives current best practices for
dealing with the multiplexing that doesn't involve assuming that version
0 packets are always the same protocol. Implement that for the "what to do
if RTP packets have the wrong version number" preference and set it as the
default.

Only use this setting when RTP is being dissected non-heuristically
(leave heuristic dissections to the other protocol's heuristic
dissector.)

This avoids a problem of the STUN heuristic dissector setting itself
to be the new dissector for an RTP conversation (cf issue #18148).
This also allows dissection of TURN ChannelData multiplexed on the
same 5-tuple as RTP set up by, e.g., SDP.

Fix #18832
2023-02-03 12:33:46 +00:00
Guy Harris 56651c4db1 tshark: fix previous fix for memory leak.
Pass the correct filter variable to warn_about_capture_filter();

Fixes the fix for #18837.
2023-02-03 04:03:15 -08:00
Martin Mathieson 85c134894a ORAN FH CUS: change some item long texts 2023-02-03 10:29:11 +00:00
Guy Harris d69208c5e7 tshark: plug a memory leak.
Put the "attempt to compile a filter string as a capture filter" code
into a common routine, and, if the attempt succeeds, free up the
generated capture filter code.

Fixes #18837.
2023-02-03 08:29:44 +00:00
ismaelrti 43861fd852 RTPS: Added dissection of the RTPS PING string
Dissection of the RTPS PING string field
2023-02-03 07:42:54 +00:00