Commit Graph

83084 Commits

Author SHA1 Message Date
Anders Broman b5928542b7 Ignore packet-PROTOABBREV.c 2021-12-22 11:18:07 +01:00
Jaap Keuter 6fa56bca0c Remove remnants of bygone GTK era 2021-12-22 06:02:10 +00:00
John Thacker 6a74dae750 text_import: Add interface and internals for IPv6
Add IPv6 handling to text_import, including the ability to
handle dummy IPv6 addresses instead of IPv4. GUI support is
still TBD. This further reduces the number of text2pcap features
that ui/text_import does not yet support. Related to #16724.
2021-12-22 05:13:17 +00:00
Jaap Keuter 2d7c888a70 MySQL: Replace illegal internal proto tree API use 2021-12-22 05:04:42 +00:00
John Thacker 3ff0c753a1 text_import: Add interface and internals for dummy IPv4 addresses
Add dummy IPv4 addresses to the text_import_info_t struct, and
use them if set in the same way text2pcap does. GUI support in
"Import from Hex Dump" is not added yet. This is also part of the
work for text2pcap to eventually call text_import. Related to #16724.
2021-12-22 02:41:11 +00:00
João Valverde 2c44afbba3 Use UINT64_C() with two constants 2021-12-22 01:53:46 +00:00
John Thacker f23296296e text2pcap: Clean up includes
Since we're using wtap_dump_open[_stdout] from file_access.c now,
we don't need to include io.h or fcntl.h on Windows anymore, and
we don't need to include pcapio either.
2021-12-22 01:38:49 +00:00
João Valverde d391d86c33 Debian: Fix header installation
Fixes a bunch of package warnings, and teaches the Debian package to
respect make install rules, and even more importantly to respect header
visibility rules, as defined by the build system. This prevents
private headers to be installed to the target system.

Remove the broken by design system that requires developers to
constantly fix headers by hand. Again the source of truth for which
headers are system headers is the build system, and that's what
any package must use, without requiring constant syncing of
installation rules in CMake and Debian.
2021-12-22 01:24:20 +00:00
John Thacker 4cfae8e378 text_import: pcap_link_type -> wtap_encap_type
The encapsulation type that text_import expects and puts
directly into rec.rec_header.packet_header.pkt_encap is a
wiretap encap type, not a pcap link type. Fix the name and
comment appropriately.
2021-12-22 01:00:19 +00:00
John Thacker c5cc836a48 text2pcap: Use wtap_dumper
Use wtap_dump instead of the pcapio functions for writing files.
This makes it easier to unify with text_import, and also makes it
easier to eventually write other file formats (with a similar option
to the other CLI programs), and allows using the standard CLI error
messages.

Also move some of the option validation before attempting to open
the output file.
2021-12-22 00:46:00 +00:00
João Valverde 9a52634c5f Add ws_version.h to wireshark.h 2021-12-21 23:00:04 +00:00
j.novak@netsystem.cz 9b62d8ba05 Extcap prefs: Selector correctly selects default value 2021-12-21 21:40:51 +00:00
j.novak@netsystem.cz df537a63fb Extcap logging: Corrected incorrect selector default value syntax 2021-12-21 21:05:22 +00:00
j.novak@netsystem.cz 55aad96738 Extcap prefs: Selector option shows tooltip 2021-12-21 20:14:14 +00:00
John Thacker bfbf8dfa23 IEC101/104: 101 Fixed frame len depends on address length
The PDU length for IEC101 Fixed Length frames depends on the
global address length setting. Fix #17775.
2021-12-21 09:39:28 -05:00
João Valverde 15565c2b25 Fixup -Wshorten-64-to-32 warnings with Clang
On Windows the POSIX read() and write() don't use the C99/POSIX
types size_t and ssize_t so we must do the same to avoid
gymnastics to squelch narrowing warnings.

This adds two types for that purpose that have the correct
definition for both Windows and POSIX.
2021-12-21 10:29:45 +00:00
Georg Sauthoff e273006a1d Add ETI/EOBI order flow/market data dissectors
The Enhanced Trading Interface (ETI) protocol and the Enhanced
Order Book Interface (EOBI) protocol are used by a few European
exchanges such as Eurex, Xetra and Börse Frankfurt.

Basically, a trader uses ETI to communicate with a matching
engine (over TCP), e.g. to add a new order, modify an existing
one, etc. while the matching engine also publicizes the current
state of the order book via EOBI over multicast UDP feeds.

ETI actually consists of two variants, i.e. ETI for derivatives
markets (such as Eurex) and ETI for cash markets (such as Xetra).
A common convention is to abbreviate them as ETI (for
derivatives) and XTI (for cash).

These protocols share the same encoding, i.e. messages start with
a length and a tag field and most messages and fields are fixed
size. See also
https://github.com/gsauthof/python-eti#protocol-introduction for
some more details.

The protocol specifications are openly available (cf.
https://github.com/gsauthof/python-eti#protocol-descriptions for
direct links) in human and machine-readable (XML) formats.

