Commit Graph

2697 Commits

Author SHA1 Message Date
Gerald Combs 2141f0f03b Falco Bridge: Update to match the current libsinsp API.
The extract_fields struct and calling convention changed, so update to
match. Extract all of our fields at once, which noticeably speeds up
dissection here.
2022-04-26 17:11:21 +00:00
Gerald Combs dbf3ac3701 CMake+Logwolf: Populate our Falco plugin directory.
Create plugins/<version>/falco and copy over the Cloudtrail plugin.
2022-04-25 12:07:48 -07:00
Vahap Emin Agaogullari 7e0d0eb418 PROFINET: TSN Dissection implemented
TSN Records for pn_io and
pn_dcp TSN Suboption dissected
2022-04-20 07:44:57 +00:00
Gerald Combs 87b0288b8d epan: Add the ability to add conversation filter protocols.
Convert our conversation protocols to a dynamic list and add
add_conversation_filter_protocol(). Use it in the Falco Bridge plugin to
add protocols with conversation filters.
2022-04-19 22:25:32 +00:00
Matthias Dietrich 86bc544fd3 PROFINET: Fix count of IO data objects and IOCS
Split the counts of IO data objects and IOCS between
input and output. Remove increment of IO data objects
in station information, sometimes leading to extremely
high and invalid number of IO data objects.
2022-04-16 13:57:16 +00:00
Matthias Dietrich dcffa0303a PROFINET: Split number of IOCS between in and out
Currently a single counter is used, but the number of
IOCS is not necessarily the same for input and output
CRs.
2022-04-16 13:57:16 +00:00
Gerald Combs 8528fca055 Falco Bridge: Misc cleanup.
Remove unused header definitions in packet-falco-bridge.h and move the
remaining content to packet-falco-bridge.c and conversation-macros.h.
Explicitly set our header files in CMakeLists.txt.
2022-04-13 13:51:06 -07:00
Gerald Combs 57172fe4cd CMake: Finish splitting ADD_PLUGIN_LIBRARY.
Rename add_plugin_library to add_wireshark_plugin_library and add a
backward compatibility wrapper. Make Falco Bridge a Logwolf plugin.
2022-04-04 23:10:57 +00:00
Gerald Combs 23ed784ce1 Falco Bridge: Fix a function declaration.
Fix

../plugins/epan/falco_bridge/packet-falco-bridge.c: In function ‘register_conversation_filters_mappings’:
../plugins/epan/falco_bridge/packet-falco-bridge.c:105:1: error: old-style function definition [-Werror=old-style-definition]
 register_conversation_filters_mappings()
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-04-04 21:21:10 +00:00
Matthias Dietrich ea39653c8d PROFINET: Support PROFIsafe 5 byte safety trailer
Calculate the safety IO data length based on the
safety trailer length, which is given by the
F-Parameter F_CRC_Seed.
2022-04-03 18:49:20 +00:00
Vahap Emin Agaogullari 7f2e996193 PROFINET: TimeAware Dissection and RSI FREQ block fix
TimeAware bit dissected for ARProperties
and cyclic frames updated accordingly.
Also small length problem fixed in RSI FREQ block dissection.
2022-03-24 18:06:06 +00:00
Gerald Combs 0a351fb6ba Falco Bridge: Update the README.
Update the Licensing section of the README.
2022-03-22 17:51:32 +00:00
Gerald Combs e06864e777 Falco Bridge: Miscellaneous fixes.
Fix some issues found by the pre-commit script. Add a missing Debian
symbol. Update the README.
2022-03-22 17:51:32 +00:00
Gerald Combs 34cb45c743 Falco Bridge: Remove some unused code. 2022-03-22 17:51:32 +00:00
Gerald Combs 110dbffbe9 Rename Sysdig Bridge to Falco Bridge.
The Sysdig Bridge plugin loads Falco plugins, so rename it to Falco
Bridge.

Make it optional and dependent on libsinsp+libscap, similar to our codec
plugins.

Remove some unused code.
2022-03-22 17:51:32 +00:00
Gerald Combs be03aa1a4d CMake+Sysdig Bridge: Add a FindSinsp module.
Add a FindSinsp CMake module, and use it in the Sysdig Bridge plugin
CMakeLists.txt. It still needs work, but should at least be usable on
more machines.

