Commit Graph

82999 Commits

Author SHA1 Message Date
João Valverde c5a19582e4 epan: Convert to use stdio.h from GLib
Replace:
    g_snprintf() -> snprintf()
    g_vsnprintf() -> vsnprintf()
    g_strdup_printf() -> ws_strdup_printf()
    g_strdup_vprintf() -> ws_strdup_vprintf()

This is more portable, user-friendly and faster on platforms
where GLib does not like the native I/O.

Adjust the format string to use macros from intypes.h.
2021-12-19 19:29:53 +00:00
João Valverde 737d1dc125 Add missing header, fix macOS build 2021-12-19 19:09:05 +00:00
Martin Mathieson 3b675f0fc1 5co-legacy: fix a filter string 2021-12-19 17:39:02 +00:00
João Valverde 7160b4b177 wsutil: Use snprintf() and ws_strdup_printf()
Replace GLib I/O with C library I/O.
2021-12-19 12:23:14 +00:00
João Valverde 612c0cff60 wmem: Add ws_strdup_printf() convenience macros
The convention (for wmem) is that functions with ws_ use
malloc'ed memory. This is just a convenience to avoid having
to pass a NULL allocator.
2021-12-19 10:48:15 +00:00
João Valverde f75b79a59d Move wmem string utility functions to wsutil 2021-12-19 10:47:50 +00:00
Martin Mathieson 3319d994b5 README.heuristic: minor updates 2021-12-19 08:03:04 +00:00
John Thacker db10235d68 text_import: Handle SCTP and minimum packet lengths
Correctly handle when a minimum packet length forces fragmentation of
SCTP and we are generating dummy SCTP DATA chunk headers: mark fragmentation
in the chunk flags and set the transmission sequence number and
stream sequence number appropriately.

Port from text2pcap commit f8d48662c8
Part of #16724.
2021-12-18 22:45:02 -05:00
João Valverde 8cc527cce3 wmem: Use vasprintf()
Use vasprintf(3) if available to optimize wmem_stdup_printf().
2021-12-18 23:16:38 +00:00
Gerald Combs c9715e5ab5 GitLab CI: Switch the Windows MR job back to vanilla CMake.
After switching to Visual Studio's CMake the Windows MR builds started
failing with

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_de.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_en.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_es.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_fr.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_it.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_ja_JP.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_pl.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_ru.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_sv.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_tr_TR.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_uk.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\7345cb0fc1b52560d4d2bd48e83ff433\wireshark_zh_CN.qm.rule;C:\builds\wireshark\wireshark\build\CMakeFiles\9829b32238fa3bcc807b02099e4c1642\qtui_autogen.rule' exited with code -1073741819. [C:\builds\wireshark\wireshark\build\ui\qt\qtui_autogen.vcxproj]

This appears to be caused by
https://gitlab.kitware.com/cmake/cmake/-/issues/22014 which should be
fixed in recent versions of the official CMake distribution.
2021-12-18 21:47:43 +00:00
João Valverde 2f572659f5 Docs: Fix a README.developer code example
Remove spurious "int".

Also prefer "g_string_printf", just for stylistic reasons.
2021-12-18 21:13:20 +00:00
João Valverde 64c0e166d1 Add string.h to wireshark.h
Wireshark development requires handling strings a lot. Add this
standard header to the base environment to avoid unnecessary repetition.
2021-12-18 20:28:54 +00:00
João Valverde f19c18a299 Add wmem.h to wireshark.h
Wmem is an alternative to GLib data structures so it should
have the same scope and be equally as convenient to use.

Wmem does not and cannot depend on anything else other than
GLib.
2021-12-18 20:28:54 +00:00
João Valverde 58c297ca81 wmem_test: Add more string performance test
Add some C99 stdio.h numbers to compare with GLib on platforms
(such as Windows) where they use different implementations.

Add a wmem string test with NULL allocator, to compare wmem and GLib
performance with roughly the same memory allocation.

Use the block allocator as being more representative of normal
wmem performance, instead of using strict, that is normally
used for wmem debugging.
2021-12-18 20:13:41 +00:00
João Valverde 9465c5c28d wmem_test: Disable performance tests by default
These are not pass/fail tests, so the automation cannot
validate them. They just slow down the CI builds. To
enable pass -m perf.