The Wireshark ETI/XTI/EOBI dissectors are code-generated by
`eti2wireshark.py`
(https://github.com/gsauthof/python-eti/blob/master/eti2wireshark.py)
which is GPL licensed. See also
https://github.com/gsauthof/python-eti#wireshark-protocol-dissectors
for usage examples and related work.
2021-12-21 08:10:43 +00:00
Gerald Combs b1d7775579 Fix some wiki file attachment URLs.
Wiki file attachment URLs changed when we migrated to GitLab. Update
the references in our code base to match.
2021-12-21 04:47:56 +00:00
João Valverde 5ce2ae2804 Clean up some printf() format strings 2021-12-21 02:15:46 +00:00
João Valverde 4448b6494e Add a ws_posix_compat.h header
Currently used to define ssize_t on platforms that lack it.

Fix some Windows build errors caused by moving the definition into a
separate header.

Fix some narrowing warnings on Windows x64 from changing the definition
of ssize_t from long int to int64_t.

The casts in dumpcap are ugly but necessary. The whole code needs
to be rewritten for portability, or the warnings disabled.
2021-12-21 01:30:06 +00:00
João Valverde 36d5aad962 wsutil: Split ws_regex_matches() into two functions
Split ws_regex_matches() into two functions with better semantics
and remove the WS_REGEX_ZERO_TERMINATED symbol.

ws_regex_matches() matches zero terminated strings.

ws_regex_matches_length() matches a string length in code units.
2021-12-21 00:40:02 +00:00
Chuck Craft 392745c56f wsdg: chapter_libraries refresh - update URL; typos 2021-12-20 07:55:46 +00:00
Alexis La Goutte 457ce59bfa mbim: Fix warnings by Cang Analyzer 2021-12-20 06:51:53 +00:00
Alexis La Goutte 3d81fd5027 mka: Fix warnings by Cang Analyzer
packet-mka.c:569:7: warning: Value stored to 'offset2' is never read [deadcode.DeadStores]
2021-12-20 06:51:53 +00:00
Jaap Keuter 4a7053e880 Documentation: simplify protocol tree function documentation intro 2021-12-20 06:50:38 +00:00
Gerald Combs e56c00e12f [Automatic update for 2021-12-19]
Update manuf, services enterprise numbers, translations, and other items.
2021-12-20 06:22:21 +00:00
João Valverde ce1dc88173 Fix stdio.h conversions to use the scanf macros 2021-12-19 23:49:55 +00:00
João Valverde dec5590b5b Fix errors found by fix-encoding-args.pl 2021-12-19 22:55:37 +00:00
João Valverde 80c9b56e7a ERSPAN Marker: Fix a pre-commit check
epan/dissectors/packet-cisco-marker.c (13 (of 13) fields)
cisco_erspan_marker.prop_header doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.header doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.version doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.type doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.ssid doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.granularity doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.utc_offset doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.timestamp doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.utc_sec doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.utc_usec doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.sequence_number doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.reserved doesn't match PROTOABBREV of cisco-marker
cisco_erspan_marker.tail doesn't match PROTOABBREV of cisco-marker
2021-12-19 22:55:36 +00:00
João Valverde ca2a8e69a9 Fix a pre-commit check
epan/dissectors/packet-lwm2mtlv.c:  FT_STRING:        proto_tree_add_item(tlv_tree, hf_lwm2mtlv_value_string, tvb, valueOffset, element->length_of_value, [[ENC_UTF_8|ENC_NA]-->[ENC_UTF_8]]);
2021-12-19 21:47:31 +00:00
João Valverde 0ccd69e530 Replace g_strdup_printf() with ws_strdup_printf()
Use macros from inttypes.h.
2021-12-19 21:21:58 +00:00
João Valverde f984def50c Add g_snprintf() to checkAPIs 2021-12-19 21:04:49 +00:00
João Valverde 92b4e3277c Fix dissector -Wrestrict warnings
[31/254] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-bssgp.c.o
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-bssgp.c: In function ‘de_bssgp_cell_id’:
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-bssgp.c:859:9: warning: ‘snprintf’ argument 4 overlaps destination object ‘add_string’ [-Wrestrict]
  859 |         snprintf(add_string, string_len, "%s, CI %u", add_string, ci);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-bssgp.c: In function ‘de_bssgp_rim_routing_inf’:
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-bssgp.c:2313:17: warning: ‘snprintf’ argument 4 overlaps destination object ‘add_string’ [-Wrestrict]
 2313 |                 snprintf(add_string, string_len, " %s, RNC-ID %u", add_string, rnc_id);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-bssgp.c: In function ‘de_bssgp_rnc_identifier’:
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-bssgp.c:2767:9: warning: ‘snprintf’ argument 4 overlaps destination object ‘add_string’ [-Wrestrict]
 2767 |         snprintf(add_string, string_len, " %s, RNC-ID %u", add_string, rnc_id);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[85/254] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-gsm_a_bssmap.c.o
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-gsm_a_bssmap.c: In function ‘be_cell_id_type’:
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-gsm_a_bssmap.c:1842:21: warning: ‘snprintf’ argument 4 overlaps destination object ‘add_string’ [-Wrestrict]
 1842 |                     snprintf(add_string, string_len, "%s/RNC-ID (%u)", add_string, value);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-gsm_a_bssmap.c:1869:17: warning: ‘snprintf’ argument 4 overlaps destination object ‘add_string’ [-Wrestrict]
 1869 |                 snprintf(add_string, string_len, "%s/CI (%u)", add_string, value);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[137/254] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-mswsp.c.o
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-mswsp.c: In function ‘get_name_from_fullpropspec’:
/home/jpv/code/wireshark/wireshark/epan/dissectors/packet-mswsp.c:2975:25: warning: ‘snprintf’ argument 4 overlaps destination object ‘dest’ [-Wrestrict]
 2975 |                         snprintf(dest, bufsize, "%s <INVALID>", dest);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-12-19 20:25:58 +00:00
João Valverde 22ee2764a7 Replace g_snprintf() with snprintf() (dissectors)
Use macros from inttypes.h with format strings.
2021-12-19 20:25:11 +00:00
João Valverde fe5248717f Replace g_snprintf() with snprintf()
Use macros from inttypes.h with format strings.
2021-12-19 20:06:13 +00:00
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