Conflicts:
	plugins/epan/sysdig_bridge/CMakeLists.txt
2022-03-22 17:51:32 +00:00
Gerald Combs 90bd33e4e2 Sysdig Bridge: Make sure we fetch the correct field info.
Fetch the current field number's type and format instead of the first
field's.
2022-03-22 17:51:32 +00:00
Gerald Combs b9946577d6 Sysdig Bridge: Remove old code.
Remove commented & ifdef0'd code that loaded plugins directly. Destroy
our libsinsp instance on exit.
2022-03-22 17:51:32 +00:00
Gerald Combs 349c067414 Sysdig Bridge: Handle info and conversation fields.
Fix our field length display as well.
2022-03-22 17:51:32 +00:00
Gerald Combs bee0393a94 Sysdig Bridge: Switch to libsinsp/libscap.
Switch from loading the cloudtrail plugin directly to doing so
indirectly via libsinsp. This should let us start leveraging the rich
functionality offered by libsinsp.
2022-03-22 17:51:32 +00:00
Gerald Combs 9b106b500c Sysdig Bridge: Update the Sysdig Plugin fields.
Update the Sysdig Plugin fields to match falcosecurity/libs scap.c.
2022-03-22 17:51:32 +00:00
Gerald Combs a075ce1be7 Sysdig bridge: Update a struct.
Update ss_plugin_extract_field to match

https://github.com/falcosecurity/plugin-sdk-go/blob/main/pkg/sdk/plugin_info.h
2022-03-22 17:51:32 +00:00
Gerald Combs 24aa07281a Sysdig bridge: Fix a couple of offsets.
It looks like the source ID and event data are 4 bytes further into each
block. Quick fix pending more details about the block format.
2022-03-22 17:51:32 +00:00
Gerald Combs 9a889e9546 Sysdig bridge: Set our plugin API version to 0.2.0. 2022-03-22 17:51:32 +00:00
Gerald Combs 70aed62c86 Sysdig bridge: Fix compilation.
Fix

logshark/plugins/epan/sysdig_bridge/packet-sysdig-bridge.c:86:39: error: this old-style function definition is not preceded by a prototype [-Werror,-Wstrict-prototypes]
register_conversation_filters_mappings()
                                      ^
1 error generated.
2022-03-22 17:51:32 +00:00
Mark Stemm 58e3976910 Use the plugin name as the protocol short name
Prior versions had a dedicated plugin API function for this, but we
removed it from the plugin API, so just use the plugin name.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2022-03-22 17:51:32 +00:00
Loris Degioanni 0555c413d1 Sysdig Bridge: Fix a memory allocation crash.
avoid moving plugin states around the address space by mallocing all of the memory at the beginning instead of using realloc every time a plugin is detected. This prevents crashes and other types of bad behavior that were caused by plugins accessing garbage memory.
2022-03-22 17:51:32 +00:00
Mark Stemm 39c8e1ac2c Use register_shutdown_routine, not cleanup_routine
register_cleanup_routine is called after reading a single capture
file. Since the async extraction is set up per plugin instead of
per-instance, we want register_shutdown_routine().

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2022-03-22 17:51:32 +00:00
Mark Stemm 5fdc4142b9 Update to use single extract_fields func
Update to reflect newest API changes (single extract_fields
func). This simplifies dissect_plg_bridge a bit, as the setup/calling
plugin function can mostly be unified based on the field type, with
just looking at the res_str/res_u64 part of the field struct
afterward.
2022-03-22 17:51:32 +00:00
Mark Stemm c34693bb20 Update to reflect latest plugins api changes
Although not used by wireshark directly, update
plugin_next/plugin_next_batch to note they return structs for events
instead of pointers + lens + timestamps.

Extract functions now use field names, so no need to extract or keep
track of field ids. The a "abbrev" property of header_field_info
contains the field name e.g. ct.xxx.
2022-03-22 17:51:32 +00:00
Loris Degioanni 8c3f436cc0 load the plugins from the wireshark directory 2022-03-22 17:51:32 +00:00
Loris Degioanni d226a7aa98 separate list of conversation filters for logshark
Conflicts:
	CMakeLists.txt