I think the --verbose comment is wrong, I did not detect
any difference in output with or without --verbose.
2021-12-18 20:13:41 +00:00
João Valverde e0dba4854b Exclude wmem_test.c from pre-commit 2021-12-18 20:13:41 +00:00
João Valverde f837dae4c4 Fix wmem_test.c indentation 2021-12-18 19:39:21 +00:00
João Valverde b83f264f7d Fix wsutil/time_util.c indentation 2021-12-18 19:39:21 +00:00
João Valverde d443197097 Prefer the portable _Noreturn attribute (C11)
Use _Noreturn, available with C11, instead of vendor specific
attributes. It's not compatible with C++ so we we must keep
the old code for now.
2021-12-18 18:54:08 +00:00
Gerald Combs 2de477f499 Docs: Prefer 64-bit Windows.
Document the 64-bit Windows build options first and switch to
"Wireshark-win64" in a couple of places.
2021-12-18 17:45:03 +00:00
Martin Mathieson 4901eefaa5 README.tapping: Some minor updates 2021-12-18 14:47:57 +00:00
Martin Mathieson 62a747bae3 file-jpeg: Fix value in vals_ifd_tags_exif[] 2021-12-18 11:43:03 +00:00
Chuck Craft 136b67b85e wsdg: cleanup epub3 build warnings - anchors; TOC
Closes #17790
2021-12-18 08:20:32 +00:00
João Valverde a8acda8fcc Docs: Add more info about transitioning to C99 fixed-width types 2021-12-18 07:24:46 +00:00
Joel Colledge f4123939d1 DRBD: Tidy up choice of display base for fields
When the dissector was added, BASE_HEX_DEC was used by default for many
fields. This is often not the most appropriate display format. The
biggest change is that all fields referring to sizes in bytes now
consistently use BASE_DEC_HEX.
2021-12-18 07:06:52 +00:00
Joel Colledge 217228eece DRBD: Decode two-phase commit payloads
This part of the DRBD protocol requires some state to correctly decode.
So we use a conversation to associate the packets. This conversation
stores a map of the two-phase commit data required for decoding later
packets.
2021-12-18 07:06:52 +00:00
Joel Colledge 4a28f5704f DRBD: Use CF_FUNC with BASE_CUSTOM
This is apparently necessary to prevent compilations warnings in certain
build environments.
2021-12-18 07:06:52 +00:00
Joel Colledge 583169ce06 DRBD: Add implicit data sizes as fields
Packets such as P_DATA do not have a dedicated field containing the size
of the data. It is simply the amount of extra data in the packet. It is
useful to be able to show or filter by this value, so add it as a
separate field.

Also combine the "blksize" and "size" fields, since they have the same
meaning.

Finally, remove some duplicates of the function decode_payload_data.
2021-12-18 07:06:52 +00:00
Joel Colledge 34f5c2c344 DRBD: Decode barrier numbers and block IDs little-endian
These values are opaque handles as far as the protocol is concerned.
They are sent from some node A to B, and then back from B to A. For node
B they have no meaning other than as a handle. However, on node A they
do have meaning, so it is useful to be able to interpret them. In
practice, they are usually little-endian encoded, so decode them
accordingly.
2021-12-18 07:06:52 +00:00
Antoine Gardiol e4cd4f92f8 5co-legacy: Fix dissector unique hash computing
*** CID 1495425:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT) in packet-5co-legacy.c: 765 in fiveco_hash()
2021-12-18 06:29:41 +00:00
John Thacker f89d536503 text_import: Fix direction detection in Import from Hexdump
If the first character of the preamble indicates direction, it
needs to be skipped over and not tested as part of the timestamp.
2021-12-18 00:49:42 +00:00
Pau Espin de3359fe3e IuUP: Use proto_tree_add_checksum() to show CRC Header
Use standarized API to show checksum information. This also does the
checksum validation and shows computed CRC if found incorrect, etc.
2021-12-17 23:47:06 +00:00
Pau Espin f81a64e2bf IuUP: Fix CRC Header checks
All the packets coming from a known working source (nano3g femtocell)
where being shown as containing wrong CRC Header in Wireshark.