2022-03-22 17:51:32 +00:00
Loris Degioanni 2d6b0e8885 conversation-like filtering and coloring for sysdig plugins 2022-03-22 17:51:32 +00:00
Loris Degioanni de5f59d7a4 sysdig: initial implementation of sysdig plugins support
This commit introduces a new wireshark plugin which is able to act as proxy to sysdig plugins, loading them into Wireshark and transforming their output into dissectors that Wireshark can use to display the data.
2022-03-22 17:51:32 +00:00
Loris Degioanni 625a042ff8 initial skeleton for sysdig plugins experiments 2022-03-22 17:51:32 +00:00
Dirk Ziegelmeier dc5cb69409 Profinet plugin: Decode more r/w indexes 2022-02-11 20:16:07 +00:00
Dirk Ziegelmeier a17037de4b Profinet plugin: Update several enums
According to PN AL Protocol, Oct 2020
Indices, user structure identifier, channel error type, ext channel error types
2022-02-11 20:16:07 +00:00
Martin Mathieson 1f22c7e04c Trivial: change some formatting in hf item definitions 2022-02-04 11:56:24 +00:00
Martin Mathieson 3466798ed0 More mask/field-length fixes 2022-02-03 22:13:43 +00:00
John Thacker e0a11d0607 PROFINET: Fix incorrect API call, assertion
Fix two calls of proto_tree_add_item() when proto_tree_add_uint()
was meant. Passing the actual value of a field instead of an encoding
into proto_tree_add_item() has unexpected results. Fix #17909.

(The whole area of this dissector would probably be cleaner with
more calls to add_item(), but this is a smaller change consistent
with the rest.)
2022-01-29 23:39:20 -05:00
Martin Mathieson 19ec126687 check_typed_item_calls.py - Find all (but 3) items from calls. 2022-01-29 15:54:19 +00:00
Dirk Ziegelmeier de0fde6e46 Profinet Plugin: Improve dissecting PDPortDataReal block 2022-01-20 05:07:08 +00:00
Dirk Ziegelmeier 74255a072f Profinet plugin: Dissect Neighbors block 2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier c1a2cbcf05 Profinet Plugin: Dissect OwnPort block 2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier 74d522d8d3 Profinet Plugin: Decode PDPortDataRealExtended block 2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier bb34f30d56 Profinet Plugin: Cleanup diagnosis data decoding 2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier 5b666b874a Profinet Plugin: Add 10BASET1L and APL MAU Type 2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier 6100e284cf Profinet Plugin: Update Block Type List
According to PN AL Protocol d24MU2 Oct 2020
2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier 7efd80327d Profinet Plugin: Decode ControlBlockPlug 2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier 239d9de7ad Profinet plugin: Correctly name ModuleDiffBlock bits 2022-01-20 05:07:07 +00:00
Dirk Ziegelmeier 6db8b0e4cc Profinet plugin: Decode QualifiedChannelDiagnosis 2022-01-20 05:07:07 +00:00
Moshe Kaplan 67f05835ca Fix more repeated words throughout
Fixes more repeated words seen throughout
the code base.
2021-12-31 22:50:40 +00:00
Moshe Kaplan 69d54d6f8e Corrects repeated words throughout the code.
Repeated words were found with:
egrep "(\b[a-zA-Z]+) +\1\b" . -Ir
and then manually reviewed.
Non-displayed strings (e.g., in comments)
were also corrected, to ease future review.
2021-12-22 11:01:11 +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 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 fe5248717f Replace g_snprintf() with snprintf()
Use macros from inttypes.h with format strings.
2021-12-19 20:06:13 +00:00
cacamille3 03224385b8 Added Invalid value to BrowseDirection enum 2021-12-06 05:39:29 +00:00
João Valverde 60e305d1e1 dfilter: Convert grammar.lemon to 4-space indentation
Add global EditorConfig settings for lemon files.

Add exceptions for the two grammar files that use tab indentation.
2021-12-02 15:48:40 +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
João Valverde b30a2112e8 regex: Prefer C99/POSIX types
Replace 'gssize' with 'ssize_t'.

Add a CMake configure check for ssize_t.

Fix missing "config.h" includes.
2021-11-15 02:41:59 +00:00
Gerald Combs 87b84b7813 Lua is a proper name. Fix its capitalization. 2021-11-11 01:08:51 +00:00
João Valverde 1acae21bcd Windows: Fix warnings using flex
Fix some warnings complaining of macro redefinitions with stdint.h.
Include stdint.h via wireshark.h everywhere so it stays fixed.
2021-10-22 06:41:44 +00:00
Martin Mathieson a5df18e51e Fix some spelling errors 2021-10-11 04:44:49 +00:00
Martin Mathieson d8b28f8040 Fix some field mask widths. 2021-10-07 21:33:49 +00:00
Evan Huus 07f5472aa7 to_str: scope tvb_ip_to_str 2021-10-07 10:25:12 -04:00
Martin Mathieson b240d5baa0 Ethercat: try to fix EEPROM Ctrl/Status bitmask fields
Fixes remaining errors detected by

./tools/check_typed_item_calls.py --mask
2021-10-06 04:53:50 +00:00
Evan Huus e578c6caee to_str: pull scope arg up into tvb_ether_to_str
There are a bunch of near-identical macros here, but I'm gonna change
one at a time or else the builder times out at the number of files
changed in one merge.
2021-10-04 17:10:17 +00:00
Evan Huus 3cdada3e7b guids: wmem-scope lookups
Avoids the use of the global unprotected packet memory pool and lets the
compiler enforce scoping.
2021-09-28 15:07:55 -04:00
Roland Knall 0c7d82d8b7 USBDump: Fix Memleak with error info
The memory block the error was written to was uninitialized
2021-09-24 06:57:28 +00:00
Martin Mathieson fee630dbdc Fix the lengths of some masks. 2021-09-22 09:38:09 +01:00
Martin Mathieson 543ea3968c ethercat: Fix some too-wide mask widths.
N.B. Some other issues spotted have been reported in
https://gitlab.com/wireshark/wireshark/~/issues/17605
2021-09-21 11:04:31 +01:00
João Valverde 5f79503d67 Fix config.h include order
The header "config.h" needs to be the first header included in the
source file, no exceptions.
2021-09-20 20:16:52 +01:00
Evan Huus cdfab0d6e9 tvbuff: convert helper methods to pinfo->pool
A few of them just needed scratch memory, so allocate and free it
manually after doing any exception-raising checks.

A few others were returning memory, and needed conversion to accept a
wmem scope argument.
2021-09-01 03:54:52 +00:00
Guy Harris 3cb6403a4c wiretap: always allocate a block for a record.
Without that, you could add a comment to a record in a file format the
reading code for which doesn't allocate blocks, but the comment doesn't
get saved, as there's no block in which to save the comment option.

This simplifies some code paths, as we're either using the record's
modified block or we're using the block as read from the file, there's
no third possibility.

If we attempt to read a record, and we get an error, and a block was
allocated for the record, unreference it, so the individual file readers
don't have to worry about it.
2021-08-29 19:12:13 -07:00
Martin Mathieson 70e26d691e Some spelling fixes. 2021-08-27 22:21:40 +00:00
Vahap Emin Agaogullari c8d29e9f15 PROFINET: DCP Option dissection updated
DCP Frames with Reserved Option dissection changed
short time ago. There isn't a predefined suboption
for Reserved option in the standard. But in this
implementation it dissected like control suboption.
This is not true and creates malformed frames in some
dcp pcaps. This implementation is reverted.
Wireshark will dissect undefined bytes as paddings
just like before.
2021-08-26 05:28:35 +00:00
Guy Harris 1ab3711132 gryphon: explain in detail why we can't import tfs strings from libwireshark. 2021-08-25 17:29:59 -07:00
Evan Huus 9311982664 plugins: convert to pinfo->pool
Convert all plugin dissectors from wmem_packet_scope to pinfo->pool.
2021-08-25 14:30:47 +00:00
Guy Harris a70c120a04 gryphon: get rid of unused variables.
Found by cppcheck.
2021-08-25 08:57:47 +00:00
Martin Mathieson c0faa8f1da Some more dissector spellings. 2021-08-08 22:21:38 +01:00
ZhaoHao 272ed7a05a trailing whitespace 2021-08-06 06:53:38 +00:00
ZhaoHao 389e19f593 trail whitespace 2021-08-06 06:53:38 +00:00
ZhaoHao 7c27bce458 format the code 2021-08-06 06:53:38 +00:00
ZhaoHao eadcd5f080 add profidrive 2021-08-06 06:53:38 +00:00
João Valverde 7b845e7194 wsutil: rename bytestring_to_str() -> bytes_to_str_punct() 2021-07-29 17:23:05 +00:00
João Valverde 133b0c583f Move epan/wmem/wmem_scopes.h to epan/
This header was installed incorrectly to epan/wmem_scopes.h.