pcap file: https://osmocom.org/attachments/download/4744/3g_call_23112021.pcapng
2021-12-17 23:47:06 +00:00
João Valverde 77f95e18ab CMake: Disable Wformat-truncation (GCC warning)
Converting from GLib functions to stdio.h turns up many of these
warnings. They are disabled to allow work to go on and until
there is consensus on how to handle them.

    -Wformat-truncation
    -Wformat-truncation=1

        Level 1 of -Wformat-truncation enabled by -Wformat employs
        a conservative approach that warns only about calls to bounded
        functions whose return value is unused and that will most likely
        result in output truncation.
2021-12-17 19:34:55 +00:00
João Valverde b054f9aee6 ASN1: Convert I/O from GLib to stdio.h 2021-12-17 19:34:54 +00:00
João Valverde 64e8a2817e Add wsutil/glib-compat.h to wireshark.h
We are already adding glib.h, we should include glib-compat.h
as well in the base environment.
2021-12-17 19:34:54 +00:00
João Valverde 689976477a Add inttypes.h to wireshark.h
For convenience, having to add this header constantly is annoying
and kind of pointless, now that we are relying more on stdio.h.
2021-12-17 19:34:54 +00:00
Gerald Combs 271ab568b0 GitLab CI: Enable ccache in the "No options" job. 2021-12-17 18:53:53 +00:00
Gerald Combs f877e26b31 GitLab CI: Add back a missing variable. 2021-12-17 08:49:02 -08:00
Martin Mathieson 834312cb62 DCT2000: For ipprim frames, show header even when no payload dissector 2021-12-17 16:37:22 +00:00
John Thacker b4054d3879 text_import: Time delta between packets without timestamp
The "Import from Hex Dump" time delta for packets without a timestamp
was changed to be a nanosecond, but the time resolution for the file
created by import_text_dialog is the default, microseconds. Until
that is configurable, the time tick used needs to be microseconds like
it was before.

Clean up the code so that it's a little more consistent about when
and how the extra time tick is added, namely:
1. If there is no time format passed in.
2. If time format conversion for the packet fails for any reason.

We don't add an extra delta in other situations, e.g. if packets just
happen to have the same valid time value.

Fix #15562.
2021-12-17 13:37:29 +00:00
John Thacker 5f5f03f0e8 text_import: Fix spelling and grammar 2021-12-17 12:55:52 +00:00
Gerald Combs 07c4059277 GitLab CI+Qt+Docs: CMAKE_PREFIX_PATH updates.
Qt's documentation recommends using CMAKE_PREFIX_PATH to designate your
Qt installation prefix: https://doc.qt.io/qt-5/cmake-get-started.html.
Do so in GitLab's CI and update the Developer's Guide.
2021-12-16 18:47:18 -08:00
Gerald Combs 7d88f1e2b1 GitLab CI: More Windows environment updates.
Use Visual Studio's CMake in the MR build. Use CMAKE_PREFIX_PATH as
recommended by https://doc.qt.io/qt-5/cmake-get-started.html
2021-12-16 17:00:02 -08:00
Gerald Combs 476bf62494 GitLab CI: Remove a no-longer-needed build.
Remove the -DENABLE_PCAP=OFF build from the "macOS Arm Package" job.
It's no longer needed since we now have a "No options" job.
2021-12-16 22:51:47 +00:00
Dario Lombardo 1f7c4eff30
ci: add no options job.
Fix: #17786.
2021-12-16 22:54:21 +01:00
João Valverde 9ebeb39395 CMake: Be stricter about MSVC requirements 2021-12-16 12:19:22 +00:00
João Valverde 5bba669579 Remove some lingering uses of g_assert()
Also replace some incorrect uses of g_assert_true().

  g_assert_true -> g_assert -> ws_assert
2021-12-16 10:19:45 +00:00
Jaap Keuter 9539f4e1d6 MMDBR: Don't pretend to be a multithreaded writer 2021-12-16 09:28:54 +00:00
Antoine Gardiol 4248e5b665 5co-legacy: New FiveCo Legacy dissector 2021-12-16 09:13:37 +00:00