Instead of creating additional installation rules for a single
header in a subfolder (kept for backward compatibility) just
rename the standard "epan/wmem/wmem.h" include to
"epan/wmem_scopes.h" and fix the documentation.

Now the header is installed *correctly* to epan/wmem_scopes.h.
2021-07-26 14:56:11 +00:00
Evan Huus d6d7dd1e56 First pass pinfo->pool conversion
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.

I also tweaked a few of the docs which got caught up.
2021-07-21 05:38:29 +00:00
Evan Huus 57fcadf5af wimax: fix field abbrev
Fixes pre-commit warning
"wimax.dcd.dl_burst_profile_multiple_fec_types doesn't match PROTOABBREV"

All the other fields of this dissector use `wmx` not `wimax`.
2021-07-19 19:32:22 -04:00
Evan Huus f54493278f Delete various unused fields
Discovered during the build failure of
https://gitlab.com/wireshark/wireshark/-/merge_requests/3695
2021-07-17 16:35:41 -04:00
Gerald Combs 8834b470d0 CMake: Fixup SpanDSP's TIFF includes.
Add TIFF_INCLUDE_DIR to SPANDSP_INCLUDE_DIRS, but only if TIFF has been
found.

Ping #17477.
2021-07-14 09:10:09 -07:00
Gerald Combs ff60fcf92d CMake: Adjust wsutil includes and linking.
Mark wsutil's includes SYSTEM PRIVATE. This exposed a lot of targets
that were indirectly picking up include paths via the wsutil target, so
add direct includes where needed. The G.722 and G.726 codecs were
implicilty including tiffio.h; find it explicitly instead.

Mark some of wsutil's libraries PRIVATE, but leave commonly-used ones
PUBLIC.

Ping #17477.
2021-07-14 03:56:05 +00:00
Chuck Craft a7d927a9e9 prefs_register_protocol_obsolete protocols with only obsolete prefs
Related to #17465 and !3526
2021-07-13 23:12:04 +00:00
Martin Mathieson 030d659f88 More mask checks and some fixes. 2021-07-11 14:55:55 +00:00
Martin Mathieson 9e5d051a8a check_typed_item_calls.py Some more mask checks
Fix a handful of (trivial) issues found.
2021-07-08 13:02:18 +00:00
Martin Tschoepe d3ec582c26 PROFINET: Ensure multiple submodules are parsed
GSML parsing has a bug related to multiple submodules,
such that, the first submodule found in the GSDML needs
to be the PROFIsafe element, otherwise the description
is not parsed.
2021-06-30 13:45:18 +00:00
Gerald Combs 4609bc4ad5 CMake: Mark our plugin include directories PRIVATE.
Use target_include_directories to mark our local include directories
PRIVATE, similar to what we do elsewhere.
2021-06-22 22:17:42 +00:00
João Valverde 8cf9791679 Replace some lingering references to g_log() 2021-06-19 02:34:36 +00:00
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +00:00
João Valverde 39df3ae3c0 Replace g_log() calls with ws_log() 2021-06-16 12:50:27 +00:00
basakkalfa 7132fcaeb0 PROFINET: DCP SET Block with 0 Block Length
If there is DCP SET block with 0 block length, it is dissected
as erroneous block since DCP SET block can not have 0 block
length. Moreover, DCPBlockLength is not decoded if DCP option
and suboption is 0. However, each DCP block must have
Option/Suboption/DCPBlockLength. This is also fixed.
2021-06-09 05:23:16 +00:00